Skip to content

Commit be6596c

Browse files
authored
Merge pull request #578 from vitaliystoliarovcc/fix/emit-public-funding-trades
Fix public funding trades parsing
2 parents 20cf444 + 92a7b77 commit be6596c

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

CHANGELOG

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
5.0.4
2+
- fix: public funding trade parsing
3+
- styling: fix code formatting
4+
15
5.0.0
2-
- upgrade: upgraded bfx-api-node-rest to 4.0.0, breaks previous versions compatibility
6+
- upgrade: upgraded bfx-api-node-rest to 4.0.0, breaks previous versions compatibility
37
- fix: jsdocs
48

59
4.0.17

examples/rest2/wallets.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ async function execute () {
7272

7373
...(_isFinite(value)
7474
? [
75-
prepareAmount(value),
76-
currency !== valueCCY
77-
? prepareAmount(lastPrices[symbolForWallet({ currency })])
78-
: 1
79-
]
75+
prepareAmount(value),
76+
currency !== valueCCY
77+
? prepareAmount(lastPrices[symbolForWallet({ currency })])
78+
: 1
79+
]
8080
: [
81-
'-',
82-
'-'
83-
])
81+
'-',
82+
'-'
83+
])
8484
]
8585
})
8686

lib/transports/ws2.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ class WSv2 extends EventEmitter {
473473
return authSeq !== this._lastAuthSeq
474474
? new Error(
475475
`invalid auth seq #, expected no advancement but got ${authSeq}`
476-
)
476+
)
477477
: null
478478
}
479479

@@ -971,7 +971,7 @@ class WSv2 extends EventEmitter {
971971
let data = payload
972972

973973
if (this._transform) { // correctly parse single trade/array of trades
974-
const M = eventName[0] === 'f' ? FundingTrade : PublicTrade
974+
const M = eventName[0] === 'f' && msg[2].length === 8 ? FundingTrade : PublicTrade
975975
const trades = M.unserialize(data)
976976

977977
if (_isArray(trades) && trades.length === 1) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bitfinex-api-node",
3-
"version": "5.0.3",
3+
"version": "5.0.4",
44
"description": "Node reference library for Bitfinex API",
55
"engines": {
66
"node": ">=8.3.0"

0 commit comments

Comments
 (0)