ccxt 4.2.44 → 4.2.46

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.
Files changed (92) hide show
  1. package/CHANGELOG.md +3099 -8415
  2. package/README.md +4 -4
  3. package/change.sh +4 -2
  4. package/dist/ccxt.browser.js +1242 -195
  5. package/dist/ccxt.browser.min.js +7 -7
  6. package/dist/cjs/ccxt.js +1 -1
  7. package/dist/cjs/src/base/Exchange.js +48 -0
  8. package/dist/cjs/src/base/ws/Cache.js +13 -5
  9. package/dist/cjs/src/base/ws/OrderBook.js +2 -2
  10. package/dist/cjs/src/binance.js +407 -21
  11. package/dist/cjs/src/bingx.js +43 -5
  12. package/dist/cjs/src/bitfinex2.js +1 -0
  13. package/dist/cjs/src/bithumb.js +5 -0
  14. package/dist/cjs/src/bitstamp.js +1 -1
  15. package/dist/cjs/src/btcturk.js +11 -0
  16. package/dist/cjs/src/bybit.js +96 -43
  17. package/dist/cjs/src/coinbase.js +228 -38
  18. package/dist/cjs/src/coincheck.js +11 -0
  19. package/dist/cjs/src/coinmate.js +114 -1
  20. package/dist/cjs/src/coinspot.js +7 -0
  21. package/dist/cjs/src/cryptocom.js +2 -2
  22. package/dist/cjs/src/deribit.js +1 -1
  23. package/dist/cjs/src/hitbtc.js +2 -0
  24. package/dist/cjs/src/idex.js +60 -1
  25. package/dist/cjs/src/latoken.js +3 -0
  26. package/dist/cjs/src/mercado.js +3 -0
  27. package/dist/cjs/src/oceanex.js +3 -0
  28. package/dist/cjs/src/okx.js +1 -0
  29. package/dist/cjs/src/pro/bitget.js +12 -8
  30. package/dist/cjs/src/pro/bitmart.js +11 -11
  31. package/dist/cjs/src/pro/bitmex.js +4 -4
  32. package/dist/cjs/src/pro/cex.js +2 -2
  33. package/dist/cjs/src/pro/gate.js +76 -42
  34. package/dist/cjs/src/pro/gemini.js +4 -3
  35. package/dist/cjs/src/pro/hitbtc.js +1 -0
  36. package/dist/cjs/src/probit.js +3 -3
  37. package/dist/cjs/src/timex.js +65 -0
  38. package/js/ccxt.d.ts +1 -1
  39. package/js/ccxt.js +1 -1
  40. package/js/src/abstract/bequant.d.ts +2 -0
  41. package/js/src/abstract/bitcoincom.d.ts +2 -0
  42. package/js/src/abstract/bithumb.d.ts +5 -0
  43. package/js/src/abstract/coinbase.d.ts +1 -0
  44. package/js/src/abstract/coinmate.d.ts +12 -0
  45. package/js/src/abstract/fmfwio.d.ts +2 -0
  46. package/js/src/abstract/hitbtc.d.ts +2 -0
  47. package/js/src/abstract/hitbtc3.d.ts +2 -0
  48. package/js/src/abstract/okx.d.ts +1 -0
  49. package/js/src/base/Exchange.d.ts +12 -6
  50. package/js/src/base/Exchange.js +48 -0
  51. package/js/src/base/ws/Cache.d.ts +5 -1
  52. package/js/src/base/ws/Cache.js +13 -5
  53. package/js/src/base/ws/OrderBook.d.ts +5 -1
  54. package/js/src/base/ws/OrderBook.js +3 -3
  55. package/js/src/binance.d.ts +2 -1
  56. package/js/src/binance.js +407 -21
  57. package/js/src/bingx.d.ts +2 -1
  58. package/js/src/bingx.js +43 -5
  59. package/js/src/bitfinex2.js +1 -0
  60. package/js/src/bithumb.js +5 -0
  61. package/js/src/bitstamp.js +1 -1
  62. package/js/src/btcturk.js +11 -0
  63. package/js/src/bybit.d.ts +4 -1
  64. package/js/src/bybit.js +96 -43
  65. package/js/src/coinbase.d.ts +10 -4
  66. package/js/src/coinbase.js +228 -38
  67. package/js/src/coincheck.js +11 -0
  68. package/js/src/coinmate.d.ts +3 -1
  69. package/js/src/coinmate.js +114 -1
  70. package/js/src/coinspot.js +7 -0
  71. package/js/src/cryptocom.js +2 -2
  72. package/js/src/deribit.js +1 -1
  73. package/js/src/hitbtc.js +2 -0
  74. package/js/src/idex.d.ts +14 -0
  75. package/js/src/idex.js +60 -1
  76. package/js/src/latoken.js +3 -0
  77. package/js/src/mercado.js +3 -0
  78. package/js/src/oceanex.js +3 -0
  79. package/js/src/okx.js +1 -0
  80. package/js/src/pro/bitget.js +12 -8
  81. package/js/src/pro/bitmart.js +11 -11
  82. package/js/src/pro/bitmex.js +4 -4
  83. package/js/src/pro/cex.js +2 -2
  84. package/js/src/pro/gate.d.ts +4 -0
  85. package/js/src/pro/gate.js +76 -42
  86. package/js/src/pro/gemini.js +4 -3
  87. package/js/src/pro/hitbtc.js +1 -0
  88. package/js/src/probit.js +3 -3
  89. package/js/src/timex.d.ts +14 -0
  90. package/js/src/timex.js +65 -0
  91. package/package.json +1 -1
  92. package/skip-tests.json +4 -0
