ccxt 4.2.45 → 4.2.47

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 (90) hide show
  1. package/CHANGELOG.md +5405 -8414
  2. package/README.md +4 -4
  3. package/change.sh +5 -3
  4. package/dist/ccxt.browser.js +824 -64
  5. package/dist/ccxt.browser.min.js +7 -7
  6. package/dist/cjs/ccxt.js +1 -1
  7. package/dist/cjs/src/base/ws/Cache.js +13 -5
  8. package/dist/cjs/src/base/ws/OrderBook.js +2 -2
  9. package/dist/cjs/src/binance.js +34 -12
  10. package/dist/cjs/src/bitfinex2.js +1 -0
  11. package/dist/cjs/src/bithumb.js +5 -0
  12. package/dist/cjs/src/btcturk.js +11 -0
  13. package/dist/cjs/src/bybit.js +185 -2
  14. package/dist/cjs/src/coinbase.js +9 -5
  15. package/dist/cjs/src/coincheck.js +11 -0
  16. package/dist/cjs/src/coinmate.js +114 -1
  17. package/dist/cjs/src/coinsph.js +32 -1
  18. package/dist/cjs/src/coinspot.js +7 -0
  19. package/dist/cjs/src/cryptocom.js +2 -2
  20. package/dist/cjs/src/currencycom.js +22 -0
  21. package/dist/cjs/src/deribit.js +34 -1
  22. package/dist/cjs/src/exmo.js +22 -0
  23. package/dist/cjs/src/gemini.js +15 -0
  24. package/dist/cjs/src/hitbtc.js +2 -0
  25. package/dist/cjs/src/hollaex.js +27 -1
  26. package/dist/cjs/src/idex.js +60 -1
  27. package/dist/cjs/src/indodax.js +106 -1
  28. package/dist/cjs/src/latoken.js +3 -0
  29. package/dist/cjs/src/mercado.js +3 -0
  30. package/dist/cjs/src/oceanex.js +3 -0
  31. package/dist/cjs/src/okx.js +1 -0
  32. package/dist/cjs/src/pro/bitget.js +12 -8
  33. package/dist/cjs/src/pro/bitmart.js +11 -11
  34. package/dist/cjs/src/pro/bitmex.js +4 -4
  35. package/dist/cjs/src/pro/cex.js +2 -2
  36. package/dist/cjs/src/pro/gemini.js +4 -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/coinmate.d.ts +12 -0
  44. package/js/src/abstract/fmfwio.d.ts +2 -0
  45. package/js/src/abstract/hitbtc.d.ts +2 -0
  46. package/js/src/abstract/hitbtc3.d.ts +2 -0
  47. package/js/src/abstract/hollaex.d.ts +3 -0
  48. package/js/src/abstract/okx.d.ts +1 -0
  49. package/js/src/base/Exchange.d.ts +9 -7
  50. package/js/src/base/ws/Cache.d.ts +5 -1
  51. package/js/src/base/ws/Cache.js +13 -5
  52. package/js/src/base/ws/OrderBook.d.ts +5 -1
  53. package/js/src/base/ws/OrderBook.js +3 -3
  54. package/js/src/binance.d.ts +1 -1
  55. package/js/src/binance.js +34 -12
  56. package/js/src/bitfinex2.js +1 -0
  57. package/js/src/bithumb.js +5 -0
  58. package/js/src/btcturk.js +11 -0
  59. package/js/src/bybit.d.ts +2 -0
  60. package/js/src/bybit.js +185 -2
  61. package/js/src/coinbase.js +9 -5
  62. package/js/src/coincheck.js +11 -0
  63. package/js/src/coinmate.d.ts +3 -1
  64. package/js/src/coinmate.js +114 -1
  65. package/js/src/coinsph.js +32 -1
  66. package/js/src/coinspot.js +7 -0
  67. package/js/src/cryptocom.js +2 -2
  68. package/js/src/currencycom.js +22 -0
  69. package/js/src/deribit.js +34 -1
  70. package/js/src/exmo.js +22 -0
  71. package/js/src/gemini.js +15 -0
  72. package/js/src/hitbtc.js +2 -0
  73. package/js/src/hollaex.js +27 -1
  74. package/js/src/idex.d.ts +14 -0
  75. package/js/src/idex.js +60 -1
  76. package/js/src/indodax.d.ts +3 -0
  77. package/js/src/indodax.js +106 -1
  78. package/js/src/latoken.js +3 -0
  79. package/js/src/mercado.js +3 -0
  80. package/js/src/oceanex.js +3 -0
  81. package/js/src/okx.js +1 -0
  82. package/js/src/pro/bitget.js +12 -8
  83. package/js/src/pro/bitmart.js +11 -11
  84. package/js/src/pro/bitmex.js +4 -4
  85. package/js/src/pro/cex.js +2 -2
  86. package/js/src/pro/gemini.js +4 -3
  87. package/js/src/timex.d.ts +14 -0
  88. package/js/src/timex.js +65 -0
  89. package/package.json +1 -1
  90. package/skip-tests.json +4 -0
