Skip to content

Commit 8772544

Browse files
authored
Merge pull request #959 from ccxt/fstream-url-get
Fstream url get
2 parents ce9a718 + caaf5ea commit 8772544

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/node-binance-api.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,11 @@ export default class Binance {
261261
return this.stream;
262262
}
263263

264+
getFStreamUrl() {
265+
if (this.Options.test) return this.fstreamSingleTest;
266+
return this.fstreamSingle;
267+
}
268+
264269
uuid22(a?: any) {
265270
return a ? (a ^ Math.random() * 16 >> a / 4).toString(16) : (([1e7] as any) + 1e3 + 4e3 + 8e5).replace(/[018]/g, this.uuid22);
266271
}
@@ -1457,14 +1462,14 @@ export default class Binance {
14571462
host: this.parseProxy(socksproxy)[1],
14581463
port: this.parseProxy(socksproxy)[2]
14591464
});
1460-
ws = new WebSocket((this.Options.test ? this.fstreamSingleTest : this.fstreamSingle) + endpoint, { agent });
1465+
ws = new WebSocket((this.getFStreamUrl()) + endpoint, { agent });
14611466
} else if (httpsproxy) {
14621467
const config = url.parse(httpsproxy);
14631468
const agent = new HttpsProxyAgent(config);
14641469
if (this.Options.verbose) this.Options.log(`futuresSubscribeSingle: using proxy server: ${agent}`);
1465-
ws = new WebSocket((this.Options.test ? this.fstreamSingleTest : this.fstreamSingle) + endpoint, { agent });
1470+
ws = new WebSocket((this.getFStreamUrl()) + endpoint, { agent });
14661471
} else {
1467-
ws = new WebSocket((this.Options.test ? this.fstreamSingleTest : this.fstreamSingle) + endpoint);
1472+
ws = new WebSocket((this.getFStreamUrl()) + endpoint);
14681473
}
14691474

14701475
if (this.Options.verbose) this.Options.log('futuresSubscribeSingle: Subscribed to ' + endpoint);

0 commit comments

Comments
 (0)