@@ -65,6 +65,7 @@ export default class coinmate extends Exchange {
65
65
  'fetchPositionsRisk': false,
66
66
  'fetchPremiumIndexOHLCV': false,
67
67
  'fetchTicker': true,
68
+ 'fetchTickers': true,
68
69
  'fetchTrades': true,
69
70
  'fetchTradingFee': true,
70
71
  'fetchTradingFees': false,
@@ -99,6 +100,8 @@ export default class coinmate extends Exchange {
99
100
  'get': [
100
101
  'orderBook',
101
102
  'ticker',
103
+ 'tickerAll',
104
+ 'products',
102
105
  'transactions',
103
106
  'tradingPairs',
104
107
  ],
@@ -147,6 +150,16 @@ export default class coinmate extends Exchange {
147
150
  'unconfirmedEthereumDeposits',
148
151
  'unconfirmedLitecoinDeposits',
149
152
  'unconfirmedRippleDeposits',
153
+ 'cancelAllOpenOrders',
154
+ 'withdrawVirtualCurrency',
155
+ 'virtualCurrencyDepositAddresses',
156
+ 'unconfirmedVirtualCurrencyDeposits',
157
+ 'adaWithdrawal',
158
+ 'adaDepositAddresses',
159
+ 'unconfirmedAdaDeposits',
160
+ 'solWithdrawal',
161
+ 'solDepositAddresses',
162
+ 'unconfirmedSolDeposits',
150
163
  ],
151
164
  },
152
165
  },
@@ -191,6 +204,8 @@ export default class coinmate extends Exchange {
191
204
  'XRP': 'privatePostRippleWithdrawal',
192
205
  'DASH': 'privatePostDashWithdrawal',
193
206
  'DAI': 'privatePostDaiWithdrawal',
207
+ 'ADA': 'privatePostAdaWithdrawal',
208
+ 'SOL': 'privatePostSolWithdrawal',
194
209
  },
195
210
  },
196
211
  },
