Skip to content

Commit 3f20772

Browse files
committed
test fix
1 parent 605d0fc commit 3f20772

1 file changed

Lines changed: 8 additions & 17 deletions

File tree

src/node-binance-api.ts

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export default class Binance {
123123
userDeliveryData: this.userDeliveryData.bind(this),
124124
subscribeCombined: this.subscribeCombined.bind(this),
125125
subscribe: this.subscribe.bind(this),
126-
subscriptions: () => this.getSubscriptions.bind(this),
126+
subscriptions: () => this.subscriptions,
127127
terminate: this.terminate.bind(this),
128128
depth: this.depthStream.bind(this),
129129
depthCache: this.depthCacheStream.bind(this),
@@ -151,8 +151,8 @@ export default class Binance {
151151
deliveryBookTicker: this.deliveryBookTickerStream.bind(this),
152152
deliveryChart: this.deliveryChart.bind(this),
153153
deliveryLiquidation: this.deliveryLiquidationStream.bind(this),
154-
futuresSubcriptions: () => this.getFuturesSubscriptions.bind(this),
155-
deliverySubcriptions: () => this.getDeliverySubscriptions.bind(this),
154+
futuresSubcriptions: () => this.futuresSubscriptions,
155+
deliverySubcriptions: () => this.deliverySubscriptions,
156156
futuresTerminate: this.futuresTerminate.bind(this),
157157
deliveryTerminate: this.deliveryTerminate.bind(this),
158158
};
@@ -1331,7 +1331,7 @@ export default class Binance {
13311331
handleSocketOpen(wsBind, opened_callback: Callback) {
13321332
wsBind.isAlive = true;
13331333
if (Object.keys(this.subscriptions).length === 0) {
1334-
this.socketHeartbeatInterval = setInterval(this.socketHeartbeat, this.heartBeatInterval);
1334+
this.socketHeartbeatInterval = setInterval(this.socketHeartbeat.bind(this), this.heartBeatInterval);
13351335
}
13361336
this.subscriptions[wsBind.url] = wsBind;
13371337
if (typeof opened_callback === 'function') opened_callback(wsBind.url);
@@ -1677,7 +1677,7 @@ export default class Binance {
16771677
handleFuturesSocketOpen(wsBind: any, openCallback: Callback) {
16781678
wsBind.isAlive = true;
16791679
if (Object.keys(this.futuresSubscriptions).length === 0) {
1680-
this.socketHeartbeatInterval = setInterval(this.futuresSocketHeartbeat, this.heartBeatInterval);
1680+
this.socketHeartbeatInterval = setInterval(this.futuresSocketHeartbeat.bind(this), this.heartBeatInterval);
16811681
}
16821682
this.futuresSubscriptions[wsBind.url] = wsBind;
16831683
if (typeof openCallback === 'function') openCallback(wsBind.url);
@@ -2391,7 +2391,7 @@ export default class Binance {
23912391
handleDeliverySocketOpen(wsBind, openCallback: Callback) {
23922392
this.isAlive = true;
23932393
if (Object.keys(this.deliverySubscriptions).length === 0) {
2394-
this.socketHeartbeatInterval = setInterval(this.deliverySocketHeartbeat, 30000);
2394+
this.socketHeartbeatInterval = setInterval(this.deliverySocketHeartbeat.bind(this), 30000);
23952395
}
23962396
this.deliverySubscriptions[wsBind.url] = this;
23972397
if (typeof openCallback === 'function') openCallback(wsBind.url);
@@ -6446,11 +6446,7 @@ export default class Binance {
64466446
return symbol.toLowerCase() + `@depth@100ms`;
64476447
});
64486448
const mapLimit = this.mapLimit.bind(this);
6449-
subscription = this.subscribeCombined(streams, handleDepthStreamData, reconnect, function () {
6450-
// async.mapLimit(symbols, 50, getSymbolDepthSnapshot, (err, results) => {
6451-
// if (err) throw err;
6452-
// results.forEach(updateSymbolDepthCache);
6453-
// });
6449+
subscription = this.subscribeCombined(streams, handleDepthStreamData, reconnect, () => {
64546450
mapLimit(symbols, 50, getSymbolDepthSnapshot)
64556451
.then(results => {
64566452
results.forEach(updateSymbolDepthCache);
@@ -6464,19 +6460,14 @@ export default class Binance {
64646460
const symbol = symbols;
64656461
symbolDepthInit(symbol);
64666462
const mapLimit = this.mapLimit.bind(this);
6467-
subscription = this.subscribe(symbol.toLowerCase() + `@depth@100ms`, handleDepthStreamData, reconnect, function () {
6468-
// async.mapLimit([symbol], 1, getSymbolDepthSnapshot, (err, results) => {
6469-
// if (err) throw err;
6470-
// results.forEach(updateSymbolDepthCache);
6471-
// });
6463+
subscription = this.subscribe(symbol.toLowerCase() + `@depth@100ms`, handleDepthStreamData, reconnect, () => {
64726464
mapLimit([symbol], 1, getSymbolDepthSnapshot)
64736465
.then(results => {
64746466
results.forEach(updateSymbolDepthCache);
64756467
})
64766468
.catch(err => {
64776469
throw err;
64786470
});
6479-
64806471
});
64816472
assignEndpointIdToContext(symbol, subscription.endpoint);
64826473
}

0 commit comments

Comments
 (0)