Skip to content

Commit

Permalink
Fix: FundingTrade is parsed incorrectly bitfinexcom#556
Browse files Browse the repository at this point in the history
  • Loading branch information
derektu committed Dec 3, 2020
1 parent fabfc1c commit 1261c02
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/transports/ws2.js
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,8 @@ class WSv2 extends EventEmitter {
let data = payload

if (this._transform) { // correctly parse single trade/array of trades
const M = eventName[0] === 'f' ? FundingTrade : PublicTrade
/* const M = eventName[0] === 'f' ? FundingTrade : PublicTrade */
const M = eventName[0] === 'f' && data[0].length === 8 ? FundingTrade : PublicTrade
const trades = M.unserialize(data)

if (_isArray(trades) && trades.length === 1) {
Expand Down

0 comments on commit 1261c02

Please sign in to comment.