@@ -215,6 +230,7 @@ export default class coinmate extends Exchange {
215
230
  * @method
216
231
  * @name coinmate#fetchMarkets
217
232
  * @description retrieves data on all markets for coinmate
233
+ * @see https://coinmate.docs.apiary.io/#reference/trading-pairs/get-trading-pairs/get
218
234
  * @param {object} [params] extra parameters specific to the exchange API endpoint
219
235
  * @returns {object[]} an array of objects representing market data
220
236
  */
@@ -321,6 +337,7 @@ export default class coinmate extends Exchange {
321
337
  * @method
322
338
  * @name coinmate#fetchBalance
323
339
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
340
+ * @see https://coinmate.docs.apiary.io/#reference/balance/get-balances/post
324
341
  * @param {object} [params] extra parameters specific to the exchange API endpoint
325
342
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
326
343
  */
@@ -333,6 +350,7 @@ export default class coinmate extends Exchange {
333
350
  * @method
334
351
  * @name coinmate#fetchOrderBook
335
352
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
353
+ * @see https://coinmate.docs.apiary.io/#reference/order-book/get-order-book/get
336
354
  * @param {string} symbol unified symbol of the market to fetch the order book for
337
355
  * @param {int} [limit] the maximum amount of order book entries to return
338
356
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -354,6 +372,7 @@ export default class coinmate extends Exchange {
354
372
  * @method
355
373
  * @name coinmate#fetchTicker
356
374
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
375
+ * @see https://coinmate.docs.apiary.io/#reference/ticker/get-ticker/get
357
376
  * @param {string} symbol unified symbol of the market to fetch the ticker for
358
377
  * @param {object} [params] extra parameters specific to the exchange API endpoint
359
378
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -364,7 +383,82 @@ export default class coinmate extends Exchange {
364
383
  'currencyPair': market['id'],
365
384
  };
366
385
  const response = await this.publicGetTicker(this.extend(request, params));
367
- const ticker = this.safeValue(response, 'data');
386
+ //
387
+ // {
388
+ // "error": false,
389
+ // "errorMessage": null,
390
+ // "data": {
391
+ // "last": 0.55105,
392
+ // "high": 0.56439,
393
+ // "low": 0.54358,
394
+ // "amount": 37038.993381,
395
+ // "bid": 0.54595,
396
+ // "ask": 0.55324,
397
+ // "change": 3.03659243,
398
+ // "open": 0.53481,
399
+ // "timestamp": 1708074779
400
+ // }
401
+ // }
402
+ //
403
+ const data = this.safeValue(response, 'data');
404
+ return this.parseTicker(data, market);
405
+ }
406
+ async fetchTickers(symbols = undefined, params = {}) {
407
+ /**
408
+ * @method
409
+ * @name coinmate#fetchTickers
410
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
411
+ * @see https://coinmate.docs.apiary.io/#reference/ticker/get-ticker-all/get
412
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
413
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
414
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
415
+ */
416
+ await this.loadMarkets();
417
+ symbols = this.marketSymbols(symbols);
418
+ const response = await this.publicGetTickerAll(params);
419
+ //
420
+ // {
421
+ // "error": false,
422
+ // "errorMessage": null,
423
+ // "data": {
424
+ // "LTC_BTC": {
425
+ // "last": "0.001337",
426
+ // "high": "0.001348",
427
+ // "low": "0.001332",
428
+ // "amount": "34.75472959",
429
+ // "bid": "0.001348",
430
+ // "ask": "0.001356",
431
+ // "change": "-0.74239050",
432
+ // "open": "0.001347",
433
+ // "timestamp": "1708074485"
434
+ // }
435
+ // }
436
+ // }
437
+ //
438
+ const data = this.safeValue(response, 'data', {});
439
+ const keys = Object.keys(data);
440
+ const result = {};
441
+ for (let i = 0; i < keys.length; i++) {
442
+ const market = this.market(keys[i]);
443
+ const ticker = this.parseTicker(this.safeValue(data, keys[i]), market);
444
+ result[market['symbol']] = ticker;
445
+ }
446
+ return this.filterByArrayTickers(result, 'symbol', symbols);
447
+ }
448
+ parseTicker(ticker, market = undefined) {
449
+ //
450
+ // {
451
+ // "last": "0.001337",
452
+ // "high": "0.001348",
453
+ // "low": "0.001332",
454
+ // "amount": "34.75472959",
455
+ // "bid": "0.001348",
456
+ // "ask": "0.001356",
457
+ // "change": "-0.74239050",
458
+ // "open": "0.001347",
459
+ // "timestamp": "1708074485"
460
+ // }
461
+ //
368
462
  const timestamp = this.safeTimestamp(ticker, 'timestamp');
369
463
  const last = this.safeNumber(ticker, 'last');
370
464
  return this.safeTicker({
@@ -395,6 +489,7 @@ export default class coinmate extends Exchange {
395
489
  * @method
396
490
  * @name coinmate#fetchDepositsWithdrawals
397
491
  * @description fetch history of deposits and withdrawals
492
+ * @see https://coinmate.docs.apiary.io/#reference/transfers/get-transfer-history/post
398
493
  * @param {string} [code] unified currency code for the currency of the deposit/withdrawals, default is undefined
399
494
  * @param {int} [since] timestamp in ms of the earliest deposit/withdrawal, default is undefined
400
495
  * @param {int} [limit] max number of deposit/withdrawals to return, default is undefined
@@ -507,6 +602,12 @@ export default class coinmate extends Exchange {
507
602
  * @method
508
603
  * @name coinmate#withdraw
509
604
  * @description make a withdrawal
605
+ * @see https://coinmate.docs.apiary.io/#reference/bitcoin-withdrawal-and-deposit/withdraw-bitcoins/post
606
+ * @see https://coinmate.docs.apiary.io/#reference/litecoin-withdrawal-and-deposit/withdraw-litecoins/post
607
+ * @see https://coinmate.docs.apiary.io/#reference/ethereum-withdrawal-and-deposit/withdraw-ethereum/post
608
+ * @see https://coinmate.docs.apiary.io/#reference/ripple-withdrawal-and-deposit/withdraw-ripple/post
609
+ * @see https://coinmate.docs.apiary.io/#reference/cardano-withdrawal-and-deposit/withdraw-cardano/post
610
+ * @see https://coinmate.docs.apiary.io/#reference/solana-withdrawal-and-deposit/withdraw-solana/post
510
611
  * @param {string} code unified currency code
511
612
  * @param {float} amount the amount to withdraw
512
613
  * @param {string} address the address to withdraw to
@@ -560,6 +661,7 @@ export default class coinmate extends Exchange {
560
661
  * @method
561
662
  * @name coinmate#fetchMyTrades
562
663
  * @description fetch all trades made by the user
664
+ * @see https://coinmate.docs.apiary.io/#reference/trade-history/get-trade-history/post
563
665
  * @param {string} symbol unified market symbol
564
666
  * @param {int} [since] the earliest time in ms to fetch trades for
565
667
  * @param {int} [limit] the maximum number of trades structures to retrieve
@@ -652,6 +754,7 @@ export default class coinmate extends Exchange {
652
754
  * @method
653
755
  * @name coinmate#fetchTrades
654
756
  * @description get the list of most recent trades for a particular symbol
757
+ * @see https://coinmate.docs.apiary.io/#reference/transactions/transactions/get
655
758
  * @param {string} symbol unified symbol of the market to fetch trades for
656
759
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
657
760
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -689,6 +792,7 @@ export default class coinmate extends Exchange {
689
792
  * @method
690
793
  * @name coinmate#fetchTradingFee
691
794
  * @description fetch the trading fees for a market
795
+ * @see https://coinmate.docs.apiary.io/#reference/trader-fees/get-trading-fees/post
692
796
  * @param {string} symbol unified market symbol
693
797
  * @param {object} [params] extra parameters specific to the exchange API endpoint
694
798
  * @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
@@ -725,6 +829,7 @@ export default class coinmate extends Exchange {
725
829
  * @method
726
830
  * @name coinmate#fetchOpenOrders
727
831
  * @description fetch all unfilled currently open orders
832
+ * @see https://coinmate.docs.apiary.io/#reference/order/get-open-orders/post
728
833
  * @param {string} symbol unified market symbol
729
834
  * @param {int} [since] the earliest time in ms to fetch open orders for
730
835
  * @param {int} [limit] the maximum number of open orders structures to retrieve
@@ -740,6 +845,7 @@ export default class coinmate extends Exchange {
740
845
  * @method
741
846
  * @name coinmate#fetchOrders
742
847
  * @description fetches information on multiple orders made by the user
848
+ * @see https://coinmate.docs.apiary.io/#reference/order/order-history/post
743
849
  * @param {string} symbol unified market symbol of the market orders were made in
744
850
  * @param {int} [since] the earliest time in ms to fetch orders for
745
851
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -863,6 +969,10 @@ export default class coinmate extends Exchange {
863
969
  * @method
864
970
  * @name coinmate#createOrder
865
971
  * @description create a trade order
972
+ * @see https://coinmate.docs.apiary.io/#reference/order/buy-limit-order/post
973
+ * @see https://coinmate.docs.apiary.io/#reference/order/sell-limit-order/post
974
+ * @see https://coinmate.docs.apiary.io/#reference/order/buy-instant-order/post
975
+ * @see https://coinmate.docs.apiary.io/#reference/order/sell-instant-order/post
866
976
  * @param {string} symbol unified symbol of the market to create an order in
867
977
  * @param {string} type 'market' or 'limit'
868
978
  * @param {string} side 'buy' or 'sell'
@@ -903,6 +1013,8 @@ export default class coinmate extends Exchange {
903
1013
  * @method
904
1014
  * @name coinmate#fetchOrder
905
1015
  * @description fetches information on an order made by the user
1016
+ * @see https://coinmate.docs.apiary.io/#reference/order/get-order-by-orderid/post
1017
+ * @see https://coinmate.docs.apiary.io/#reference/order/get-order-by-clientorderid/post
906
1018
  * @param {string} symbol unified symbol of the market the order was made in
907
1019
  * @param {object} [params] extra parameters specific to the exchange API endpoint
908
1020
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -924,6 +1036,7 @@ export default class coinmate extends Exchange {
924
1036
  * @method
925
1037
  * @name coinmate#cancelOrder
926
1038
  * @description cancels an open order
1039
+ * @see https://coinmate.docs.apiary.io/#reference/order/cancel-order/post
927
1040
  * @param {string} id order id
928
1041
  * @param {string} symbol not used by coinmate cancelOrder ()
929
1042
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -178,6 +178,7 @@ export default class coinspot extends Exchange {
178
178
  * @method
179
179
  * @name coinspot#fetchBalance
180
180
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
181
+ * @see https://www.coinspot.com.au/api#listmybalance
181
182
  * @param {object} [params] extra parameters specific to the exchange API endpoint
182
183
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
183
184
  */
@@ -207,6 +208,7 @@ export default class coinspot extends Exchange {
207
208
  * @method
208
209
  * @name coinspot#fetchOrderBook
209
210
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
211
+ * @see https://www.coinspot.com.au/api#listopenorders
210
212
  * @param {string} symbol unified symbol of the market to fetch the order book for
211
213
  * @param {int} [limit] the maximum amount of order book entries to return
212
214
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -260,6 +262,7 @@ export default class coinspot extends Exchange {
260
262
  * @method
261
263
  * @name coinspot#fetchTicker
262
264
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
265
+ * @see https://www.coinspot.com.au/api#latestprices
263
266
  * @param {string} symbol unified symbol of the market to fetch the ticker for
264
267
  * @param {object} [params] extra parameters specific to the exchange API endpoint
265
268
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -333,6 +336,7 @@ export default class coinspot extends Exchange {
333
336
  * @method
334
337
  * @name coinspot#fetchTrades
335
338
  * @description get the list of most recent trades for a particular symbol
339
+ * @see https://www.coinspot.com.au/api#orderhistory
336
340
  * @param {string} symbol unified symbol of the market to fetch trades for
337
341
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
338
342
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -361,6 +365,7 @@ export default class coinspot extends Exchange {
361
365
  * @method
362
366
  * @name coinspot#fetchMyTrades
363
367
  * @description fetch all trades made by the user
368
+ * @see https://www.coinspot.com.au/api#rotransaction
364
369
  * @param {string} symbol unified market symbol
365
370
  * @param {int} [since] the earliest time in ms to fetch trades for
366
371
  * @param {int} [limit] the maximum number of trades structures to retrieve
@@ -516,6 +521,8 @@ export default class coinspot extends Exchange {
516
521
  * @method
517
522
  * @name coinspot#cancelOrder
518
523
  * @description cancels an open order
524
+ * @see https://www.coinspot.com.au/api#cancelbuyorder
525
+ * @see https://www.coinspot.com.au/api#cancelsellorder
519
526
  * @param {string} id order id
520
527
  * @param {string} symbol not used by coinspot cancelOrder ()
521
528
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -2319,13 +2319,13 @@ export default class cryptocom extends Exchange {
2319
2319
  * @method
2320
2320
  * @name cryptocom#fetchDepositWithdrawFees
2321
2321
  * @description fetch deposit and withdraw fees
2322
- * @see https://exchange-docs.crypto.com/spot/index.html#private-get-currency-networks
2322
+ * @see https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-currency-networks
2323
2323
  * @param {string[]|undefined} codes list of unified currency codes
2324
2324
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2325
2325
  * @returns {object} a list of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
2326
2326
  */
2327
2327
  await this.loadMarkets();
2328
- const response = await this.v2PrivatePostPrivateGetCurrencyNetworks(params);
2328
+ const response = await this.v1PrivatePostPrivateGetCurrencyNetworks(params);
2329
2329
  const data = this.safeValue(response, 'result');
2330
2330
  const currencyMap = this.safeValue(data, 'currency_map');
2331
2331
  return this.parseDepositWithdrawFees(currencyMap, codes, 'full_name');
package/js/src/deribit.js CHANGED
@@ -1784,7 +1784,7 @@ export default class deribit extends Exchange {
1784
1784
  const amount = this.safeString(order, 'amount');
1785
1785
  let cost = Precise.stringMul(filledString, averageString);
1786
1786
  if (market['inverse']) {
1787
- if (this.parseNumber(averageString) !== 0) {
1787
+ if (averageString !== '0') {
1788
1788
  cost = Precise.stringDiv(amount, averageString);
1789
1789
  }
1790
1790
  }
package/js/src/hitbtc.js CHANGED
@@ -141,6 +141,8 @@ export default class hitbtc extends Exchange {
141
141
  'public/orderbook/{symbol}': 10,
142
142
  'public/candles': 10,
143
143
  'public/candles/{symbol}': 10,
144
+ 'public/converted/candles': 10,
145
+ 'public/converted/candles/{symbol}': 10,
144
146
  'public/futures/info': 10,
145
147
  'public/futures/info/{symbol}': 10,
146
148
  'public/futures/history/funding': 10,
package/js/src/idex.d.ts CHANGED
@@ -43,6 +43,20 @@ export default class idex extends Exchange {
43
43
  parseTransactionStatus(status: any): string;
44
44
  parseTransaction(transaction: any, currency?: Currency): Transaction;
45
45
  calculateRateLimiterCost(api: any, method: any, path: any, params: any, config?: {}): any;
46
+ fetchDepositAddress(code?: string, params?: {}): Promise<{
47
+ info: any;
48
+ currency: any;
49
+ address: string;
50
+ tag: any;
51
+ network: string;
52
+ }>;
53
+ parseDepositAddress(depositAddress: any, currency?: Currency): {
54
+ info: any;
55
+ currency: any;
56
+ address: string;
57
+ tag: any;
58
+ network: string;
59
+ };
46
60
  sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
47
61
  url: string;
48
62
  method: string;
package/js/src/idex.js CHANGED
@@ -56,6 +56,9 @@ export default class idex extends Exchange {
56
56
  'fetchCrossBorrowRates': false,
57
57
  'fetchCurrencies': true,
58
58
  'fetchDeposit': true,
59
+ 'fetchDepositAddress': true,
60
+ 'fetchDepositAddresses': false,
61
+ 'fetchDepositAddressesByNetwork': false,
59
62
  'fetchDeposits': true,
60
63
  'fetchFundingHistory': false,
61
64
  'fetchFundingRate': false,
@@ -115,7 +118,7 @@ export default class idex extends Exchange {
115
118
  },
116
119
  'www': 'https://idex.io',
117
120
  'doc': [
118
- 'https://docs.idex.io/',
121
+ 'https://api-docs-v3.idex.io/',
119
122
  ],
120
123
  },
121
124
  'api': {
@@ -1703,6 +1706,62 @@ export default class idex extends Exchange {
1703
1706
  const authenticated = hasApiKey && hasSecret && hasWalletAddress && hasPrivateKey;
1704
1707
  return authenticated ? (defaultCost / 2) : defaultCost;
1705
1708
  }
1709
+ async fetchDepositAddress(code = undefined, params = {}) {
1710
+ /**
1711
+ * @method
1712
+ * @name idex#fetchDepositAddress
1713
+ * @description fetch the Polygon address of the wallet
1714
+ * @see https://api-docs-v3.idex.io/#get-wallets
1715
+ * @param {string} code not used by idex
1716
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1717
+ * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
1718
+ */
1719
+ const request = {};
1720
+ request['nonce'] = this.uuidv1();
1721
+ const response = await this.privateGetWallets(this.extend(request, params));
1722
+ //
1723
+ // [
1724
+ // {
1725
+ // address: "0x37A1827CA64C94A26028bDCb43FBDCB0bf6DAf5B",
1726
+ // totalPortfolioValueUsd: "0.00",
1727
+ // time: "1678342148086"
1728
+ // },
1729
+ // {
1730
+ // address: "0x0Ef3456E616552238B0c562d409507Ed6051A7b3",
1731
+ // totalPortfolioValueUsd: "15.90",
1732
+ // time: "1691697811659"
1733
+ // }
1734
+ // ]
1735
+ //
1736
+ return this.parseDepositAddress(response);
1737
+ }
1738
+ parseDepositAddress(depositAddress, currency = undefined) {
1739
+ //
1740
+ // [
1741
+ // {
1742
+ // address: "0x37A1827CA64C94A26028bDCb43FBDCB0bf6DAf5B",
1743
+ // totalPortfolioValueUsd: "0.00",
1744
+ // time: "1678342148086"
1745
+ // },
1746
+ // {
1747
+ // address: "0x0Ef3456E616552238B0c562d409507Ed6051A7b3",
1748
+ // totalPortfolioValueUsd: "15.90",
1749
+ // time: "1691697811659"
1750
+ // }
1751
+ // ]
1752
+ //
1753
+ const length = depositAddress.length;
1754
+ const entry = this.safeDict(depositAddress, length - 1);
1755
+ const address = this.safeString(entry, 'address');
1756
+ this.checkAddress(address);
1757
+ return {
1758
+ 'info': depositAddress,
1759
+ 'currency': undefined,
1760
+ 'address': address,
1761
+ 'tag': undefined,
1762
+ 'network': 'MATIC',
1763
+ };
1764
+ }
1706
1765
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
1707
1766
  const network = this.safeString(this.options, 'network', 'ETH');
1708
1767
  const version = this.safeString(this.options, 'version', 'v1');
package/js/src/latoken.js CHANGED
@@ -44,6 +44,9 @@ export default class latoken extends Exchange {
44
44
  'fetchCrossBorrowRate': false,
45
45
  'fetchCrossBorrowRates': false,
46
46
  'fetchCurrencies': true,
47
+ 'fetchDepositAddress': false,
48
+ 'fetchDepositAddresses': false,
49
+ 'fetchDepositAddressesByNetwork': false,
47
50
  'fetchDepositsWithdrawals': true,
48
51
  'fetchDepositWithdrawFees': false,
49
52
  'fetchIsolatedBorrowRate': false,
package/js/src/mercado.js CHANGED
@@ -43,6 +43,9 @@ export default class mercado extends Exchange {
43
43
  'fetchBorrowRateHistory': false,
44
44
  'fetchCrossBorrowRate': false,
45
45
  'fetchCrossBorrowRates': false,
46
+ 'fetchDepositAddress': false,
47
+ 'fetchDepositAddresses': false,
48
+ 'fetchDepositAddressesByNetwork': false,
46
49
  'fetchFundingHistory': false,
47
50
  'fetchFundingRate': false,
48
51
  'fetchFundingRateHistory': false,
package/js/src/oceanex.js CHANGED
@@ -50,6 +50,9 @@ export default class oceanex extends Exchange {
50
50
  'fetchClosedOrders': true,
51
51
  'fetchCrossBorrowRate': false,
52
52
  'fetchCrossBorrowRates': false,
53
+ 'fetchDepositAddress': false,
54
+ 'fetchDepositAddresses': false,
55
+ 'fetchDepositAddressesByNetwork': false,
53
56
  'fetchIsolatedBorrowRate': false,
54
57
  'fetchIsolatedBorrowRates': false,
55
58
  'fetchMarkets': true,
package/js/src/okx.js CHANGED
@@ -447,6 +447,7 @@ export default class okx extends Exchange {
447
447
  'account/quick-margin-borrow-repay': 4,
448
448
  'account/borrow-repay': 5 / 3,
449
449
  'account/simulated_margin': 10,
450
+ 'account/position-builder': 10,
450
451
  'account/set-riskOffset-type': 2,
451
452
  'account/activate-option': 4,
452
453
  'account/set-auto-loan': 4,
@@ -521,13 +521,15 @@ export default class bitget extends bitgetRest {
521
521
  const rawOrderBook = this.safeValue(data, 0);
522
522
  const timestamp = this.safeInteger(rawOrderBook, 'ts');
523
523
  const incrementalBook = channel === 'books';
524
- let storedOrderBook = undefined;
525
524
  if (incrementalBook) {
526
- storedOrderBook = this.safeValue(this.orderbooks, symbol);
527
- if (storedOrderBook === undefined) {
528
- storedOrderBook = this.countedOrderBook({});
529
- storedOrderBook['symbol'] = symbol;
525
+ // storedOrderBook = this.safeValue (this.orderbooks, symbol);
526
+ if (!(symbol in this.orderbooks)) {
527
+ // const ob = this.orderBook ({});
528
+ const ob = this.countedOrderBook({});
529
+ ob['symbol'] = symbol;
530
+ this.orderbooks[symbol] = ob;
530
531
  }
532
+ const storedOrderBook = this.orderbooks[symbol];
531
533
  const asks = this.safeValue(rawOrderBook, 'asks', []);
532
534
  const bids = this.safeValue(rawOrderBook, 'bids', []);
533
535
  this.handleDeltas(storedOrderBook['asks'], asks);
@@ -562,10 +564,12 @@ export default class bitget extends bitgetRest {
562
564
  }
563
565
  }
564
566
  else {
565
- storedOrderBook = this.parseOrderBook(rawOrderBook, symbol, timestamp);
567
+ const orderbook = this.orderBook({});
568
+ const parsedOrderbook = this.parseOrderBook(rawOrderBook, symbol, timestamp);
569
+ orderbook.reset(parsedOrderbook);
570
+ this.orderbooks[symbol] = orderbook;
566
571
  }
567
- this.orderbooks[symbol] = storedOrderBook;
568
- client.resolve(storedOrderBook, messageHash);
572
+ client.resolve(this.orderbooks[symbol], messageHash);
569
573
  }
570
574
  handleDelta(bookside, delta) {
571
575
  const bidAsk = this.parseBidAsk(delta, 0, 1);
@@ -1320,13 +1320,13 @@ export default class bitmart extends bitmartRest {
1320
1320
  const update = datas[i];
1321
1321
  const marketId = this.safeString(update, 'symbol');
1322
1322
  const symbol = this.safeSymbol(marketId);
1323
- let orderbook = this.safeDict(this.orderbooks, symbol);
1324
- if (orderbook === undefined) {
1325
- orderbook = this.orderBook({}, limit);
1326
- orderbook['symbol'] = symbol;
1327
- this.orderbooks[symbol] = orderbook;
1323
+ if (!(symbol in this.orderbooks)) {
1324
+ const ob = this.orderBook({}, limit);
1325
+ ob['symbol'] = symbol;
1326
+ this.orderbooks[symbol] = ob;
1328
1327
  }
1329
- const type = this.safeValue(update, 'type');
1328
+ const orderbook = this.orderbooks[symbol];
1329
+ const type = this.safeString(update, 'type');
1330
1330
  if ((type === 'snapshot') || (!(channelName.indexOf('increase') >= 0))) {
1331
1331
  orderbook.reset({});
1332
1332
  }
@@ -1350,12 +1350,12 @@ export default class bitmart extends bitmartRest {
1350
1350
  const depths = data['depths'];
1351
1351
  const marketId = this.safeString(data, 'symbol');
1352
1352
  const symbol = this.safeSymbol(marketId);
1353
- let orderbook = this.safeDict(this.orderbooks, symbol);
1354
- if (orderbook === undefined) {
1355
- orderbook = this.orderBook({}, limit);
1356
- orderbook['symbol'] = symbol;
1357
- this.orderbooks[symbol] = orderbook;
1353
+ if (!(symbol in this.orderbooks)) {
1354
+ const ob = this.orderBook({}, limit);
1355
+ ob['symbol'] = symbol;
1356
+ this.orderbooks[symbol] = ob;
1358
1357
  }
1358
+ const orderbook = this.orderbooks[symbol];
1359
1359
  const way = this.safeNumber(data, 'way');
1360
1360
  const side = (way === 1) ? 'bids' : 'asks';
1361
1361
  if (way === 1) {
@@ -351,11 +351,11 @@ export default class bitmex extends bitmexRest {
351
351
  const market = this.safeMarket(marketId);
352
352
  const symbol = market['symbol'];
353
353
  const messageHash = table + ':' + marketId;
354
- let ticker = this.safeDict(this.tickers, symbol, {});
354
+ const ticker = this.safeDict(this.tickers, symbol, {});
355
355
  const info = this.safeDict(ticker, 'info', {});
356
- ticker = this.parseTicker(this.extend(info, update), market);
357
- tickers[symbol] = ticker;
358
- this.tickers[symbol] = ticker;
356
+ const parsedTicker = this.parseTicker(this.extend(info, update), market);
357
+ tickers[symbol] = parsedTicker;
358
+ this.tickers[symbol] = parsedTicker;
359
359
  client.resolve(ticker, messageHash);
360
360
  }
361
361
  client.resolve(tickers, 'instrument');
package/js/src/pro/cex.js CHANGED
@@ -174,7 +174,7 @@ export default class cex extends cexRest {
174
174
  stored.append(parsed);
175
175
  }
176
176
  const messageHash = 'trades';
177
- this.trades = stored;
177
+ this.trades = stored; // trades don't have symbol
178
178
  client.resolve(this.trades, messageHash);
179
179
  }
180
180
  parseWsOldTrade(trade, market = undefined) {
@@ -218,7 +218,7 @@ export default class cex extends cexRest {
218
218
  // }
219
219
  //
220
220
  const data = this.safeValue(message, 'data', []);
221
- const stored = this.trades;
221
+ const stored = this.trades; // to do fix this, this.trades is not meant to be used like this
222
222
  for (let i = 0; i < data.length; i++) {
223
223
  const rawTrade = data[i];
224
224
  const parsed = this.parseWsOldTrade(rawTrade);
@@ -12,6 +12,10 @@ export default class gate extends gateRest {
12
12
  watchTicker(symbol: string, params?: {}): Promise<Ticker>;
13
13
  watchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
14
14
  handleTicker(client: Client, message: any): void;
15
+ watchBidsAsks(symbols?: Strings, params?: {}): Promise<Tickers>;
16
+ handleBidAsk(client: Client, message: any): void;
17
+ subscribeWatchTickersAndBidsAsks(symbols?: Strings, callerMethodName?: Str, params?: {}): Promise<Tickers>;
18
+ handleTickerAndBidAsk(objectName: string, client: Client, message: any): void;
15
19
  watchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
16
20
  watchTradesForSymbols(symbols: string[], since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
17
21
  handleTrades(client: Client, message: any): void;