Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix funding trade field #556

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
4.0.16
- WSv2: fix parse funding trade failed.

4.0.15
- fix 2 high vulnerabilities, switch from cli-table2 to cli-table3 dependency

Expand Down
9 changes: 4 additions & 5 deletions lib/transports/ws2.js
Original file line number Diff line number Diff line change
Expand Up @@ -979,13 +979,12 @@ 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 trades = M.unserialize(data)
const M = eventName[0] === 'f' && data[0].length === 8 ? FundingTrade : PublicTrade

if (_isArray(trades) && trades.length === 1) {
data = trades[0]
if (_isArray(payload) && payload.length === 1) {
data = payload[0]
} else {
data = trades
data = payload
}

data = new M(data)
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bitfinex-api-node",
"version": "4.0.15",
"version": "4.0.16",
"description": "Node reference library for Bitfinex API",
"engines": {
"node": ">=8.3.0"
Expand Down Expand Up @@ -64,17 +64,16 @@
"standard": "^14.3.1"
},
"dependencies": {
"readline-promise": "^1.0.4",
"blessed": "^0.1.81",
"blessed-contrib": "^4.8.19",
"cli-table3": "^0.6.0",
"bfx-api-node-models": "^1.2.1",
"bfx-api-node-rest": "^3.0.8",
"bfx-api-node-util": "^1.0.2",
"bfx-api-node-ws1": "^1.0.0",
"bignumber.js": "^9.0.0",
"blessed": "^0.1.81",
"blessed-contrib": "^4.8.19",
"bluebird": "^3.5.1",
"cbq": "0.0.1",
"cli-table3": "^0.6.0",
"copy": "^0.3.2",
"crc-32": "^1.2.0",
"debug": "^4.1.1",
Expand All @@ -83,8 +82,9 @@
"lossless-json": "^1.0.3",
"p-iteration": "^1.1.8",
"promise-throttle": "^1.0.1",
"readline-promise": "^1.0.4",
"request": "^2.67.0",
"request-promise": "^4.2.0",
"ws": "^7.2.1"
"ws": "^7.4.6"
}
}