ccxt 4.3.89 → 4.3.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/alpaca.js +2 -2
- package/dist/cjs/src/ascendex.js +95 -97
- package/dist/cjs/src/bingx.js +31 -17
- package/dist/cjs/src/bitfinex2.js +21 -22
- package/dist/cjs/src/bitget.js +2 -2
- package/dist/cjs/src/bitmart.js +6 -9
- package/dist/cjs/src/coinbaseinternational.js +2 -1
- package/dist/cjs/src/coinex.js +1 -17
- package/dist/cjs/src/hitbtc.js +1 -0
- package/dist/cjs/src/htx.js +49 -49
- package/dist/cjs/src/huobijp.js +0 -9
- package/dist/cjs/src/latoken.js +1 -0
- package/dist/cjs/src/okx.js +1 -8
- package/dist/cjs/src/pro/binance.js +323 -0
- package/dist/cjs/src/pro/bingx.js +263 -91
- package/dist/cjs/src/pro/bithumb.js +5 -1
- package/dist/cjs/src/pro/bybit.js +1 -1
- package/dist/cjs/src/pro/coinex.js +994 -679
- package/dist/cjs/src/pro/lbank.js +2 -3
- package/dist/cjs/src/pro/okx.js +159 -3
- package/dist/cjs/src/whitebit.js +5 -3
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/alpaca.js +2 -2
- package/js/src/ascendex.js +95 -97
- package/js/src/bingx.js +31 -17
- package/js/src/bitfinex2.d.ts +0 -1
- package/js/src/bitfinex2.js +21 -22
- package/js/src/bitget.js +2 -2
- package/js/src/bitmart.d.ts +0 -1
- package/js/src/bitmart.js +6 -9
- package/js/src/coinbaseinternational.js +2 -1
- package/js/src/coinex.d.ts +0 -2
- package/js/src/coinex.js +1 -17
- package/js/src/hitbtc.js +1 -0
- package/js/src/htx.js +49 -49
- package/js/src/huobijp.d.ts +0 -1
- package/js/src/huobijp.js +0 -9
- package/js/src/latoken.js +1 -0
- package/js/src/okx.d.ts +0 -1
- package/js/src/okx.js +1 -8
- package/js/src/pro/binance.d.ts +9 -1
- package/js/src/pro/binance.js +327 -1
- package/js/src/pro/bingx.d.ts +2 -2
- package/js/src/pro/bingx.js +263 -91
- package/js/src/pro/bithumb.js +5 -1
- package/js/src/pro/bybit.js +1 -1
- package/js/src/pro/coinex.d.ts +12 -6
- package/js/src/pro/coinex.js +996 -681
- package/js/src/pro/lbank.js +2 -3
- package/js/src/pro/okx.d.ts +7 -0
- package/js/src/pro/okx.js +162 -4
- package/js/src/whitebit.js +5 -3
- package/package.json +1 -1
package/js/src/pro/binance.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// ----------------------------------------------------------------------------
|
|
8
8
|
import binanceRest from '../binance.js';
|
|
9
9
|
import { Precise } from '../base/Precise.js';
|
|
10
|
-
import { ChecksumError, ArgumentsRequired, BadRequest, NotSupported } from '../base/errors.js';
|
|
10
|
+
import { ChecksumError, ArgumentsRequired, BadRequest, NotSupported, UnsubscribeError } from '../base/errors.js';
|
|
11
11
|
import { ArrayCache, ArrayCacheByTimestamp, ArrayCacheBySymbolById, ArrayCacheBySymbolBySide } from '../base/ws/Cache.js';
|
|
12
12
|
import { sha256 } from '../static_dependencies/noble-hashes/sha256.js';
|
|
13
13
|
import { rsa } from '../base/functions/rsa.js';
|
|
@@ -652,6 +652,81 @@ export default class binance extends binanceRest {
|
|
|
652
652
|
const orderbook = await this.watchMultiple(url, messageHashes, this.extend(request, params), messageHashes, subscription);
|
|
653
653
|
return orderbook.limit();
|
|
654
654
|
}
|
|
655
|
+
async unWatchOrderBookForSymbols(symbols, params = {}) {
|
|
656
|
+
/**
|
|
657
|
+
* @method
|
|
658
|
+
* @name binance#unWatchOrderBookForSymbols
|
|
659
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#partial-book-depth-streams
|
|
660
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#diff-depth-stream
|
|
661
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#partial-book-depth-streams
|
|
662
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#diff-book-depth-streams
|
|
663
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#partial-book-depth-streams
|
|
664
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#diff-book-depth-streams
|
|
665
|
+
* @description unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
666
|
+
* @param {string[]} symbols unified array of symbols
|
|
667
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
668
|
+
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
669
|
+
*/
|
|
670
|
+
await this.loadMarkets();
|
|
671
|
+
symbols = this.marketSymbols(symbols, undefined, false, true, true);
|
|
672
|
+
const firstMarket = this.market(symbols[0]);
|
|
673
|
+
let type = firstMarket['type'];
|
|
674
|
+
if (firstMarket['contract']) {
|
|
675
|
+
type = firstMarket['linear'] ? 'future' : 'delivery';
|
|
676
|
+
}
|
|
677
|
+
const name = 'depth';
|
|
678
|
+
let streamHash = 'multipleOrderbook';
|
|
679
|
+
if (symbols !== undefined) {
|
|
680
|
+
streamHash += '::' + symbols.join(',');
|
|
681
|
+
}
|
|
682
|
+
const watchOrderBookRate = this.safeString(this.options, 'watchOrderBookRate', '100');
|
|
683
|
+
const subParams = [];
|
|
684
|
+
const subMessageHashes = [];
|
|
685
|
+
const messageHashes = [];
|
|
686
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
687
|
+
const symbol = symbols[i];
|
|
688
|
+
const market = this.market(symbol);
|
|
689
|
+
subMessageHashes.push('orderbook::' + symbol);
|
|
690
|
+
messageHashes.push('unsubscribe:orderbook:' + symbol);
|
|
691
|
+
const subscriptionHash = market['lowercaseId'] + '@' + name;
|
|
692
|
+
const symbolHash = subscriptionHash + '@' + watchOrderBookRate + 'ms';
|
|
693
|
+
subParams.push(symbolHash);
|
|
694
|
+
}
|
|
695
|
+
const messageHashesLength = subMessageHashes.length;
|
|
696
|
+
const url = this.urls['api']['ws'][type] + '/' + this.stream(type, streamHash, messageHashesLength);
|
|
697
|
+
const requestId = this.requestId(url);
|
|
698
|
+
const request = {
|
|
699
|
+
'method': 'UNSUBSCRIBE',
|
|
700
|
+
'params': subParams,
|
|
701
|
+
'id': requestId,
|
|
702
|
+
};
|
|
703
|
+
const subscription = {
|
|
704
|
+
'unsubscribe': true,
|
|
705
|
+
'id': requestId.toString(),
|
|
706
|
+
'symbols': symbols,
|
|
707
|
+
'subMessageHashes': subMessageHashes,
|
|
708
|
+
'messageHashes': messageHashes,
|
|
709
|
+
'topic': 'orderbook',
|
|
710
|
+
};
|
|
711
|
+
return await this.watchMultiple(url, messageHashes, this.extend(request, params), messageHashes, subscription);
|
|
712
|
+
}
|
|
713
|
+
async unWatchOrderBook(symbol, params = {}) {
|
|
714
|
+
/**
|
|
715
|
+
* @method
|
|
716
|
+
* @name binance#unWatchOrderBook
|
|
717
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#partial-book-depth-streams
|
|
718
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#diff-depth-stream
|
|
719
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#partial-book-depth-streams
|
|
720
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#diff-book-depth-streams
|
|
721
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#partial-book-depth-streams
|
|
722
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#diff-book-depth-streams
|
|
723
|
+
* @description unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
724
|
+
* @param {string} symbol unified array of symbols
|
|
725
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
726
|
+
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
727
|
+
*/
|
|
728
|
+
return await this.unWatchOrderBookForSymbols([symbol], params);
|
|
729
|
+
}
|
|
655
730
|
async fetchOrderBookWs(symbol, limit = undefined, params = {}) {
|
|
656
731
|
/**
|
|
657
732
|
* @method
|
|
@@ -939,8 +1014,71 @@ export default class binance extends binanceRest {
|
|
|
939
1014
|
if (method !== undefined) {
|
|
940
1015
|
method.call(this, client, message, subscription);
|
|
941
1016
|
}
|
|
1017
|
+
const isUnSubMessage = this.safeBool(subscription, 'unsubscribe', false);
|
|
1018
|
+
if (isUnSubMessage) {
|
|
1019
|
+
this.handleUnSubscription(client, subscription);
|
|
1020
|
+
}
|
|
942
1021
|
return message;
|
|
943
1022
|
}
|
|
1023
|
+
handleUnSubscription(client, subscription) {
|
|
1024
|
+
const messageHashes = this.safeList(subscription, 'messageHashes', []);
|
|
1025
|
+
const subMessageHashes = this.safeList(subscription, 'subMessageHashes', []);
|
|
1026
|
+
for (let j = 0; j < messageHashes.length; j++) {
|
|
1027
|
+
const unsubHash = messageHashes[j];
|
|
1028
|
+
const subHash = subMessageHashes[j];
|
|
1029
|
+
if (unsubHash in client.subscriptions) {
|
|
1030
|
+
delete client.subscriptions[unsubHash];
|
|
1031
|
+
}
|
|
1032
|
+
if (subHash in client.subscriptions) {
|
|
1033
|
+
delete client.subscriptions[subHash];
|
|
1034
|
+
}
|
|
1035
|
+
const error = new UnsubscribeError(this.id + ' ' + subHash);
|
|
1036
|
+
client.reject(error, subHash);
|
|
1037
|
+
client.resolve(true, unsubHash);
|
|
1038
|
+
this.cleanCache(subscription);
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
cleanCache(subscription) {
|
|
1042
|
+
const topic = this.safeString(subscription, 'topic');
|
|
1043
|
+
const symbols = this.safeList(subscription, 'symbols', []);
|
|
1044
|
+
const symbolsLength = symbols.length;
|
|
1045
|
+
if (symbolsLength > 0) {
|
|
1046
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
1047
|
+
const symbol = symbols[i];
|
|
1048
|
+
if (topic === 'trade') {
|
|
1049
|
+
delete this.trades[symbol];
|
|
1050
|
+
}
|
|
1051
|
+
else if (topic === 'orderbook') {
|
|
1052
|
+
delete this.orderbooks[symbol];
|
|
1053
|
+
}
|
|
1054
|
+
else if (topic === 'ticker') {
|
|
1055
|
+
delete this.tickers[symbol];
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
else {
|
|
1060
|
+
if (topic === 'myTrades') {
|
|
1061
|
+
// don't reset this.myTrades directly here
|
|
1062
|
+
// because in c# we need to use a different object
|
|
1063
|
+
const keys = Object.keys(this.myTrades);
|
|
1064
|
+
for (let i = 0; i < keys.length; i++) {
|
|
1065
|
+
delete this.myTrades[keys[i]];
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
else if (topic === 'orders') {
|
|
1069
|
+
const orderSymbols = Object.keys(this.orders);
|
|
1070
|
+
for (let i = 0; i < orderSymbols.length; i++) {
|
|
1071
|
+
delete this.orders[orderSymbols[i]];
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
else if (topic === 'ticker') {
|
|
1075
|
+
const tickerSymbols = Object.keys(this.tickers);
|
|
1076
|
+
for (let i = 0; i < tickerSymbols.length; i++) {
|
|
1077
|
+
delete this.tickers[tickerSymbols[i]];
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
944
1082
|
async watchTradesForSymbols(symbols, since = undefined, limit = undefined, params = {}) {
|
|
945
1083
|
/**
|
|
946
1084
|
* @method
|
|
@@ -1004,6 +1142,85 @@ export default class binance extends binanceRest {
|
|
|
1004
1142
|
}
|
|
1005
1143
|
return this.filterBySinceLimit(trades, since, limit, 'timestamp', true);
|
|
1006
1144
|
}
|
|
1145
|
+
async unWatchTradesForSymbols(symbols, params = {}) {
|
|
1146
|
+
/**
|
|
1147
|
+
* @method
|
|
1148
|
+
* @name binance#unWatchTradesForSymbols
|
|
1149
|
+
* @description unsubscribes from the trades channel
|
|
1150
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#aggregate-trade-streams
|
|
1151
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#trade-streams
|
|
1152
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#aggregate-trade-streams
|
|
1153
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#aggregate-trade-streams
|
|
1154
|
+
* @param {string[]} symbols unified symbol of the market to fetch trades for
|
|
1155
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1156
|
+
* @param {string} [params.name] the name of the method to call, 'trade' or 'aggTrade', default is 'trade'
|
|
1157
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
1158
|
+
*/
|
|
1159
|
+
await this.loadMarkets();
|
|
1160
|
+
symbols = this.marketSymbols(symbols, undefined, false, true, true);
|
|
1161
|
+
let streamHash = 'multipleTrades';
|
|
1162
|
+
if (symbols !== undefined) {
|
|
1163
|
+
const symbolsLength = symbols.length;
|
|
1164
|
+
if (symbolsLength > 200) {
|
|
1165
|
+
throw new BadRequest(this.id + ' watchTradesForSymbols() accepts 200 symbols at most. To watch more symbols call watchTradesForSymbols() multiple times');
|
|
1166
|
+
}
|
|
1167
|
+
streamHash += '::' + symbols.join(',');
|
|
1168
|
+
}
|
|
1169
|
+
let name = undefined;
|
|
1170
|
+
[name, params] = this.handleOptionAndParams(params, 'watchTradesForSymbols', 'name', 'trade');
|
|
1171
|
+
params = this.omit(params, 'callerMethodName');
|
|
1172
|
+
const firstMarket = this.market(symbols[0]);
|
|
1173
|
+
let type = firstMarket['type'];
|
|
1174
|
+
if (firstMarket['contract']) {
|
|
1175
|
+
type = firstMarket['linear'] ? 'future' : 'delivery';
|
|
1176
|
+
}
|
|
1177
|
+
const subMessageHashes = [];
|
|
1178
|
+
const subParams = [];
|
|
1179
|
+
const messageHashes = [];
|
|
1180
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
1181
|
+
const symbol = symbols[i];
|
|
1182
|
+
const market = this.market(symbol);
|
|
1183
|
+
subMessageHashes.push('trade::' + symbol);
|
|
1184
|
+
messageHashes.push('unsubscribe:trade:' + symbol);
|
|
1185
|
+
const rawHash = market['lowercaseId'] + '@' + name;
|
|
1186
|
+
subParams.push(rawHash);
|
|
1187
|
+
}
|
|
1188
|
+
const query = this.omit(params, 'type');
|
|
1189
|
+
const subParamsLength = subParams.length;
|
|
1190
|
+
const url = this.urls['api']['ws'][type] + '/' + this.stream(type, streamHash, subParamsLength);
|
|
1191
|
+
const requestId = this.requestId(url);
|
|
1192
|
+
const request = {
|
|
1193
|
+
'method': 'UNSUBSCRIBE',
|
|
1194
|
+
'params': subParams,
|
|
1195
|
+
'id': requestId,
|
|
1196
|
+
};
|
|
1197
|
+
const subscription = {
|
|
1198
|
+
'unsubscribe': true,
|
|
1199
|
+
'id': requestId.toString(),
|
|
1200
|
+
'subMessageHashes': subMessageHashes,
|
|
1201
|
+
'messageHashes': messageHashes,
|
|
1202
|
+
'symbols': symbols,
|
|
1203
|
+
'topic': 'trade',
|
|
1204
|
+
};
|
|
1205
|
+
return await this.watchMultiple(url, messageHashes, this.extend(request, query), messageHashes, subscription);
|
|
1206
|
+
}
|
|
1207
|
+
async unWatchTrades(symbol, params = {}) {
|
|
1208
|
+
/**
|
|
1209
|
+
* @method
|
|
1210
|
+
* @name binance#unWatchTrades
|
|
1211
|
+
* @description unsubscribes from the trades channel
|
|
1212
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#aggregate-trade-streams
|
|
1213
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#trade-streams
|
|
1214
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#aggregate-trade-streams
|
|
1215
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#aggregate-trade-streams
|
|
1216
|
+
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
1217
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1218
|
+
* @param {string} [params.name] the name of the method to call, 'trade' or 'aggTrade', default is 'trade'
|
|
1219
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
1220
|
+
*/
|
|
1221
|
+
await this.loadMarkets();
|
|
1222
|
+
return await this.unWatchTradesForSymbols([symbol], params);
|
|
1223
|
+
}
|
|
1007
1224
|
async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
|
|
1008
1225
|
/**
|
|
1009
1226
|
* @method
|
|
@@ -1537,6 +1754,115 @@ export default class binance extends binanceRest {
|
|
|
1537
1754
|
}
|
|
1538
1755
|
return this.filterByArray(this.tickers, 'symbol', symbols);
|
|
1539
1756
|
}
|
|
1757
|
+
async unWatchTickers(symbols = undefined, params = {}) {
|
|
1758
|
+
/**
|
|
1759
|
+
* @method
|
|
1760
|
+
* @name binance#unWatchTickers
|
|
1761
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#individual-symbol-mini-ticker-stream
|
|
1762
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#individual-symbol-ticker-streams
|
|
1763
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#all-market-mini-tickers-stream
|
|
1764
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#individual-symbol-ticker-streams
|
|
1765
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#all-market-mini-tickers-stream
|
|
1766
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#individual-symbol-ticker-streams
|
|
1767
|
+
* @description unWatches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
|
|
1768
|
+
* @param {string[]} symbols unified symbol of the market to fetch the ticker for
|
|
1769
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1770
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
1771
|
+
*/
|
|
1772
|
+
let channelName = undefined;
|
|
1773
|
+
[channelName, params] = this.handleOptionAndParams(params, 'watchTickers', 'name', 'ticker');
|
|
1774
|
+
if (channelName === 'bookTicker') {
|
|
1775
|
+
throw new BadRequest(this.id + ' deprecation notice - to subscribe for bids-asks, use watch_bids_asks() method instead');
|
|
1776
|
+
}
|
|
1777
|
+
await this.loadMarkets();
|
|
1778
|
+
const methodName = 'watchTickers';
|
|
1779
|
+
symbols = this.marketSymbols(symbols, undefined, true, false, true);
|
|
1780
|
+
let firstMarket = undefined;
|
|
1781
|
+
let marketType = undefined;
|
|
1782
|
+
const symbolsDefined = (symbols !== undefined);
|
|
1783
|
+
if (symbolsDefined) {
|
|
1784
|
+
firstMarket = this.market(symbols[0]);
|
|
1785
|
+
}
|
|
1786
|
+
[marketType, params] = this.handleMarketTypeAndParams(methodName, firstMarket, params);
|
|
1787
|
+
let subType = undefined;
|
|
1788
|
+
[subType, params] = this.handleSubTypeAndParams(methodName, firstMarket, params);
|
|
1789
|
+
let rawMarketType = undefined;
|
|
1790
|
+
if (this.isLinear(marketType, subType)) {
|
|
1791
|
+
rawMarketType = 'future';
|
|
1792
|
+
}
|
|
1793
|
+
else if (this.isInverse(marketType, subType)) {
|
|
1794
|
+
rawMarketType = 'delivery';
|
|
1795
|
+
}
|
|
1796
|
+
else if (marketType === 'spot') {
|
|
1797
|
+
rawMarketType = marketType;
|
|
1798
|
+
}
|
|
1799
|
+
else {
|
|
1800
|
+
throw new NotSupported(this.id + ' ' + methodName + '() does not support options markets');
|
|
1801
|
+
}
|
|
1802
|
+
const isBidAsk = (channelName === 'bookTicker');
|
|
1803
|
+
const subscriptionArgs = [];
|
|
1804
|
+
const subMessageHashes = [];
|
|
1805
|
+
const messageHashes = [];
|
|
1806
|
+
if (symbolsDefined) {
|
|
1807
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
1808
|
+
const symbol = symbols[i];
|
|
1809
|
+
const market = this.market(symbol);
|
|
1810
|
+
subscriptionArgs.push(market['lowercaseId'] + '@' + channelName);
|
|
1811
|
+
subMessageHashes.push(this.getMessageHash(channelName, market['symbol'], isBidAsk));
|
|
1812
|
+
messageHashes.push('unsubscribe:ticker:' + symbol);
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1815
|
+
else {
|
|
1816
|
+
if (isBidAsk) {
|
|
1817
|
+
if (marketType === 'spot') {
|
|
1818
|
+
throw new ArgumentsRequired(this.id + ' ' + methodName + '() requires symbols for this channel for spot markets');
|
|
1819
|
+
}
|
|
1820
|
+
subscriptionArgs.push('!' + channelName);
|
|
1821
|
+
}
|
|
1822
|
+
else {
|
|
1823
|
+
subscriptionArgs.push('!' + channelName + '@arr');
|
|
1824
|
+
}
|
|
1825
|
+
subMessageHashes.push(this.getMessageHash(channelName, undefined, isBidAsk));
|
|
1826
|
+
messageHashes.push('unsubscribe:ticker');
|
|
1827
|
+
}
|
|
1828
|
+
let streamHash = channelName;
|
|
1829
|
+
if (symbolsDefined) {
|
|
1830
|
+
streamHash = channelName + '::' + symbols.join(',');
|
|
1831
|
+
}
|
|
1832
|
+
const url = this.urls['api']['ws'][rawMarketType] + '/' + this.stream(rawMarketType, streamHash);
|
|
1833
|
+
const requestId = this.requestId(url);
|
|
1834
|
+
const request = {
|
|
1835
|
+
'method': 'UNSUBSCRIBE',
|
|
1836
|
+
'params': subscriptionArgs,
|
|
1837
|
+
'id': requestId,
|
|
1838
|
+
};
|
|
1839
|
+
const subscription = {
|
|
1840
|
+
'unsubscribe': true,
|
|
1841
|
+
'id': requestId.toString(),
|
|
1842
|
+
'subMessageHashes': subMessageHashes,
|
|
1843
|
+
'messageHashes': subMessageHashes,
|
|
1844
|
+
'symbols': symbols,
|
|
1845
|
+
'topic': 'ticker',
|
|
1846
|
+
};
|
|
1847
|
+
return await this.watchMultiple(url, subMessageHashes, this.extend(request, params), subMessageHashes, subscription);
|
|
1848
|
+
}
|
|
1849
|
+
async unWatchTicker(symbol, params = {}) {
|
|
1850
|
+
/**
|
|
1851
|
+
* @method
|
|
1852
|
+
* @name binance#unWatchTicker
|
|
1853
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#individual-symbol-mini-ticker-stream
|
|
1854
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#individual-symbol-ticker-streams
|
|
1855
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#all-market-mini-tickers-stream
|
|
1856
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#individual-symbol-ticker-streams
|
|
1857
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#all-market-mini-tickers-stream
|
|
1858
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#individual-symbol-ticker-streams
|
|
1859
|
+
* @description unWatches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
|
|
1860
|
+
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
1861
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1862
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
1863
|
+
*/
|
|
1864
|
+
return await this.unWatchTickers([symbol], params);
|
|
1865
|
+
}
|
|
1540
1866
|
async watchBidsAsks(symbols = undefined, params = {}) {
|
|
1541
1867
|
/**
|
|
1542
1868
|
* @method
|
package/js/src/pro/bingx.d.ts
CHANGED
|
@@ -22,8 +22,8 @@ export default class bingx extends bingxRest {
|
|
|
22
22
|
watchOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
23
23
|
watchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
24
24
|
watchBalance(params?: {}): Promise<Balances>;
|
|
25
|
-
setBalanceCache(client: Client, type: any, subscriptionHash: any, params: any): void;
|
|
26
|
-
loadBalanceSnapshot(client: any, messageHash: any, type: any): Promise<void>;
|
|
25
|
+
setBalanceCache(client: Client, type: any, subType: any, subscriptionHash: any, params: any): void;
|
|
26
|
+
loadBalanceSnapshot(client: any, messageHash: any, type: any, subType: any): Promise<void>;
|
|
27
27
|
handleErrorMessage(client: any, message: any): boolean;
|
|
28
28
|
keepAliveListenKey(params?: {}): Promise<void>;
|
|
29
29
|
authenticate(params?: {}): Promise<void>;
|