ccxt 4.5.5 → 4.5.7
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 +4 -4
- package/dist/ccxt.browser.min.js +15 -15
- package/dist/cjs/ccxt.js +6 -6
- package/dist/cjs/src/abstract/toobit.js +11 -0
- package/dist/cjs/src/abstract/tradeogre.js +1 -1
- package/dist/cjs/src/apex.js +2 -2
- package/dist/cjs/src/backpack.js +1 -1
- package/dist/cjs/src/base/Exchange.js +129 -2
- package/dist/cjs/src/bigone.js +4 -4
- package/dist/cjs/src/binance.js +82 -20
- package/dist/cjs/src/bingx.js +5 -2
- package/dist/cjs/src/bitbank.js +1 -0
- package/dist/cjs/src/bitbns.js +1 -0
- package/dist/cjs/src/bitflyer.js +1 -0
- package/dist/cjs/src/bitget.js +16 -9
- package/dist/cjs/src/bithumb.js +1 -0
- package/dist/cjs/src/bitso.js +1 -0
- package/dist/cjs/src/bitvavo.js +26 -40
- package/dist/cjs/src/blockchaincom.js +1 -0
- package/dist/cjs/src/btcalpha.js +1 -0
- package/dist/cjs/src/btcbox.js +1 -0
- package/dist/cjs/src/btcmarkets.js +1 -0
- package/dist/cjs/src/btcturk.js +1 -0
- package/dist/cjs/src/bybit.js +186 -127
- package/dist/cjs/src/coinsph.js +4 -1
- package/dist/cjs/src/cryptocom.js +6 -3
- package/dist/cjs/src/deribit.js +3 -2
- package/dist/cjs/src/digifinex.js +1 -1
- package/dist/cjs/src/gate.js +9 -13
- package/dist/cjs/src/gemini.js +5 -5
- package/dist/cjs/src/htx.js +11 -1
- package/dist/cjs/src/hyperliquid.js +3 -0
- package/dist/cjs/src/independentreserve.js +1 -0
- package/dist/cjs/src/indodax.js +17 -6
- package/dist/cjs/src/kraken.js +31 -8
- package/dist/cjs/src/krakenfutures.js +1 -0
- package/dist/cjs/src/kucoin.js +1 -2
- package/dist/cjs/src/luno.js +4 -1
- package/dist/cjs/src/mercado.js +1 -0
- package/dist/cjs/src/mexc.js +84 -37
- package/dist/cjs/src/novadax.js +1 -0
- package/dist/cjs/src/oceanex.js +1 -0
- package/dist/cjs/src/okcoin.js +4 -1
- package/dist/cjs/src/okx.js +52 -8
- package/dist/cjs/src/phemex.js +1 -1
- package/dist/cjs/src/pro/apex.js +8 -4
- package/dist/cjs/src/pro/backpack.js +7 -5
- package/dist/cjs/src/pro/binance.js +150 -19
- package/dist/cjs/src/pro/bingx.js +206 -220
- package/dist/cjs/src/pro/bitget.js +332 -76
- package/dist/cjs/src/pro/cex.js +1 -0
- package/dist/cjs/src/pro/htx.js +1 -1
- package/dist/cjs/src/pro/independentreserve.js +1 -0
- package/dist/cjs/src/pro/mexc.js +23 -23
- package/dist/cjs/src/pro/okx.js +46 -10
- package/dist/cjs/src/pro/toobit.js +1163 -0
- package/dist/cjs/src/pro/tradeogre.js +1 -1
- package/dist/cjs/src/toobit.js +2999 -0
- package/dist/cjs/src/tradeogre.js +1 -1
- package/dist/cjs/src/upbit.js +1 -0
- package/dist/cjs/src/wavesexchange.js +1 -0
- package/dist/cjs/src/yobit.js +1 -0
- package/dist/cjs/src/zaif.js +1 -0
- package/dist/cjs/src/zonda.js +1 -0
- package/js/ccxt.d.ts +8 -8
- package/js/ccxt.js +6 -6
- package/js/src/abstract/mexc.d.ts +1 -0
- package/js/src/abstract/myokx.d.ts +1 -0
- package/js/src/abstract/okx.d.ts +1 -0
- package/js/src/abstract/okxus.d.ts +1 -0
- package/js/src/abstract/toobit.d.ts +66 -0
- package/js/src/apex.js +2 -2
- package/js/src/backpack.js +1 -1
- package/js/src/base/Exchange.d.ts +9 -0
- package/js/src/base/Exchange.js +129 -2
- package/js/src/bigone.js +4 -4
- package/js/src/binance.d.ts +9 -0
- package/js/src/binance.js +82 -20
- package/js/src/bingx.js +5 -2
- package/js/src/bitbank.js +1 -0
- package/js/src/bitbns.js +1 -0
- package/js/src/bitflyer.js +1 -0
- package/js/src/bitget.js +16 -9
- package/js/src/bithumb.js +1 -0
- package/js/src/bitso.js +1 -0
- package/js/src/bitvavo.d.ts +0 -2
- package/js/src/bitvavo.js +27 -41
- package/js/src/blockchaincom.js +1 -0
- package/js/src/btcalpha.js +1 -0
- package/js/src/btcbox.js +1 -0
- package/js/src/btcmarkets.js +1 -0
- package/js/src/btcturk.js +1 -0
- package/js/src/bybit.d.ts +8 -0
- package/js/src/bybit.js +186 -127
- package/js/src/coinsph.js +4 -1
- package/js/src/cryptocom.js +6 -3
- package/js/src/deribit.js +3 -2
- package/js/src/digifinex.js +1 -1
- package/js/src/gate.d.ts +2 -2
- package/js/src/gate.js +9 -13
- package/js/src/gemini.js +5 -5
- package/js/src/htx.js +11 -1
- package/js/src/hyperliquid.js +3 -0
- package/js/src/independentreserve.js +1 -0
- package/js/src/indodax.js +17 -6
- package/js/src/kraken.d.ts +2 -2
- package/js/src/kraken.js +31 -8
- package/js/src/krakenfutures.js +1 -0
- package/js/src/kucoin.js +1 -2
- package/js/src/luno.js +4 -1
- package/js/src/mercado.js +1 -0
- package/js/src/mexc.d.ts +4 -1
- package/js/src/mexc.js +84 -37
- package/js/src/novadax.js +1 -0
- package/js/src/oceanex.js +1 -0
- package/js/src/okcoin.js +4 -1
- package/js/src/okx.js +52 -8
- package/js/src/phemex.js +1 -1
- package/js/src/pro/apex.js +8 -4
- package/js/src/pro/backpack.d.ts +1 -1
- package/js/src/pro/backpack.js +7 -5
- package/js/src/pro/binance.d.ts +24 -0
- package/js/src/pro/binance.js +150 -19
- package/js/src/pro/bingx.d.ts +53 -33
- package/js/src/pro/bingx.js +207 -221
- package/js/src/pro/bitget.d.ts +6 -0
- package/js/src/pro/bitget.js +332 -76
- package/js/src/pro/cex.js +1 -0
- package/js/src/pro/htx.js +1 -1
- package/js/src/pro/independentreserve.js +1 -0
- package/js/src/pro/mexc.js +23 -23
- package/js/src/pro/okx.d.ts +7 -1
- package/js/src/pro/okx.js +46 -10
- package/js/src/pro/toobit.d.ts +174 -0
- package/js/src/pro/toobit.js +1162 -0
- package/js/src/toobit.d.ts +456 -0
- package/js/src/toobit.js +2992 -0
- package/js/src/upbit.js +1 -0
- package/js/src/wavesexchange.js +1 -0
- package/js/src/yobit.js +1 -0
- package/js/src/zaif.js +1 -0
- package/js/src/zonda.js +1 -0
- package/package.json +1 -1
- package/dist/373.ccxt.browser.js +0 -7630
- package/dist/373.ccxt.browser.min.js +0 -1
- package/js/src/abstract/tradeogre.d.ts +0 -21
- package/js/src/pro/tradeogre.d.ts +0 -49
- package/js/src/pro/tradeogre.js +0 -278
- package/js/src/tradeogre.d.ts +0 -149
- package/js/src/tradeogre.js +0 -872
- /package/js/src/abstract/{tradeogre.js → toobit.js} +0 -0
package/js/src/pro/cex.js
CHANGED
|
@@ -1018,6 +1018,7 @@ export default class cex extends cexRest {
|
|
|
1018
1018
|
if (incrementalId !== storedOrderBook['nonce'] + 1) {
|
|
1019
1019
|
delete client.subscriptions[messageHash];
|
|
1020
1020
|
client.reject(this.id + ' watchOrderBook() skipped a message', messageHash);
|
|
1021
|
+
return;
|
|
1021
1022
|
}
|
|
1022
1023
|
const timestamp = this.safeInteger(data, 'time');
|
|
1023
1024
|
const asks = this.safeValue(data, 'asks', []);
|
package/js/src/pro/htx.js
CHANGED
|
@@ -964,7 +964,7 @@ export default class htx extends htxRest {
|
|
|
964
964
|
else {
|
|
965
965
|
// contract branch
|
|
966
966
|
parsedOrder = this.parseWsOrder(message, market);
|
|
967
|
-
const rawTrades = this.
|
|
967
|
+
const rawTrades = this.safeList(message, 'trade', []);
|
|
968
968
|
const tradesLength = rawTrades.length;
|
|
969
969
|
if (tradesLength > 0) {
|
|
970
970
|
const tradesObject = {
|
package/js/src/pro/mexc.js
CHANGED
|
@@ -878,6 +878,7 @@ export default class mexc extends mexcRest {
|
|
|
878
878
|
catch (e) {
|
|
879
879
|
delete client.subscriptions[messageHash];
|
|
880
880
|
client.reject(e, messageHash);
|
|
881
|
+
return;
|
|
881
882
|
}
|
|
882
883
|
client.resolve(storedOrderBook, messageHash);
|
|
883
884
|
}
|
|
@@ -1498,18 +1499,21 @@ export default class mexc extends mexcRest {
|
|
|
1498
1499
|
handleBalance(client, message) {
|
|
1499
1500
|
//
|
|
1500
1501
|
// spot
|
|
1502
|
+
//
|
|
1501
1503
|
// {
|
|
1502
|
-
//
|
|
1503
|
-
// "
|
|
1504
|
-
//
|
|
1505
|
-
//
|
|
1506
|
-
//
|
|
1507
|
-
//
|
|
1508
|
-
//
|
|
1509
|
-
//
|
|
1510
|
-
//
|
|
1511
|
-
//
|
|
1512
|
-
//
|
|
1504
|
+
// channel: "spot@private.account.v3.api.pb",
|
|
1505
|
+
// createTime: "1758134605364",
|
|
1506
|
+
// sendTime: "1758134605373",
|
|
1507
|
+
// privateAccount: {
|
|
1508
|
+
// vcoinName: "USDT",
|
|
1509
|
+
// coinId: "128f589271cb4951b03e71e6323eb7be",
|
|
1510
|
+
// balanceAmount: "0.006016465074677006",
|
|
1511
|
+
// balanceAmountChange: "-4.4022",
|
|
1512
|
+
// frozenAmount: "4.4022",
|
|
1513
|
+
// frozenAmountChange: "4.4022",
|
|
1514
|
+
// type: "ENTRUST_PLACE",
|
|
1515
|
+
// time: "1758134605364",
|
|
1516
|
+
// }
|
|
1513
1517
|
// }
|
|
1514
1518
|
//
|
|
1515
1519
|
//
|
|
@@ -1527,27 +1531,23 @@ export default class mexc extends mexcRest {
|
|
|
1527
1531
|
// "ts": 1680059188190
|
|
1528
1532
|
// }
|
|
1529
1533
|
//
|
|
1530
|
-
const
|
|
1531
|
-
const type = (
|
|
1534
|
+
const channel = this.safeString(message, 'channel');
|
|
1535
|
+
const type = (channel === 'spot@private.account.v3.api.pb') ? 'spot' : 'swap';
|
|
1532
1536
|
const messageHash = 'balance:' + type;
|
|
1533
|
-
const data = this.safeDictN(message, ['
|
|
1534
|
-
const futuresTimestamp = this.
|
|
1535
|
-
const timestamp = this.safeInteger2(data, '
|
|
1537
|
+
const data = this.safeDictN(message, ['data', 'privateAccount']);
|
|
1538
|
+
const futuresTimestamp = this.safeInteger2(message, 'ts', 'createTime');
|
|
1539
|
+
const timestamp = this.safeInteger2(data, 'time', futuresTimestamp);
|
|
1536
1540
|
if (!(type in this.balance)) {
|
|
1537
1541
|
this.balance[type] = {};
|
|
1538
1542
|
}
|
|
1539
1543
|
this.balance[type]['info'] = data;
|
|
1540
1544
|
this.balance[type]['timestamp'] = timestamp;
|
|
1541
1545
|
this.balance[type]['datetime'] = this.iso8601(timestamp);
|
|
1542
|
-
const currencyId = this.safeStringN(data, ['
|
|
1546
|
+
const currencyId = this.safeStringN(data, ['currency', 'vcoinName']);
|
|
1543
1547
|
const code = this.safeCurrencyCode(currencyId);
|
|
1544
1548
|
const account = this.account();
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
account['free'] = balanceAmount;
|
|
1548
|
-
}
|
|
1549
|
-
account['total'] = this.safeStringN(data, ['f', 'availableBalance']);
|
|
1550
|
-
account['used'] = this.safeStringN(data, ['l', 'frozenBalance', 'frozenAmount']);
|
|
1549
|
+
account['free'] = this.safeString2(data, 'balanceAmount', 'availableBalance');
|
|
1550
|
+
account['used'] = this.safeStringN(data, ['frozenBalance', 'frozenAmount']);
|
|
1551
1551
|
this.balance[type][code] = account;
|
|
1552
1552
|
this.balance[type] = this.safeBalance(this.balance[type]);
|
|
1553
1553
|
client.resolve(this.balance[type], messageHash);
|
package/js/src/pro/okx.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ export default class okx extends okxRest {
|
|
|
9
9
|
/**
|
|
10
10
|
* @method
|
|
11
11
|
* @name okx#watchTrades
|
|
12
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-ws-trades-channel
|
|
13
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-ws-all-trades-channel
|
|
12
14
|
* @description get the list of most recent trades for a particular symbol
|
|
13
15
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
14
16
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
@@ -20,11 +22,14 @@ export default class okx extends okxRest {
|
|
|
20
22
|
/**
|
|
21
23
|
* @method
|
|
22
24
|
* @name okx#watchTradesForSymbols
|
|
25
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-ws-trades-channel
|
|
26
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-ws-all-trades-channel
|
|
23
27
|
* @description get the list of most recent trades for a particular symbol
|
|
24
28
|
* @param {string} symbols
|
|
25
29
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
26
30
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
27
31
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
32
|
+
* @param {string} [params.channel] the channel to subscribe to, trades by default. Can be 'trades' and 'trades-all'
|
|
28
33
|
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
29
34
|
*/
|
|
30
35
|
watchTradesForSymbols(symbols: string[], since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
@@ -34,6 +39,7 @@ export default class okx extends okxRest {
|
|
|
34
39
|
* @description unWatches from the stream channel
|
|
35
40
|
* @param {string[]} symbols
|
|
36
41
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
42
|
+
* @param {string} [params.channel] the channel to subscribe to, trades by default. Can be trades, trades-all
|
|
37
43
|
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
38
44
|
*/
|
|
39
45
|
unWatchTradesForSymbols(symbols: string[], params?: {}): Promise<any>;
|
|
@@ -400,7 +406,7 @@ export default class okx extends okxRest {
|
|
|
400
406
|
handlePong(client: Client, message: any): any;
|
|
401
407
|
handleErrorMessage(client: Client, message: any): Bool;
|
|
402
408
|
handleMessage(client: Client, message: any): void;
|
|
403
|
-
handleUnSubscriptionTrades(client: Client, symbol: string): void;
|
|
409
|
+
handleUnSubscriptionTrades(client: Client, symbol: string, channel: string): void;
|
|
404
410
|
handleUnsubscriptionOrderBook(client: Client, symbol: string, channel: string): void;
|
|
405
411
|
handleUnsubscriptionOHLCV(client: Client, symbol: string, channel: string): void;
|
|
406
412
|
handleUnsubscriptionTicker(client: Client, symbol: string, channel: any): void;
|
package/js/src/pro/okx.js
CHANGED
|
@@ -164,6 +164,8 @@ export default class okx extends okxRest {
|
|
|
164
164
|
/**
|
|
165
165
|
* @method
|
|
166
166
|
* @name okx#watchTrades
|
|
167
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-ws-trades-channel
|
|
168
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-ws-all-trades-channel
|
|
167
169
|
* @description get the list of most recent trades for a particular symbol
|
|
168
170
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
169
171
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
@@ -177,11 +179,14 @@ export default class okx extends okxRest {
|
|
|
177
179
|
/**
|
|
178
180
|
* @method
|
|
179
181
|
* @name okx#watchTradesForSymbols
|
|
182
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-ws-trades-channel
|
|
183
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-ws-all-trades-channel
|
|
180
184
|
* @description get the list of most recent trades for a particular symbol
|
|
181
185
|
* @param {string} symbols
|
|
182
186
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
183
187
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
184
188
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
189
|
+
* @param {string} [params.channel] the channel to subscribe to, trades by default. Can be 'trades' and 'trades-all'
|
|
185
190
|
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
186
191
|
*/
|
|
187
192
|
async watchTradesForSymbols(symbols, since = undefined, limit = undefined, params = {}) {
|
|
@@ -191,7 +196,8 @@ export default class okx extends okxRest {
|
|
|
191
196
|
}
|
|
192
197
|
await this.loadMarkets();
|
|
193
198
|
symbols = this.marketSymbols(symbols);
|
|
194
|
-
|
|
199
|
+
let channel = undefined;
|
|
200
|
+
[channel, params] = this.handleOptionAndParams(params, 'watchTrades', 'channel', 'trades');
|
|
195
201
|
const topics = [];
|
|
196
202
|
const messageHashes = [];
|
|
197
203
|
for (let i = 0; i < symbols.length; i++) {
|
|
@@ -208,7 +214,12 @@ export default class okx extends okxRest {
|
|
|
208
214
|
'op': 'subscribe',
|
|
209
215
|
'args': topics,
|
|
210
216
|
};
|
|
211
|
-
|
|
217
|
+
let access = 'public';
|
|
218
|
+
if (channel === 'trades-all') {
|
|
219
|
+
access = 'business';
|
|
220
|
+
await this.authenticate({ 'access': access });
|
|
221
|
+
}
|
|
222
|
+
const url = this.getUrl(channel, access);
|
|
212
223
|
const trades = await this.watchMultiple(url, messageHashes, request, messageHashes);
|
|
213
224
|
if (this.newUpdates) {
|
|
214
225
|
const first = this.safeValue(trades, 0);
|
|
@@ -223,17 +234,19 @@ export default class okx extends okxRest {
|
|
|
223
234
|
* @description unWatches from the stream channel
|
|
224
235
|
* @param {string[]} symbols
|
|
225
236
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
237
|
+
* @param {string} [params.channel] the channel to subscribe to, trades by default. Can be trades, trades-all
|
|
226
238
|
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
227
239
|
*/
|
|
228
240
|
async unWatchTradesForSymbols(symbols, params = {}) {
|
|
229
241
|
await this.loadMarkets();
|
|
230
242
|
symbols = this.marketSymbols(symbols, undefined, false);
|
|
231
|
-
|
|
243
|
+
let channel = undefined;
|
|
244
|
+
[channel, params] = this.handleOptionAndParams(params, 'watchTrades', 'channel', 'trades');
|
|
232
245
|
const topics = [];
|
|
233
246
|
const messageHashes = [];
|
|
234
247
|
for (let i = 0; i < symbols.length; i++) {
|
|
235
248
|
const symbol = symbols[i];
|
|
236
|
-
messageHashes.push('unsubscribe:
|
|
249
|
+
messageHashes.push('unsubscribe:' + channel + symbol);
|
|
237
250
|
const marketId = this.marketId(symbol);
|
|
238
251
|
const topic = {
|
|
239
252
|
'channel': channel,
|
|
@@ -245,7 +258,12 @@ export default class okx extends okxRest {
|
|
|
245
258
|
'op': 'unsubscribe',
|
|
246
259
|
'args': topics,
|
|
247
260
|
};
|
|
248
|
-
|
|
261
|
+
let access = 'public';
|
|
262
|
+
if (channel === 'trades-all') {
|
|
263
|
+
access = 'business';
|
|
264
|
+
await this.authenticate({ 'access': access });
|
|
265
|
+
}
|
|
266
|
+
const url = this.getUrl(channel, access);
|
|
249
267
|
return await this.watchMultiple(url, messageHashes, request, messageHashes);
|
|
250
268
|
}
|
|
251
269
|
/**
|
|
@@ -274,6 +292,23 @@ export default class okx extends okxRest {
|
|
|
274
292
|
// }
|
|
275
293
|
// ]
|
|
276
294
|
// }
|
|
295
|
+
// {
|
|
296
|
+
// "arg": {
|
|
297
|
+
// "channel": "trades-all",
|
|
298
|
+
// "instId": "BTC-USDT"
|
|
299
|
+
// },
|
|
300
|
+
// "data": [
|
|
301
|
+
// {
|
|
302
|
+
// "instId": "BTC-USDT",
|
|
303
|
+
// "tradeId": "130639474",
|
|
304
|
+
// "px": "42219.9",
|
|
305
|
+
// "sz": "0.12060306",
|
|
306
|
+
// "side": "buy",
|
|
307
|
+
// "source": "0",
|
|
308
|
+
// "ts": "1630048897897"
|
|
309
|
+
// }
|
|
310
|
+
// ]
|
|
311
|
+
// }
|
|
277
312
|
//
|
|
278
313
|
const arg = this.safeValue(message, 'arg', {});
|
|
279
314
|
const channel = this.safeString(arg, 'channel');
|
|
@@ -2389,6 +2424,7 @@ export default class okx extends okxRest {
|
|
|
2389
2424
|
'sprd-tickers': this.handleTicker,
|
|
2390
2425
|
'block-tickers': this.handleTicker,
|
|
2391
2426
|
'trades': this.handleTrades,
|
|
2427
|
+
'trades-all': this.handleTrades,
|
|
2392
2428
|
'account': this.handleBalance,
|
|
2393
2429
|
'funding-rate': this.handleFundingRate,
|
|
2394
2430
|
// 'margin_account': this.handleBalance,
|
|
@@ -2408,9 +2444,9 @@ export default class okx extends okxRest {
|
|
|
2408
2444
|
}
|
|
2409
2445
|
}
|
|
2410
2446
|
}
|
|
2411
|
-
handleUnSubscriptionTrades(client, symbol) {
|
|
2412
|
-
const subMessageHash = '
|
|
2413
|
-
const messageHash = 'unsubscribe:
|
|
2447
|
+
handleUnSubscriptionTrades(client, symbol, channel) {
|
|
2448
|
+
const subMessageHash = channel + ':' + symbol;
|
|
2449
|
+
const messageHash = 'unsubscribe:' + subMessageHash;
|
|
2414
2450
|
this.cleanUnsubscription(client, subMessageHash, messageHash);
|
|
2415
2451
|
if (symbol in this.trades) {
|
|
2416
2452
|
delete this.trades[symbol];
|
|
@@ -2457,8 +2493,8 @@ export default class okx extends okxRest {
|
|
|
2457
2493
|
const channel = this.safeString(arg, 'channel', '');
|
|
2458
2494
|
const marketId = this.safeString(arg, 'instId');
|
|
2459
2495
|
const symbol = this.safeSymbol(marketId);
|
|
2460
|
-
if (channel === 'trades') {
|
|
2461
|
-
this.handleUnSubscriptionTrades(client, symbol);
|
|
2496
|
+
if (channel === 'trades' || channel === 'trades-all') {
|
|
2497
|
+
this.handleUnSubscriptionTrades(client, symbol, channel);
|
|
2462
2498
|
}
|
|
2463
2499
|
else if (channel.startsWith('bbo') || channel.startsWith('book')) {
|
|
2464
2500
|
this.handleUnsubscriptionOrderBook(client, symbol, channel);
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import toobitRest from '../toobit.js';
|
|
2
|
+
import type { Int, Str, Ticker, OrderBook, Order, Trade, OHLCV, Dict, Market, Strings, Tickers, Balances, Position, Bool } from '../base/types.js';
|
|
3
|
+
import Client from '../base/ws/Client.js';
|
|
4
|
+
export default class toobit extends toobitRest {
|
|
5
|
+
describe(): any;
|
|
6
|
+
ping(client: Client): {
|
|
7
|
+
ping: number;
|
|
8
|
+
};
|
|
9
|
+
handleMessage(client: Client, message: any): void;
|
|
10
|
+
handleIncomingPong(client: Client, pongTimestamp: Int): void;
|
|
11
|
+
/**
|
|
12
|
+
* @method
|
|
13
|
+
* @name toobit#watchTrades
|
|
14
|
+
* @description watches information on multiple trades made in a market
|
|
15
|
+
* @see https://toobit-docs.github.io/apidocs/spot/v1/en/#trade-streams
|
|
16
|
+
* @param {string} symbol unified market symbol of the market trades were made in
|
|
17
|
+
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
18
|
+
* @param {int} [limit] the maximum number of trade structures to retrieve
|
|
19
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
20
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
21
|
+
*/
|
|
22
|
+
watchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
23
|
+
/**
|
|
24
|
+
* @method
|
|
25
|
+
* @name toobit#watchTradesForSymbols
|
|
26
|
+
* @description get the list of most recent trades for a list of symbols
|
|
27
|
+
* @see https://toobit-docs.github.io/apidocs/spot/v1/en/#trade-streams
|
|
28
|
+
* @param {string[]} symbols unified symbol of the market to fetch trades for
|
|
29
|
+
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
30
|
+
* @param {int} [limit] the maximum amount of trades to fetch
|
|
31
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
32
|
+
* @param {string} [params.name] the name of the method to call, 'trade' or 'aggTrade', default is 'trade'
|
|
33
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
34
|
+
*/
|
|
35
|
+
watchTradesForSymbols(symbols: string[], since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
36
|
+
handleTrades(client: Client, message: any): void;
|
|
37
|
+
parseWsTrade(trade: Dict, market?: Market): Trade;
|
|
38
|
+
/**
|
|
39
|
+
* @method
|
|
40
|
+
* @name toobit#watchOHLCV
|
|
41
|
+
* @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
42
|
+
* @see https://toobit-docs.github.io/apidocs/spot/v1/en/#kline-candlestick-streams
|
|
43
|
+
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
44
|
+
* @param {string} timeframe the length of time each candle represents
|
|
45
|
+
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
46
|
+
* @param {int} [limit] the maximum amount of candles to fetch
|
|
47
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
48
|
+
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
49
|
+
*/
|
|
50
|
+
watchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
|
|
51
|
+
/**
|
|
52
|
+
* @method
|
|
53
|
+
* @name toobit#watchOHLCVForSymbols
|
|
54
|
+
* @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
55
|
+
* @see https://toobit-docs.github.io/apidocs/spot/v1/en/#kline-candlestick-streams
|
|
56
|
+
* @param {string[][]} symbolsAndTimeframes array of arrays containing unified symbols and timeframes to fetch OHLCV data for, example [['BTC/USDT', '1m'], ['LTC/USDT', '5m']]
|
|
57
|
+
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
58
|
+
* @param {int} [limit] the maximum amount of candles to fetch
|
|
59
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
60
|
+
* @returns {object} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
61
|
+
*/
|
|
62
|
+
watchOHLCVForSymbols(symbolsAndTimeframes: string[][], since?: Int, limit?: Int, params?: {}): Promise<import("../base/types.js").Dictionary<import("../base/types.js").Dictionary<OHLCV[]>>>;
|
|
63
|
+
handleOHLCV(client: Client, message: any): void;
|
|
64
|
+
parseWsOHLCV(ohlcv: any, market?: any): OHLCV;
|
|
65
|
+
/**
|
|
66
|
+
* @method
|
|
67
|
+
* @name toobit#watchTicker
|
|
68
|
+
* @see https://toobit-docs.github.io/apidocs/spot/v1/en/#individual-symbol-ticker-streams
|
|
69
|
+
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
70
|
+
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
71
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
72
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
73
|
+
*/
|
|
74
|
+
watchTicker(symbol: string, params?: {}): Promise<Ticker>;
|
|
75
|
+
/**
|
|
76
|
+
* @method
|
|
77
|
+
* @name toobit#watchTickers
|
|
78
|
+
* @see https://toobit-docs.github.io/apidocs/spot/v1/en/#individual-symbol-ticker-streams
|
|
79
|
+
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
|
|
80
|
+
* @param {string[]} symbols unified symbol of the market to fetch the ticker for
|
|
81
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
82
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
83
|
+
*/
|
|
84
|
+
watchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
|
|
85
|
+
handleTickers(client: Client, message: any): void;
|
|
86
|
+
parseWsTicker(ticker: any, market?: any): Ticker;
|
|
87
|
+
/**
|
|
88
|
+
* @method
|
|
89
|
+
* @name toobit#watchOrderBook
|
|
90
|
+
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
91
|
+
* @see https://toobit-docs.github.io/apidocs/spot/v1/en/#partial-book-depth-streams
|
|
92
|
+
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
93
|
+
* @param {int} [limit] the maximum amount of order book entries to return.
|
|
94
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
95
|
+
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
96
|
+
*/
|
|
97
|
+
watchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
|
|
98
|
+
/**
|
|
99
|
+
* @method
|
|
100
|
+
* @name toobit#watchOrderBookForSymbols
|
|
101
|
+
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
102
|
+
* @see https://toobit-docs.github.io/apidocs/spot/v1/en/#partial-book-depth-streams
|
|
103
|
+
* @param {string[]} symbols unified array of symbols
|
|
104
|
+
* @param {int} [limit] the maximum amount of order book entries to return.
|
|
105
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
106
|
+
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
107
|
+
*/
|
|
108
|
+
watchOrderBookForSymbols(symbols: string[], limit?: Int, params?: {}): Promise<OrderBook>;
|
|
109
|
+
handleOrderBook(client: Client, message: any): void;
|
|
110
|
+
handleDelta(bookside: any, delta: any): void;
|
|
111
|
+
handleOrderBookPartialSnapshot(client: Client, message: any): void;
|
|
112
|
+
setOrderBookSnapshot(client: Client, message: any, channel: string): void;
|
|
113
|
+
/**
|
|
114
|
+
* @method
|
|
115
|
+
* @name toobit#watchBalance
|
|
116
|
+
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
117
|
+
* @see https://toobit-docs.github.io/apidocs/spot/v1/en/#payload-account-update
|
|
118
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
119
|
+
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
120
|
+
*/
|
|
121
|
+
watchBalance(params?: {}): Promise<Balances>;
|
|
122
|
+
setBalanceCache(client: Client, marketType: any, subscriptionHash?: Str, params?: {}): void;
|
|
123
|
+
handleBalance(client: Client, message: any): void;
|
|
124
|
+
loadBalanceSnapshot(client: any, messageHash: any, marketType: any): Promise<void>;
|
|
125
|
+
/**
|
|
126
|
+
* @method
|
|
127
|
+
* @name toobit#watchOrders
|
|
128
|
+
* @description watches information on multiple orders made by the user
|
|
129
|
+
* @see https://toobit-docs.github.io/apidocs/spot/v1/en/#payload-order-update
|
|
130
|
+
* @param {string} symbol unified market symbol of the market orders were made in
|
|
131
|
+
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
132
|
+
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
133
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
134
|
+
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
135
|
+
*/
|
|
136
|
+
watchOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
137
|
+
handleOrder(client: Client, message: any): void;
|
|
138
|
+
parseWsOrder(order: any, market?: any): Order;
|
|
139
|
+
/**
|
|
140
|
+
* @method
|
|
141
|
+
* @name toobit#watchMyTrades
|
|
142
|
+
* @description watches information on multiple trades made by the user
|
|
143
|
+
* @see https://toobit-docs.github.io/apidocs/spot/v1/en/#payload-ticket-push
|
|
144
|
+
* @param {string} symbol unified market symbol of the market trades were made in
|
|
145
|
+
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
146
|
+
* @param {int} [limit] the maximum number of trade structures to retrieve
|
|
147
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
148
|
+
* @param {boolean} [params.unifiedMargin] use unified margin account
|
|
149
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
150
|
+
*/
|
|
151
|
+
watchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
152
|
+
handleMyTrade(client: Client, message: any): void;
|
|
153
|
+
parseMyTrade(trade: any, market?: any): Trade;
|
|
154
|
+
/**
|
|
155
|
+
* @method
|
|
156
|
+
* @name toobit#watchPositions
|
|
157
|
+
* @see https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#event-position-update
|
|
158
|
+
* @description watch all open positions
|
|
159
|
+
* @param {string[]} [symbols] list of unified market symbols
|
|
160
|
+
* @param {int} [since] the earliest time in ms to fetch positions for
|
|
161
|
+
* @param {int} [limit] the maximum number of positions to retrieve
|
|
162
|
+
* @param {object} params extra parameters specific to the exchange API endpoint
|
|
163
|
+
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/en/latest/manual.html#position-structure}
|
|
164
|
+
*/
|
|
165
|
+
watchPositions(symbols?: Strings, since?: Int, limit?: Int, params?: {}): Promise<Position[]>;
|
|
166
|
+
setPositionsCache(client: Client, type: any, symbols?: Strings, isPortfolioMargin?: boolean): void;
|
|
167
|
+
loadPositionsSnapshot(client: any, messageHash: any, type: any): Promise<void>;
|
|
168
|
+
handlePositions(client: any, message: any): void;
|
|
169
|
+
parseWsPosition(position: any, market?: any): Position;
|
|
170
|
+
authenticate(params?: {}): Promise<any>;
|
|
171
|
+
keepAliveListenKey(params?: {}): Promise<void>;
|
|
172
|
+
getUserStreamUrl(): string;
|
|
173
|
+
handleErrorMessage(client: Client, message: any): Bool;
|
|
174
|
+
}
|