@@ -134,6 +134,9 @@ class hollaex extends hollaex$1 {
134
134
  'trades': 1,
135
135
  'chart': 1,
136
136
  'charts': 1,
137
+ 'minicharts': 1,
138
+ 'oracle/prices': 1,
139
+ 'quick-trade': 1,
137
140
  // TradingView
138
141
  'udf/config': 1,
139
142
  'udf/history': 1,
@@ -209,6 +212,7 @@ class hollaex extends hollaex$1 {
209
212
  * @method
210
213
  * @name hollaex#fetchMarkets
211
214
  * @description retrieves data on all markets for hollaex
215
+ * @see https://apidocs.hollaex.com/#constants
212
216
  * @param {object} [params] extra parameters specific to the exchange API endpoint
213
217
  * @returns {object[]} an array of objects representing market data
214
218
  */
@@ -411,6 +415,7 @@ class hollaex extends hollaex$1 {
411
415
  * @method
412
416
  * @name hollaex#fetchOrderBooks
413
417
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data for multiple markets
418
+ * @see https://apidocs.hollaex.com/#orderbooks
414
419
  * @param {string[]|undefined} symbols not used by hollaex fetchOrderBooks ()
415
420
  * @param {int} [limit] not used by hollaex fetchOrderBooks ()
416
421
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -434,6 +439,7 @@ class hollaex extends hollaex$1 {
434
439
  * @method
435
440
  * @name hollaex#fetchOrderBook
436
441
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
442
+ * @see https://apidocs.hollaex.com/#orderbook
437
443
  * @param {string} symbol unified symbol of the market to fetch the order book for
438
444
  * @param {int} [limit] the maximum amount of order book entries to return
439
445
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -444,7 +450,7 @@ class hollaex extends hollaex$1 {
444
450
  const request = {
445
451
  'symbol': market['id'],
446
452
  };
447
- const response = await this.publicGetOrderbooks(this.extend(request, params));
453
+ const response = await this.publicGetOrderbook(this.extend(request, params));
448
454
  //
449
455
  // {
450
456
  // "btc-usdt": {
@@ -473,6 +479,7 @@ class hollaex extends hollaex$1 {
473
479
  * @method
474
480
  * @name hollaex#fetchTicker
475
481
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
482
+ * @see https://apidocs.hollaex.com/#ticker
476
483
  * @param {string} symbol unified symbol of the market to fetch the ticker for
477
484
  * @param {object} [params] extra parameters specific to the exchange API endpoint
478
485
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -501,6 +508,7 @@ class hollaex extends hollaex$1 {
501
508
  * @method
502
509
  * @name hollaex#fetchTickers
503
510
  * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
511
+ * @see https://apidocs.hollaex.com/#tickers
504
512
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
505
513
  * @param {object} [params] extra parameters specific to the exchange API endpoint
506
514
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -598,6 +606,7 @@ class hollaex extends hollaex$1 {
598
606
  * @method
599
607
  * @name hollaex#fetchTrades
600
608
  * @description get the list of most recent trades for a particular symbol
609
+ * @see https://apidocs.hollaex.com/#trades
601
610
  * @param {string} symbol unified symbol of the market to fetch trades for
602
611
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
603
612
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -686,6 +695,7 @@ class hollaex extends hollaex$1 {
686
695
  * @method
687
696
  * @name hollaex#fetchTradingFees
688
697
  * @description fetch the trading fees for multiple markets
698
+ * @see https://apidocs.hollaex.com/#tiers
689
699
  * @param {object} [params] extra parameters specific to the exchange API endpoint
690
700
  * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
691
701
  */
@@ -745,6 +755,7 @@ class hollaex extends hollaex$1 {
745
755
  * @method
746
756
  * @name hollaex#fetchOHLCV
747
757
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
758
+ * @see https://apidocs.hollaex.com/#chart
748
759
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
749
760
  * @param {string} timeframe the length of time each candle represents
750
761
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -839,6 +850,7 @@ class hollaex extends hollaex$1 {
839
850
  * @method
840
851
  * @name hollaex#fetchBalance
841
852
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
853
+ * @see https://apidocs.hollaex.com/#get-balance
842
854
  * @param {object} [params] extra parameters specific to the exchange API endpoint
843
855
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
844
856
  */
@@ -863,6 +875,7 @@ class hollaex extends hollaex$1 {
863
875
  * @method
864
876
  * @name hollaex#fetchOpenOrder
865
877
  * @description fetch an open order by it's id
878
+ * @see https://apidocs.hollaex.com/#get-order
866
879
  * @param {string} id order id
867
880
  * @param {string} symbol not used by hollaex fetchOpenOrder ()
868
881
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -904,6 +917,7 @@ class hollaex extends hollaex$1 {
904
917
  * @method
905
918
  * @name hollaex#fetchOpenOrders
906
919
  * @description fetch all unfilled currently open orders
920
+ * @see https://apidocs.hollaex.com/#get-all-orders
907
921
  * @param {string} symbol unified market symbol
908
922
  * @param {int} [since] the earliest time in ms to fetch open orders for
909
923
  * @param {int} [limit] the maximum number of open orders structures to retrieve
@@ -920,6 +934,7 @@ class hollaex extends hollaex$1 {
920
934
  * @method
921
935
  * @name hollaex#fetchClosedOrders
922
936
  * @description fetches information on multiple closed orders made by the user
937
+ * @see https://apidocs.hollaex.com/#get-all-orders
923
938
  * @param {string} symbol unified market symbol of the market orders were made in
924
939
  * @param {int} [since] the earliest time in ms to fetch orders for
925
940
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -936,6 +951,7 @@ class hollaex extends hollaex$1 {
936
951
  * @method
937
952
  * @name hollaex#fetchOrder
938
953
  * @description fetches information on an order made by the user
954
+ * @see https://apidocs.hollaex.com/#get-order
939
955
  * @param {string} symbol unified symbol of the market the order was made in
940
956
  * @param {object} [params] extra parameters specific to the exchange API endpoint
941
957
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -978,6 +994,7 @@ class hollaex extends hollaex$1 {
978
994
  * @method
979
995
  * @name hollaex#fetchOrders
980
996
  * @description fetches information on multiple orders made by the user
997
+ * @see https://apidocs.hollaex.com/#get-all-orders
981
998
  * @param {string} symbol unified market symbol of the market orders were made in
982
999
  * @param {int} [since] the earliest time in ms to fetch orders for
983
1000
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -1122,6 +1139,7 @@ class hollaex extends hollaex$1 {
1122
1139
  * @method
1123
1140
  * @name hollaex#createOrder
1124
1141
  * @description create a trade order
1142
+ * @see https://apidocs.hollaex.com/#create-order
1125
1143
  * @param {string} symbol unified symbol of the market to create an order in
1126
1144
  * @param {string} type 'market' or 'limit'
1127
1145
  * @param {string} side 'buy' or 'sell'
@@ -1190,6 +1208,7 @@ class hollaex extends hollaex$1 {
1190
1208
  * @method
1191
1209
  * @name hollaex#cancelOrder
1192
1210
  * @description cancels an open order
1211
+ * @see https://apidocs.hollaex.com/#cancel-order
1193
1212
  * @param {string} id order id
1194
1213
  * @param {string} symbol unified symbol of the market the order was made in
1195
1214
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1220,6 +1239,7 @@ class hollaex extends hollaex$1 {
1220
1239
  * @method
1221
1240
  * @name hollaex#cancelAllOrders
1222
1241
  * @description cancel all open orders in a market
1242
+ * @see https://apidocs.hollaex.com/#cancel-all-orders
1223
1243
  * @param {string} symbol unified market symbol of the market to cancel orders in
1224
1244
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1225
1245
  * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -1255,6 +1275,7 @@ class hollaex extends hollaex$1 {
1255
1275
  * @method
1256
1276
  * @name hollaex#fetchMyTrades
1257
1277
  * @description fetch all trades made by the user
1278
+ * @see https://apidocs.hollaex.com/#get-trades
1258
1279
  * @param {string} symbol unified market symbol
1259
1280
  * @param {int} [since] the earliest time in ms to fetch trades for
1260
1281
  * @param {int} [limit] the maximum number of trades structures to retrieve
@@ -1336,6 +1357,7 @@ class hollaex extends hollaex$1 {
1336
1357
  * @method
1337
1358
  * @name hollaex#fetchDepositAddresses
1338
1359
  * @description fetch deposit addresses for multiple currencies and chain types
1360
+ * @see https://apidocs.hollaex.com/#get-user
1339
1361
  * @param {string[]|undefined} codes list of unified currency codes, default is undefined
1340
1362
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1341
1363
  * @returns {object} a list of [address structures]{@link https://docs.ccxt.com/#/?id=address-structure}
@@ -1398,6 +1420,7 @@ class hollaex extends hollaex$1 {
1398
1420
  * @method
1399
1421
  * @name hollaex#fetchDeposits
1400
1422
  * @description fetch all deposits made to an account
1423
+ * @see https://apidocs.hollaex.com/#get-deposits
1401
1424
  * @param {string} code unified currency code
1402
1425
  * @param {int} [since] the earliest time in ms to fetch deposits for
1403
1426
  * @param {int} [limit] the maximum number of deposits structures to retrieve
@@ -1457,6 +1480,7 @@ class hollaex extends hollaex$1 {
1457
1480
  * @method
1458
1481
  * @name hollaex#fetchWithdrawal
1459
1482
  * @description fetch data on a currency withdrawal via the withdrawal id
1483
+ * @see https://apidocs.hollaex.com/#get-withdrawals
1460
1484
  * @param {string} id withdrawal id
1461
1485
  * @param {string} code unified currency code of the currency withdrawn, default is undefined
1462
1486
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1504,6 +1528,7 @@ class hollaex extends hollaex$1 {
1504
1528
  * @method
1505
1529
  * @name hollaex#fetchWithdrawals
1506
1530
  * @description fetch all withdrawals made from an account
1531
+ * @see https://apidocs.hollaex.com/#get-withdrawals
1507
1532
  * @param {string} code unified currency code
1508
1533
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
1509
1534
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
@@ -1664,6 +1689,7 @@ class hollaex extends hollaex$1 {
1664
1689
  * @method
1665
1690
  * @name hollaex#withdraw
1666
1691
  * @description make a withdrawal
1692
+ * @see https://apidocs.hollaex.com/#withdrawal
1667
1693
  * @param {string} code unified currency code
1668
1694
  * @param {float} amount the amount to withdraw
1669
1695
  * @param {string} address the address to withdraw to
@@ -53,6 +53,9 @@ class idex extends idex$1 {
53
53
  'fetchCrossBorrowRates': false,
54
54
  'fetchCurrencies': true,
55
55
  'fetchDeposit': true,
56
+ 'fetchDepositAddress': true,
57
+ 'fetchDepositAddresses': false,
58
+ 'fetchDepositAddressesByNetwork': false,
56
59
  'fetchDeposits': true,
57
60
  'fetchFundingHistory': false,
58
61
  'fetchFundingRate': false,
@@ -112,7 +115,7 @@ class idex extends idex$1 {
112
115
  },
113
116
  'www': 'https://idex.io',
114
117
  'doc': [
115
- 'https://docs.idex.io/',
118
+ 'https://api-docs-v3.idex.io/',
116
119
  ],
117
120
  },
118
121
  'api': {
@@ -1700,6 +1703,62 @@ class idex extends idex$1 {
1700
1703
  const authenticated = hasApiKey && hasSecret && hasWalletAddress && hasPrivateKey;
1701
1704
  return authenticated ? (defaultCost / 2) : defaultCost;
1702
1705
  }
1706
+ async fetchDepositAddress(code = undefined, params = {}) {
1707
+ /**
1708
+ * @method
1709
+ * @name idex#fetchDepositAddress
1710
+ * @description fetch the Polygon address of the wallet
1711
+ * @see https://api-docs-v3.idex.io/#get-wallets
1712
+ * @param {string} code not used by idex
1713
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1714
+ * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
1715
+ */
1716
+ const request = {};
1717
+ request['nonce'] = this.uuidv1();
1718
+ const response = await this.privateGetWallets(this.extend(request, params));
1719
+ //
1720
+ // [
1721
+ // {
1722
+ // address: "0x37A1827CA64C94A26028bDCb43FBDCB0bf6DAf5B",
1723
+ // totalPortfolioValueUsd: "0.00",
1724
+ // time: "1678342148086"
1725
+ // },
1726
+ // {
1727
+ // address: "0x0Ef3456E616552238B0c562d409507Ed6051A7b3",
1728
+ // totalPortfolioValueUsd: "15.90",
1729
+ // time: "1691697811659"
1730
+ // }
1731
+ // ]
1732
+ //
1733
+ return this.parseDepositAddress(response);
1734
+ }
1735
+ parseDepositAddress(depositAddress, currency = undefined) {
1736
+ //
1737
+ // [
1738
+ // {
1739
+ // address: "0x37A1827CA64C94A26028bDCb43FBDCB0bf6DAf5B",
1740
+ // totalPortfolioValueUsd: "0.00",
1741
+ // time: "1678342148086"
1742
+ // },
1743
+ // {
1744
+ // address: "0x0Ef3456E616552238B0c562d409507Ed6051A7b3",
1745
+ // totalPortfolioValueUsd: "15.90",
1746
+ // time: "1691697811659"
1747
+ // }
1748
+ // ]
1749
+ //
1750
+ const length = depositAddress.length;
1751
+ const entry = this.safeDict(depositAddress, length - 1);
1752
+ const address = this.safeString(entry, 'address');
1753
+ this.checkAddress(address);
1754
+ return {
1755
+ 'info': depositAddress,
1756
+ 'currency': undefined,
1757
+ 'address': address,
1758
+ 'tag': undefined,
1759
+ 'network': 'MATIC',
1760
+ };
1761
+ }
1703
1762
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
1704
1763
  const network = this.safeString(this.options, 'network', 'ETH');
1705
1764
  const version = this.safeString(this.options, 'version', 'v1');
@@ -46,6 +46,9 @@ class indodax extends indodax$1 {
46
46
  'fetchCrossBorrowRate': false,
47
47
  'fetchCrossBorrowRates': false,
48
48
  'fetchDeposit': false,
49
+ 'fetchDepositAddress': 'emulated',
50
+ 'fetchDepositAddresses': true,
51
+ 'fetchDepositAddressesByNetwork': false,
49
52
  'fetchDeposits': false,
50
53
  'fetchDepositsWithdrawals': true,
51
54
  'fetchFundingHistory': false,
@@ -157,7 +160,25 @@ class indodax extends indodax$1 {
157
160
  'options': {
158
161
  'recvWindow': 5 * 1000,
159
162
  'timeDifference': 0,
160
- 'adjustForTimeDifference': false, // controls the adjustment logic upon instantiation
163
+ 'adjustForTimeDifference': false,
164
+ 'networks': {
165
+ 'XLM': 'Stellar Token',
166
+ 'BSC': 'bep20',
167
+ 'TRC20': 'trc20',
168
+ 'MATIC': 'polygon',
169
+ // 'BEP2': 'bep2',
170
+ // 'ARB': 'arb',
171
+ // 'ERC20': 'erc20',
172
+ // 'KIP7': 'kip7',
173
+ // 'MAINNET': 'mainnet', // TODO: does mainnet just mean the default?
174
+ // 'OEP4': 'oep4',
175
+ // 'OP': 'op',
176
+ // 'SPL': 'spl',
177
+ // 'TRC10': 'trc10',
178
+ // 'ZRC2': 'zrc2'
179
+ // 'ETH': 'eth'
180
+ // 'BASE': 'base'
181
+ },
161
182
  },
162
183
  'commonCurrencies': {
163
184
  'STR': 'XLM',
@@ -1016,6 +1037,90 @@ class indodax extends indodax$1 {
1016
1037
  };
1017
1038
  return this.safeString(statuses, status, status);
1018
1039
  }
1040
+ async fetchDepositAddresses(codes = undefined, params = {}) {
1041
+ /**
1042
+ * @method
1043
+ * @name indodax#fetchDepositAddresses
1044
+ * @description fetch deposit addresses for multiple currencies and chain types
1045
+ * @param {string[]} [codes] list of unified currency codes, default is undefined
1046
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1047
+ * @returns {object} a list of [address structures]{@link https://docs.ccxt.com/#/?id=address-structure}
1048
+ */
1049
+ await this.loadMarkets();
1050
+ const response = await this.privatePostGetInfo(params);
1051
+ //
1052
+ // {
1053
+ // success: '1',
1054
+ // return: {
1055
+ // server_time: '1708031570',
1056
+ // balance: {
1057
+ // idr: '29952',
1058
+ // ...
1059
+ // },
1060
+ // balance_hold: {
1061
+ // idr: '0',
1062
+ // ...
1063
+ // },
1064
+ // address: {
1065
+ // btc: '1KMntgzvU7iTSgMBWc11nVuJjAyfW3qJyk',
1066
+ // ...
1067
+ // },
1068
+ // memo_is_required: {
1069
+ // btc: { mainnet: false },
1070
+ // ...
1071
+ // },
1072
+ // network: {
1073
+ // btc: 'mainnet',
1074
+ // ...
1075
+ // },
1076
+ // user_id: '276011',
1077
+ // name: '',
1078
+ // email: 'testbitcoincoid@mailforspam.com',
1079
+ // profile_picture: null,
1080
+ // verification_status: 'unverified',
1081
+ // gauth_enable: true,
1082
+ // withdraw_status: '0'
1083
+ // }
1084
+ // }
1085
+ //
1086
+ const data = this.safeDict(response, 'return');
1087
+ const addresses = this.safeDict(data, 'address', {});
1088
+ const networks = this.safeDict(data, 'network', {});
1089
+ const addressKeys = Object.keys(addresses);
1090
+ const result = {
1091
+ 'info': data,
1092
+ };
1093
+ for (let i = 0; i < addressKeys.length; i++) {
1094
+ const marketId = addressKeys[i];
1095
+ const code = this.safeCurrencyCode(marketId);
1096
+ const address = this.safeString(addresses, marketId);
1097
+ if ((address !== undefined) && ((codes === undefined) || (this.inArray(code, codes)))) {
1098
+ this.checkAddress(address);
1099
+ let network = undefined;
1100
+ if (marketId in networks) {
1101
+ const networkId = this.safeString(networks, marketId);
1102
+ if (networkId.indexOf(',') >= 0) {
1103
+ network = [];
1104
+ const networkIds = networkId.split(',');
1105
+ for (let j = 0; j < networkIds.length; j++) {
1106
+ network.push(this.networkIdToCode(networkIds[j]).toUpperCase());
1107
+ }
1108
+ }
1109
+ else {
1110
+ network = this.networkIdToCode(networkId).toUpperCase();
1111
+ }
1112
+ }
1113
+ result[code] = {
1114
+ 'info': {},
1115
+ 'currency': code,
1116
+ 'address': address,
1117
+ 'network': network,
1118
+ 'tag': undefined,
1119
+ };
1120
+ }
1121
+ }
1122
+ return result;
1123
+ }
1019
1124
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
1020
1125
  let url = this.urls['api'][api];
1021
1126
  if (api === 'public') {
@@ -41,6 +41,9 @@ class latoken extends latoken$1 {
41
41
  'fetchCrossBorrowRate': false,
42
42
  'fetchCrossBorrowRates': false,
43
43
  'fetchCurrencies': true,
44
+ 'fetchDepositAddress': false,
45
+ 'fetchDepositAddresses': false,
46
+ 'fetchDepositAddressesByNetwork': false,
44
47
  'fetchDepositsWithdrawals': true,
45
48
  'fetchDepositWithdrawFees': false,
46
49
  'fetchIsolatedBorrowRate': false,
@@ -40,6 +40,9 @@ class mercado extends mercado$1 {
40
40
  'fetchBorrowRateHistory': false,
41
41
  'fetchCrossBorrowRate': false,
42
42
  'fetchCrossBorrowRates': false,
43
+ 'fetchDepositAddress': false,
44
+ 'fetchDepositAddresses': false,
45
+ 'fetchDepositAddressesByNetwork': false,
43
46
  'fetchFundingHistory': false,
44
47
  'fetchFundingRate': false,
45
48
  'fetchFundingRateHistory': false,
@@ -47,6 +47,9 @@ class oceanex extends oceanex$1 {
47
47
  'fetchClosedOrders': true,
48
48
  'fetchCrossBorrowRate': false,
49
49
  'fetchCrossBorrowRates': false,
50
+ 'fetchDepositAddress': false,
51
+ 'fetchDepositAddresses': false,
52
+ 'fetchDepositAddressesByNetwork': false,
50
53
  'fetchIsolatedBorrowRate': false,
51
54
  'fetchIsolatedBorrowRates': false,
52
55
  'fetchMarkets': true,
@@ -444,6 +444,7 @@ class okx extends okx$1 {
444
444
  'account/quick-margin-borrow-repay': 4,
445
445
  'account/borrow-repay': 5 / 3,
446
446
  'account/simulated_margin': 10,
447
+ 'account/position-builder': 10,
447
448
  'account/set-riskOffset-type': 2,
448
449
  'account/activate-option': 4,
449
450
  'account/set-auto-loan': 4,
@@ -518,13 +518,15 @@ class bitget extends bitget$1 {
518
518
  const rawOrderBook = this.safeValue(data, 0);
519
519
  const timestamp = this.safeInteger(rawOrderBook, 'ts');
520
520
  const incrementalBook = channel === 'books';
521
- let storedOrderBook = undefined;
522
521
  if (incrementalBook) {
523
- storedOrderBook = this.safeValue(this.orderbooks, symbol);
524
- if (storedOrderBook === undefined) {
525
- storedOrderBook = this.countedOrderBook({});
526
- storedOrderBook['symbol'] = symbol;
522
+ // storedOrderBook = this.safeValue (this.orderbooks, symbol);
523
+ if (!(symbol in this.orderbooks)) {
524
+ // const ob = this.orderBook ({});
525
+ const ob = this.countedOrderBook({});
526
+ ob['symbol'] = symbol;
527
+ this.orderbooks[symbol] = ob;
527
528
  }
529
+ const storedOrderBook = this.orderbooks[symbol];
528
530
  const asks = this.safeValue(rawOrderBook, 'asks', []);
529
531
  const bids = this.safeValue(rawOrderBook, 'bids', []);
530
532
  this.handleDeltas(storedOrderBook['asks'], asks);
@@ -559,10 +561,12 @@ class bitget extends bitget$1 {
559
561
  }
560
562
  }
561
563
  else {
562
- storedOrderBook = this.parseOrderBook(rawOrderBook, symbol, timestamp);
564
+ const orderbook = this.orderBook({});
565
+ const parsedOrderbook = this.parseOrderBook(rawOrderBook, symbol, timestamp);
566
+ orderbook.reset(parsedOrderbook);
567
+ this.orderbooks[symbol] = orderbook;
563
568
  }
564
- this.orderbooks[symbol] = storedOrderBook;
565
- client.resolve(storedOrderBook, messageHash);
569
+ client.resolve(this.orderbooks[symbol], messageHash);
566
570
  }
567
571
  handleDelta(bookside, delta) {
568
572
  const bidAsk = this.parseBidAsk(delta, 0, 1);
@@ -1317,13 +1317,13 @@ class bitmart extends bitmart$1 {
1317
1317
  const update = datas[i];
1318
1318
  const marketId = this.safeString(update, 'symbol');
1319
1319
  const symbol = this.safeSymbol(marketId);
1320
- let orderbook = this.safeDict(this.orderbooks, symbol);
1321
- if (orderbook === undefined) {
1322
- orderbook = this.orderBook({}, limit);
1323
- orderbook['symbol'] = symbol;
1324
- this.orderbooks[symbol] = orderbook;
1320
+ if (!(symbol in this.orderbooks)) {
1321
+ const ob = this.orderBook({}, limit);
1322
+ ob['symbol'] = symbol;
1323
+ this.orderbooks[symbol] = ob;
1325
1324
  }
1326
- const type = this.safeValue(update, 'type');
1325
+ const orderbook = this.orderbooks[symbol];
1326
+ const type = this.safeString(update, 'type');
1327
1327
  if ((type === 'snapshot') || (!(channelName.indexOf('increase') >= 0))) {
1328
1328
  orderbook.reset({});
1329
1329
  }
@@ -1347,12 +1347,12 @@ class bitmart extends bitmart$1 {
1347
1347
  const depths = data['depths'];
1348
1348
  const marketId = this.safeString(data, 'symbol');
1349
1349
  const symbol = this.safeSymbol(marketId);
1350
- let orderbook = this.safeDict(this.orderbooks, symbol);
1351
- if (orderbook === undefined) {
1352
- orderbook = this.orderBook({}, limit);
1353
- orderbook['symbol'] = symbol;
1354
- this.orderbooks[symbol] = orderbook;
1350
+ if (!(symbol in this.orderbooks)) {
1351
+ const ob = this.orderBook({}, limit);
1352
+ ob['symbol'] = symbol;
1353
+ this.orderbooks[symbol] = ob;
1355
1354
  }
1355
+ const orderbook = this.orderbooks[symbol];
1356
1356
  const way = this.safeNumber(data, 'way');
1357
1357
  const side = (way === 1) ? 'bids' : 'asks';
1358
1358
  if (way === 1) {
@@ -348,11 +348,11 @@ class bitmex extends bitmex$1 {
348
348
  const market = this.safeMarket(marketId);
349
349
  const symbol = market['symbol'];
350
350
  const messageHash = table + ':' + marketId;
351
- let ticker = this.safeDict(this.tickers, symbol, {});
351
+ const ticker = this.safeDict(this.tickers, symbol, {});
352
352
  const info = this.safeDict(ticker, 'info', {});
353
- ticker = this.parseTicker(this.extend(info, update), market);
354
- tickers[symbol] = ticker;
355
- this.tickers[symbol] = ticker;
353
+ const parsedTicker = this.parseTicker(this.extend(info, update), market);
354
+ tickers[symbol] = parsedTicker;
355
+ this.tickers[symbol] = parsedTicker;
356
356
  client.resolve(ticker, messageHash);
357
357
  }
358
358
  client.resolve(tickers, 'instrument');
@@ -171,7 +171,7 @@ class cex extends cex$1 {
171
171
  stored.append(parsed);
172
172
  }
173
173
  const messageHash = 'trades';
174
- this.trades = stored;
174
+ this.trades = stored; // trades don't have symbol
175
175
  client.resolve(this.trades, messageHash);
176
176
  }
177
177
  parseWsOldTrade(trade, market = undefined) {
@@ -215,7 +215,7 @@ class cex extends cex$1 {
215
215
  // }
216
216
  //
217
217
  const data = this.safeValue(message, 'data', []);
218
- const stored = this.trades;
218
+ const stored = this.trades; // to do fix this, this.trades is not meant to be used like this
219
219
  for (let i = 0; i < data.length; i++) {
220
220
  const rawTrade = data[i];
221
221
  const parsed = this.parseWsOldTrade(rawTrade);
@@ -460,10 +460,11 @@ class gemini extends gemini$1 {
460
460
  const market = this.safeMarket(marketId.toLowerCase());
461
461
  const symbol = market['symbol'];
462
462
  const messageHash = 'orderbook:' + symbol;
463
- let orderbook = this.safeDict(this.orderbooks, symbol);
464
- if (orderbook === undefined) {
465
- orderbook = this.orderBook();
463
+ if (!(symbol in this.orderbooks)) {
464
+ const ob = this.orderBook();
465
+ this.orderbooks[symbol] = ob;
466
466
  }
467
+ const orderbook = this.orderbooks[symbol];
467
468
  const bids = orderbook['bids'];
468
469
  const asks = orderbook['asks'];
469
470
  for (let i = 0; i < rawOrderBookChanges.length; i++) {
@@ -41,6 +41,9 @@ class timex extends timex$1 {
41
41
  'fetchCrossBorrowRates': false,
42
42
  'fetchCurrencies': true,
43
43
  'fetchDeposit': false,
44
+ 'fetchDepositAddress': true,
45
+ 'fetchDepositAddresses': false,
46
+ 'fetchDepositAddressesByNetwork': false,
44
47
  'fetchDeposits': true,
45
48
  'fetchFundingHistory': false,
46
49
  'fetchFundingRate': false,
@@ -1521,7 +1524,69 @@ class timex extends timex$1 {
1521
1524
  'trades': rawTrades,
1522
1525
  }, market);
1523
1526
  }
1527
+ async fetchDepositAddress(code, params = {}) {
1528
+ /**
1529
+ * @method
1530
+ * @name timex#fetchDepositAddress
1531
+ * @description fetch the deposit address for a currency associated with this account, does not accept params["network"]
1532
+ * @param {string} code unified currency code
1533
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1534
+ * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
1535
+ */
1536
+ await this.loadMarkets();
1537
+ const currency = this.currency(code);
1538
+ const request = {
1539
+ 'symbol': currency['code'],
1540
+ };
1541
+ const response = await this.currenciesGetSSymbol(this.extend(request, params));
1542
+ //
1543
+ // {
1544
+ // id: '1',
1545
+ // currency: {
1546
+ // symbol: 'BTC',
1547
+ // name: 'Bitcoin',
1548
+ // address: '0x8370fbc6ddec1e18b4e41e72ed943e238458487c',
1549
+ // decimals: '8',
1550
+ // tradeDecimals: '20',
1551
+ // fiatSymbol: 'BTC',
1552
+ // depositEnabled: true,
1553
+ // withdrawalEnabled: true,
1554
+ // transferEnabled: true,
1555
+ // active: true
1556
+ // }
1557
+ // }
1558
+ //
1559
+ const data = this.safeDict(response, 'currency', {});
1560
+ return this.parseDepositAddress(data, currency);
1561
+ }
1562
+ parseDepositAddress(depositAddress, currency = undefined) {
1563
+ //
1564
+ // {
1565
+ // symbol: 'BTC',
1566
+ // name: 'Bitcoin',
1567
+ // address: '0x8370fbc6ddec1e18b4e41e72ed943e238458487c',
1568
+ // decimals: '8',
1569
+ // tradeDecimals: '20',
1570
+ // fiatSymbol: 'BTC',
1571
+ // depositEnabled: true,
1572
+ // withdrawalEnabled: true,
1573
+ // transferEnabled: true,
1574
+ // active: true
1575
+ // }
1576
+ //
1577
+ const currencyId = this.safeString(depositAddress, 'symbol');
1578
+ return {
1579
+ 'info': depositAddress,
1580
+ 'currency': this.safeCurrencyCode(currencyId, currency),
1581
+ 'address': this.safeString(depositAddress, 'address'),
1582
+ 'tag': undefined,
1583
+ 'network': undefined,
1584
+ };
1585
+ }
1524
1586
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
1587
+ const paramsToExtract = this.extractParams(path);
1588
+ path = this.implodeParams(path, params);
1589
+ params = this.omit(params, paramsToExtract);
1525
1590
  let url = this.urls['api']['rest'] + '/' + api + '/' + path;
1526
1591
  if (Object.keys(params).length) {
1527
1592
  url += '?' + this.urlencodeWithArrayRepeat(params);