ccxt 4.3.33 → 4.3.35

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 (135) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.min.js +2 -2
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/alpaca.js +1 -1
  5. package/dist/cjs/src/base/Exchange.js +37 -0
  6. package/dist/cjs/src/binance.js +1 -0
  7. package/dist/cjs/src/bitmart.js +2 -9
  8. package/dist/cjs/src/coinbase.js +169 -55
  9. package/dist/cjs/src/coinex.js +26 -19
  10. package/dist/cjs/src/kraken.js +3 -1
  11. package/dist/cjs/src/pro/binance.js +352 -0
  12. package/dist/cjs/src/pro/bitget.js +31 -1
  13. package/dist/cjs/src/pro/bitmex.js +108 -0
  14. package/dist/cjs/src/pro/bybit.js +85 -0
  15. package/dist/cjs/src/pro/gate.js +183 -0
  16. package/dist/cjs/src/pro/kucoinfutures.js +4 -0
  17. package/dist/cjs/src/pro/okx.js +258 -0
  18. package/js/ccxt.d.ts +1 -1
  19. package/js/ccxt.js +1 -1
  20. package/js/src/abstract/binance.d.ts +1 -0
  21. package/js/src/abstract/binancecoinm.d.ts +1 -0
  22. package/js/src/abstract/binanceus.d.ts +1 -0
  23. package/js/src/abstract/binanceusdm.d.ts +1 -0
  24. package/js/src/ace.d.ts +3 -3
  25. package/js/src/alpaca.d.ts +3 -3
  26. package/js/src/alpaca.js +1 -1
  27. package/js/src/ascendex.d.ts +3 -3
  28. package/js/src/base/Exchange.d.ts +14 -3
  29. package/js/src/base/Exchange.js +37 -0
  30. package/js/src/base/types.d.ts +1 -0
  31. package/js/src/bigone.d.ts +3 -3
  32. package/js/src/binance.d.ts +4 -4
  33. package/js/src/binance.js +1 -0
  34. package/js/src/bingx.d.ts +3 -3
  35. package/js/src/bit2c.d.ts +2 -2
  36. package/js/src/bitbank.d.ts +2 -2
  37. package/js/src/bitbns.d.ts +2 -2
  38. package/js/src/bitfinex.d.ts +3 -3
  39. package/js/src/bitfinex2.d.ts +1 -1
  40. package/js/src/bitflyer.d.ts +2 -2
  41. package/js/src/bitget.d.ts +4 -4
  42. package/js/src/bithumb.d.ts +2 -2
  43. package/js/src/bitmart.d.ts +3 -3
  44. package/js/src/bitmart.js +2 -9
  45. package/js/src/bitmex.d.ts +4 -4
  46. package/js/src/bitopro.d.ts +4 -4
  47. package/js/src/bitrue.d.ts +3 -3
  48. package/js/src/bitso.d.ts +3 -3
  49. package/js/src/bitstamp.d.ts +3 -3
  50. package/js/src/bitteam.d.ts +4 -4
  51. package/js/src/bitvavo.d.ts +3 -3
  52. package/js/src/blockchaincom.d.ts +2 -2
  53. package/js/src/blofin.d.ts +4 -4
  54. package/js/src/btcalpha.d.ts +4 -4
  55. package/js/src/btcbox.d.ts +2 -2
  56. package/js/src/btcmarkets.d.ts +4 -4
  57. package/js/src/btcturk.d.ts +2 -2
  58. package/js/src/bybit.d.ts +3 -3
  59. package/js/src/cex.d.ts +2 -2
  60. package/js/src/coinbase.d.ts +4 -3
  61. package/js/src/coinbase.js +169 -55
  62. package/js/src/coinbaseexchange.d.ts +2 -2
  63. package/js/src/coinbaseinternational.d.ts +4 -4
  64. package/js/src/coincheck.d.ts +3 -3
  65. package/js/src/coinex.d.ts +3 -3
  66. package/js/src/coinex.js +26 -19
  67. package/js/src/coinlist.d.ts +3 -3
  68. package/js/src/coinmate.d.ts +3 -3
  69. package/js/src/coinmetro.d.ts +3 -3
  70. package/js/src/coinone.d.ts +2 -2
  71. package/js/src/coinsph.d.ts +3 -3
  72. package/js/src/cryptocom.d.ts +2 -2
  73. package/js/src/currencycom.d.ts +3 -3
  74. package/js/src/delta.d.ts +2 -2
  75. package/js/src/deribit.d.ts +3 -3
  76. package/js/src/digifinex.d.ts +3 -3
  77. package/js/src/exmo.d.ts +3 -3
  78. package/js/src/gate.d.ts +3 -3
  79. package/js/src/gemini.d.ts +3 -3
  80. package/js/src/hitbtc.d.ts +3 -3
  81. package/js/src/hollaex.d.ts +2 -2
  82. package/js/src/htx.d.ts +3 -3
  83. package/js/src/huobijp.d.ts +3 -3
  84. package/js/src/hyperliquid.d.ts +3 -3
  85. package/js/src/idex.d.ts +3 -3
  86. package/js/src/indodax.d.ts +3 -3
  87. package/js/src/kraken.d.ts +3 -3
  88. package/js/src/kraken.js +3 -1
  89. package/js/src/krakenfutures.d.ts +2 -2
  90. package/js/src/kucoin.d.ts +3 -3
  91. package/js/src/kuna.d.ts +3 -3
  92. package/js/src/latoken.d.ts +3 -3
  93. package/js/src/lbank.d.ts +2 -2
  94. package/js/src/luno.d.ts +2 -2
  95. package/js/src/lykke.d.ts +2 -2
  96. package/js/src/mercado.d.ts +2 -2
  97. package/js/src/mexc.d.ts +2 -2
  98. package/js/src/ndax.d.ts +3 -3
  99. package/js/src/novadax.d.ts +4 -4
  100. package/js/src/oceanex.d.ts +3 -3
  101. package/js/src/okcoin.d.ts +4 -4
  102. package/js/src/okx.d.ts +4 -4
  103. package/js/src/onetrading.d.ts +3 -3
  104. package/js/src/p2b.d.ts +3 -3
  105. package/js/src/paymium.d.ts +2 -2
  106. package/js/src/phemex.d.ts +5 -5
  107. package/js/src/poloniex.d.ts +4 -4
  108. package/js/src/poloniexfutures.d.ts +3 -3
  109. package/js/src/pro/binance.d.ts +9 -2
  110. package/js/src/pro/binance.js +352 -0
  111. package/js/src/pro/bitget.js +31 -1
  112. package/js/src/pro/bitmex.d.ts +4 -1
  113. package/js/src/pro/bitmex.js +108 -0
  114. package/js/src/pro/bybit.d.ts +4 -1
  115. package/js/src/pro/bybit.js +85 -0
  116. package/js/src/pro/gate.d.ts +5 -1
  117. package/js/src/pro/gate.js +183 -0
  118. package/js/src/pro/kucoinfutures.js +4 -0
  119. package/js/src/pro/okx.d.ts +8 -1
  120. package/js/src/pro/okx.js +258 -0
  121. package/js/src/probit.d.ts +4 -4
  122. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
  123. package/js/src/timex.d.ts +3 -3
  124. package/js/src/tokocrypto.d.ts +2 -2
  125. package/js/src/tradeogre.d.ts +2 -2
  126. package/js/src/upbit.d.ts +4 -4
  127. package/js/src/wavesexchange.d.ts +2 -2
  128. package/js/src/wazirx.d.ts +4 -4
  129. package/js/src/whitebit.d.ts +4 -4
  130. package/js/src/woo.d.ts +4 -4
  131. package/js/src/woofipro.d.ts +4 -4
  132. package/js/src/yobit.d.ts +2 -2
  133. package/js/src/zaif.d.ts +3 -3
  134. package/js/src/zonda.d.ts +2 -2
  135. package/package.json +1 -1
@@ -114,8 +114,8 @@ export default class coinbase extends Exchange {
114
114
  'fetchTickers': true,
115
115
  'fetchTime': true,
116
116
  'fetchTrades': true,
117
- 'fetchTradingFee': false,
118
- 'fetchTradingFees': false,
117
+ 'fetchTradingFee': 'emulated',
118
+ 'fetchTradingFees': true,
119
119
  'fetchWithdrawals': true,
120
120
  'reduceMargin': false,
121
121
  'setLeverage': false,
@@ -345,6 +345,7 @@ export default class coinbase extends Exchange {
345
345
  'CGLD': 'CELO',
346
346
  },
347
347
  'options': {
348
+ 'usePrivate': false,
348
349
  'brokerId': 'ccxt',
349
350
  'stablePairs': ['BUSD-USD', 'CBETH-ETH', 'DAI-USD', 'GUSD-USD', 'GYEN-USD', 'PAX-USD', 'PAX-USDT', 'USDC-EUR', 'USDC-GBP', 'USDT-EUR', 'USDT-GBP', 'USDT-USD', 'USDT-USDC', 'WBTC-BTC'],
350
351
  'fetchCurrencies': {
@@ -1108,6 +1109,7 @@ export default class coinbase extends Exchange {
1108
1109
  * @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-exchange-rates#get-exchange-rates
1109
1110
  * @description retrieves data on all markets for coinbase
1110
1111
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1112
+ * @param {boolean} [params.usePrivate] use private endpoint for fetching markets
1111
1113
  * @returns {object[]} an array of objects representing market data
1112
1114
  */
1113
1115
  const method = this.safeString(this.options, 'fetchMarkets', 'fetchMarketsV3');
@@ -1189,54 +1191,60 @@ export default class coinbase extends Exchange {
1189
1191
  return result;
1190
1192
  }
1191
1193
  async fetchMarketsV3(params = {}) {
1192
- const spotUnresolvedPromises = [
1193
- this.v3PublicGetBrokerageMarketProducts(params),
1194
- //
1195
- // {
1196
- // products: [
1197
- // {
1198
- // product_id: 'BTC-USD',
1199
- // price: '67060',
1200
- // price_percentage_change_24h: '3.30054960636883',
1201
- // volume_24h: '10967.87426597',
1202
- // volume_percentage_change_24h: '141.73048325503036',
1203
- // base_increment: '0.00000001',
1204
- // quote_increment: '0.01',
1205
- // quote_min_size: '1',
1206
- // quote_max_size: '150000000',
1207
- // base_min_size: '0.00000001',
1208
- // base_max_size: '3400',
1209
- // base_name: 'Bitcoin',
1210
- // quote_name: 'US Dollar',
1211
- // watched: false,
1212
- // is_disabled: false,
1213
- // new: false,
1214
- // status: 'online',
1215
- // cancel_only: false,
1216
- // limit_only: false,
1217
- // post_only: false,
1218
- // trading_disabled: false,
1219
- // auction_mode: false,
1220
- // product_type: 'SPOT',
1221
- // quote_currency_id: 'USD',
1222
- // base_currency_id: 'BTC',
1223
- // fcm_trading_session_details: null,
1224
- // mid_market_price: '',
1225
- // alias: '',
1226
- // alias_to: [ 'BTC-USDC' ],
1227
- // base_display_symbol: 'BTC',
1228
- // quote_display_symbol: 'USD',
1229
- // view_only: false,
1230
- // price_increment: '0.01',
1231
- // display_name: 'BTC-USD',
1232
- // product_venue: 'CBE'
1233
- // },
1234
- // ...
1235
- // ],
1236
- // num_products: '646'
1237
- // }
1238
- //
1239
- ];
1194
+ let usePrivate = false;
1195
+ [usePrivate, params] = this.handleOptionAndParams(params, 'fetchMarkets', 'usePrivate', false);
1196
+ const spotUnresolvedPromises = [];
1197
+ if (usePrivate) {
1198
+ spotUnresolvedPromises.push(this.v3PrivateGetBrokerageProducts(params));
1199
+ }
1200
+ else {
1201
+ spotUnresolvedPromises.push(this.v3PublicGetBrokerageMarketProducts(params));
1202
+ }
1203
+ //
1204
+ // {
1205
+ // products: [
1206
+ // {
1207
+ // product_id: 'BTC-USD',
1208
+ // price: '67060',
1209
+ // price_percentage_change_24h: '3.30054960636883',
1210
+ // volume_24h: '10967.87426597',
1211
+ // volume_percentage_change_24h: '141.73048325503036',
1212
+ // base_increment: '0.00000001',
1213
+ // quote_increment: '0.01',
1214
+ // quote_min_size: '1',
1215
+ // quote_max_size: '150000000',
1216
+ // base_min_size: '0.00000001',
1217
+ // base_max_size: '3400',
1218
+ // base_name: 'Bitcoin',
1219
+ // quote_name: 'US Dollar',
1220
+ // watched: false,
1221
+ // is_disabled: false,
1222
+ // new: false,
1223
+ // status: 'online',
1224
+ // cancel_only: false,
1225
+ // limit_only: false,
1226
+ // post_only: false,
1227
+ // trading_disabled: false,
1228
+ // auction_mode: false,
1229
+ // product_type: 'SPOT',
1230
+ // quote_currency_id: 'USD',
1231
+ // base_currency_id: 'BTC',
1232
+ // fcm_trading_session_details: null,
1233
+ // mid_market_price: '',
1234
+ // alias: '',
1235
+ // alias_to: [ 'BTC-USDC' ],
1236
+ // base_display_symbol: 'BTC',
1237
+ // quote_display_symbol: 'USD',
1238
+ // view_only: false,
1239
+ // price_increment: '0.01',
1240
+ // display_name: 'BTC-USD',
1241
+ // product_venue: 'CBE'
1242
+ // },
1243
+ // ...
1244
+ // ],
1245
+ // num_products: '646'
1246
+ // }
1247
+ //
1240
1248
  if (this.checkRequiredCredentials(false)) {
1241
1249
  spotUnresolvedPromises.push(this.v3PrivateGetBrokerageTransactionSummary(params));
1242
1250
  }
@@ -1764,6 +1772,7 @@ export default class coinbase extends Exchange {
1764
1772
  * @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-exchange-rates#get-exchange-rates
1765
1773
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
1766
1774
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1775
+ * @param {boolean} [params.usePrivate] use private endpoint for fetching tickers
1767
1776
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
1768
1777
  */
1769
1778
  const method = this.safeString(this.options, 'fetchTickers', 'fetchTickersV3');
@@ -1818,7 +1827,15 @@ export default class coinbase extends Exchange {
1818
1827
  if (marketType !== undefined && marketType !== 'default') {
1819
1828
  request['product_type'] = (marketType === 'swap') ? 'FUTURE' : 'SPOT';
1820
1829
  }
1821
- const response = await this.v3PublicGetBrokerageMarketProducts(this.extend(request, params));
1830
+ let response = undefined;
1831
+ let usePrivate = false;
1832
+ [usePrivate, params] = this.handleOptionAndParams(params, 'fetchTickers', 'usePrivate', false);
1833
+ if (usePrivate) {
1834
+ response = await this.v3PrivateGetBrokerageProducts(this.extend(request, params));
1835
+ }
1836
+ else {
1837
+ response = await this.v3PublicGetBrokerageMarketProducts(this.extend(request, params));
1838
+ }
1822
1839
  //
1823
1840
  // {
1824
1841
  // "products": [
@@ -1878,6 +1895,7 @@ export default class coinbase extends Exchange {
1878
1895
  * @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-prices#get-sell-price
1879
1896
  * @param {string} symbol unified symbol of the market to fetch the ticker for
1880
1897
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1898
+ * @param {boolean} [params.usePrivate] whether to use the private endpoint for fetching the ticker
1881
1899
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
1882
1900
  */
1883
1901
  const method = this.safeString(this.options, 'fetchTicker', 'fetchTickerV3');
@@ -1921,7 +1939,15 @@ export default class coinbase extends Exchange {
1921
1939
  'product_id': market['id'],
1922
1940
  'limit': 1,
1923
1941
  };
1924
- const response = await this.v3PublicGetBrokerageMarketProductsProductIdTicker(this.extend(request, params));
1942
+ let usePrivate = false;
1943
+ [usePrivate, params] = this.handleOptionAndParams(params, 'fetchTicker', 'usePrivate', false);
1944
+ let response = undefined;
1945
+ if (usePrivate) {
1946
+ response = await this.v3PrivateGetBrokerageProductsProductIdTicker(this.extend(request, params));
1947
+ }
1948
+ else {
1949
+ response = await this.v3PublicGetBrokerageMarketProductsProductIdTicker(this.extend(request, params));
1950
+ }
1925
1951
  //
1926
1952
  // {
1927
1953
  // "trades": [
@@ -3490,6 +3516,7 @@ export default class coinbase extends Exchange {
3490
3516
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3491
3517
  * @param {int} [params.until] the latest time in ms to fetch trades for
3492
3518
  * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
3519
+ * @param {boolean} [params.usePrivate] default false, when true will use the private endpoint to fetch the candles
3493
3520
  * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
3494
3521
  */
3495
3522
  await this.loadMarkets();
@@ -3525,7 +3552,15 @@ export default class coinbase extends Exchange {
3525
3552
  // 300 candles max
3526
3553
  request['end'] = Precise.stringAdd(sinceString, requestedDuration.toString());
3527
3554
  }
3528
- const response = await this.v3PublicGetBrokerageMarketProductsProductIdCandles(this.extend(request, params));
3555
+ let response = undefined;
3556
+ let usePrivate = false;
3557
+ [usePrivate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'usePrivate', false);
3558
+ if (usePrivate) {
3559
+ response = await this.v3PrivateGetBrokerageProductsProductIdCandles(this.extend(request, params));
3560
+ }
3561
+ else {
3562
+ response = await this.v3PublicGetBrokerageMarketProductsProductIdCandles(this.extend(request, params));
3563
+ }
3529
3564
  //
3530
3565
  // {
3531
3566
  // "candles": [
@@ -3575,6 +3610,7 @@ export default class coinbase extends Exchange {
3575
3610
  * @param {int} [since] not used by coinbase fetchTrades
3576
3611
  * @param {int} [limit] the maximum number of trade structures to fetch
3577
3612
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3613
+ * @param {boolean} [params.usePrivate] default false, when true will use the private endpoint to fetch the trades
3578
3614
  * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
3579
3615
  */
3580
3616
  await this.loadMarkets();
@@ -3596,7 +3632,15 @@ export default class coinbase extends Exchange {
3596
3632
  else if (since !== undefined) {
3597
3633
  throw new ArgumentsRequired(this.id + ' fetchTrades() requires a `until` parameter when you use `since` argument');
3598
3634
  }
3599
- const response = await this.v3PublicGetBrokerageMarketProductsProductIdTicker(this.extend(request, params));
3635
+ let response = undefined;
3636
+ let usePrivate = false;
3637
+ [usePrivate, params] = this.handleOptionAndParams(params, 'fetchTrades', 'usePrivate', false);
3638
+ if (usePrivate) {
3639
+ response = await this.v3PrivateGetBrokerageProductsProductIdTicker(this.extend(request, params));
3640
+ }
3641
+ else {
3642
+ response = await this.v3PublicGetBrokerageMarketProductsProductIdTicker(this.extend(request, params));
3643
+ }
3600
3644
  //
3601
3645
  // {
3602
3646
  // "trades": [
@@ -3697,6 +3741,7 @@ export default class coinbase extends Exchange {
3697
3741
  * @param {string} symbol unified symbol of the market to fetch the order book for
3698
3742
  * @param {int} [limit] the maximum amount of order book entries to return
3699
3743
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3744
+ * @param {boolean} [params.usePrivate] default false, when true will use the private endpoint to fetch the order book
3700
3745
  * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
3701
3746
  */
3702
3747
  await this.loadMarkets();
@@ -3707,7 +3752,15 @@ export default class coinbase extends Exchange {
3707
3752
  if (limit !== undefined) {
3708
3753
  request['limit'] = limit;
3709
3754
  }
3710
- const response = await this.v3PublicGetBrokerageMarketProductBook(this.extend(request, params));
3755
+ let response = undefined;
3756
+ let usePrivate = false;
3757
+ [usePrivate, params] = this.handleOptionAndParams(params, 'fetchOrderBook', 'usePrivate', false);
3758
+ if (usePrivate) {
3759
+ response = await this.v3PrivateGetBrokerageProductBook(this.extend(request, params));
3760
+ }
3761
+ else {
3762
+ response = await this.v3PublicGetBrokerageMarketProductBook(this.extend(request, params));
3763
+ }
3711
3764
  //
3712
3765
  // {
3713
3766
  // "pricebook": {
@@ -4487,6 +4540,67 @@ export default class coinbase extends Exchange {
4487
4540
  'takeProfitPrice': undefined,
4488
4541
  });
4489
4542
  }
4543
+ async fetchTradingFees(params = {}) {
4544
+ /**
4545
+ * @method
4546
+ * @name coinbase#fetchTradingFees
4547
+ * @see https://docs.cdp.coinbase.com/advanced-trade/reference/retailbrokerageapi_gettransactionsummary/
4548
+ * @description fetch the trading fees for multiple markets
4549
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
4550
+ * @param {string} [params.type] 'spot' or 'swap'
4551
+ * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
4552
+ */
4553
+ await this.loadMarkets();
4554
+ let type = undefined;
4555
+ [type, params] = this.handleMarketTypeAndParams('fetchTradingFees', undefined, params);
4556
+ const isSpot = (type === 'spot');
4557
+ const productType = isSpot ? 'SPOT' : 'FUTURE';
4558
+ const request = {
4559
+ 'product_type': productType,
4560
+ };
4561
+ const response = await this.v3PrivateGetBrokerageTransactionSummary(this.extend(request, params));
4562
+ //
4563
+ // {
4564
+ // total_volume: '0',
4565
+ // total_fees: '0',
4566
+ // fee_tier: {
4567
+ // pricing_tier: 'Advanced 1',
4568
+ // usd_from: '0',
4569
+ // usd_to: '1000',
4570
+ // taker_fee_rate: '0.008',
4571
+ // maker_fee_rate: '0.006',
4572
+ // aop_from: '',
4573
+ // aop_to: ''
4574
+ // },
4575
+ // margin_rate: null,
4576
+ // goods_and_services_tax: null,
4577
+ // advanced_trade_only_volume: '0',
4578
+ // advanced_trade_only_fees: '0',
4579
+ // coinbase_pro_volume: '0',
4580
+ // coinbase_pro_fees: '0',
4581
+ // total_balance: '',
4582
+ // has_promo_fee: false
4583
+ // }
4584
+ //
4585
+ const data = this.safeDict(response, 'fee_tier', {});
4586
+ const taker_fee = this.safeNumber(data, 'taker_fee_rate');
4587
+ const marker_fee = this.safeNumber(data, 'maker_fee_rate');
4588
+ const result = {};
4589
+ for (let i = 0; i < this.symbols.length; i++) {
4590
+ const symbol = this.symbols[i];
4591
+ const market = this.market(symbol);
4592
+ if ((isSpot && market['spot']) || (!isSpot && !market['spot'])) {
4593
+ result[symbol] = {
4594
+ 'info': response,
4595
+ 'symbol': symbol,
4596
+ 'maker': taker_fee,
4597
+ 'taker': marker_fee,
4598
+ 'percentage': true,
4599
+ };
4600
+ }
4601
+ }
4602
+ return result;
4603
+ }
4490
4604
  createAuthToken(seconds, method = undefined, url = undefined) {
4491
4605
  // it may not work for v2
4492
4606
  let uri = undefined;
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/coinbaseexchange.js';
2
- import type { Int, OrderSide, OrderType, Trade, OHLCV, Order, Balances, Str, Transaction, Ticker, OrderBook, Tickers, Strings, Market, Currency, Num, Account, Currencies, TradingFees, Dict } from './base/types.js';
2
+ import type { Int, OrderSide, OrderType, Trade, OHLCV, Order, Balances, Str, Transaction, Ticker, OrderBook, Tickers, Strings, Market, Currency, Num, Account, Currencies, TradingFees, Dict, int } from './base/types.js';
3
3
  /**
4
4
  * @class coinbaseexchange
5
5
  * @augments Exchange
@@ -76,6 +76,6 @@ export default class coinbaseexchange extends Exchange {
76
76
  body: any;
77
77
  headers: any;
78
78
  };
79
- handleErrors(code: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
79
+ handleErrors(code: int, reason: string, url: string, method: string, headers: Dict, body: string, response: any, requestHeaders: any, requestBody: any): any;
80
80
  request(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any, config?: {}): Promise<any>;
81
81
  }
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/coinbaseinternational.js';
2
- import type { Int, OrderSide, OrderType, Order, Trade, Ticker, Str, Transaction, Balances, Tickers, Strings, Market, Currency, TransferEntry, Position, FundingRateHistory, Currencies, Dict } from './base/types.js';
2
+ import type { Int, OrderSide, OrderType, Order, Trade, Ticker, Str, Transaction, Balances, Tickers, Strings, Market, Currency, TransferEntry, Position, FundingRateHistory, Currencies, Dict, int } from './base/types.js';
3
3
  /**
4
4
  * @class coinbaseinternational
5
5
  * @augments Exchange
@@ -73,11 +73,11 @@ export default class coinbaseinternational extends Exchange {
73
73
  fetchPositions(symbols?: Strings, params?: {}): Promise<Position[]>;
74
74
  fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
75
75
  fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
76
- parseTransactionStatus(status: any): string;
76
+ parseTransactionStatus(status: Str): string;
77
77
  parseTransaction(transaction: Dict, currency?: Currency): Transaction;
78
78
  parseTrade(trade: Dict, market?: Market): Trade;
79
79
  fetchMarkets(params?: {}): Promise<Market[]>;
80
- parseMarket(market: any): Market;
80
+ parseMarket(market: Dict): Market;
81
81
  fetchCurrencies(params?: {}): Promise<Currencies>;
82
82
  parseCurrency(currency: Dict): {
83
83
  id: string;
@@ -142,5 +142,5 @@ export default class coinbaseinternational extends Exchange {
142
142
  body: any;
143
143
  headers: any;
144
144
  };
145
- handleErrors(code: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
145
+ handleErrors(code: int, reason: string, url: string, method: string, headers: Dict, body: string, response: any, requestHeaders: any, requestBody: any): any;
146
146
  }
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/coincheck.js';
2
- import type { Balances, Currency, Dict, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Ticker, Trade, TradingFees, Transaction } from './base/types.js';
2
+ import type { Balances, Currency, Dict, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Ticker, Trade, TradingFees, Transaction, int } from './base/types.js';
3
3
  /**
4
4
  * @class coincheck
5
5
  * @augments Exchange
@@ -21,7 +21,7 @@ export default class coincheck extends Exchange {
21
21
  cancelOrder(id: string, symbol?: Str, params?: {}): Promise<any>;
22
22
  fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
23
23
  fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
24
- parseTransactionStatus(status: any): string;
24
+ parseTransactionStatus(status: Str): string;
25
25
  parseTransaction(transaction: Dict, currency?: Currency): Transaction;
26
26
  nonce(): number;
27
27
  sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
@@ -30,5 +30,5 @@ export default class coincheck extends Exchange {
30
30
  body: any;
31
31
  headers: any;
32
32
  };
33
- handleErrors(httpCode: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
33
+ handleErrors(httpCode: int, reason: string, url: string, method: string, headers: Dict, body: string, response: any, requestHeaders: any, requestBody: any): any;
34
34
  }
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/coinex.js';
2
- import type { Balances, Currency, FundingHistory, FundingRateHistory, Int, Market, OHLCV, Order, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, OrderRequest, TransferEntry, Leverage, Num, MarginModification, TradingFeeInterface, Currencies, TradingFees, Position, IsolatedBorrowRate, Dict, TransferEntries, LeverageTiers, LeverageTier } from './base/types.js';
2
+ import type { Balances, Currency, FundingHistory, FundingRateHistory, Int, Market, OHLCV, Order, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, OrderRequest, TransferEntry, Leverage, Num, MarginModification, TradingFeeInterface, Currencies, TradingFees, Position, IsolatedBorrowRate, Dict, TransferEntries, LeverageTiers, LeverageTier, int } from './base/types.js';
3
3
  /**
4
4
  * @class coinex
5
5
  * @augments Exchange
@@ -117,7 +117,7 @@ export default class coinex extends Exchange {
117
117
  };
118
118
  fetchFundingRates(symbols?: Strings, params?: {}): Promise<any>;
119
119
  withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
120
- parseTransactionStatus(status: any): string;
120
+ parseTransactionStatus(status: Str): string;
121
121
  fetchFundingRateHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingRateHistory[]>;
122
122
  parseTransaction(transaction: Dict, currency?: Currency): Transaction;
123
123
  transfer(code: string, amount: number, fromAccount: string, toAccount: string, params?: {}): Promise<TransferEntry>;
@@ -166,6 +166,6 @@ export default class coinex extends Exchange {
166
166
  body: any;
167
167
  headers: any;
168
168
  };
169
- handleErrors(httpCode: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
169
+ handleErrors(httpCode: int, reason: string, url: string, method: string, headers: Dict, body: string, response: any, requestHeaders: any, requestBody: any): any;
170
170
  fetchMarginAdjustmentHistory(symbol?: Str, type?: Str, since?: Num, limit?: Num, params?: {}): Promise<MarginModification[]>;
171
171
  }
package/js/src/coinex.js CHANGED
@@ -4646,7 +4646,7 @@ export default class coinex extends Exchange {
4646
4646
  * @method
4647
4647
  * @name coinex#withdraw
4648
4648
  * @description make a withdrawal
4649
- * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account015_submit_withdraw
4649
+ * @see https://docs.coinex.com/api/v2/assets/deposit-withdrawal/http/withdrawal
4650
4650
  * @param {string} code unified currency code
4651
4651
  * @param {float} amount the amount to withdraw
4652
4652
  * @param {string} address the address to withdraw to
@@ -4659,37 +4659,44 @@ export default class coinex extends Exchange {
4659
4659
  this.checkAddress(address);
4660
4660
  await this.loadMarkets();
4661
4661
  const currency = this.currency(code);
4662
- const networkCode = this.safeStringUpper(params, 'network');
4662
+ const networkCode = this.safeStringUpper2(params, 'network', 'chain');
4663
4663
  params = this.omit(params, 'network');
4664
4664
  if (tag) {
4665
4665
  address = address + ':' + tag;
4666
4666
  }
4667
4667
  const request = {
4668
- 'coin_type': currency['id'],
4669
- 'coin_address': address,
4670
- 'actual_amount': parseFloat(this.numberToString(amount)),
4671
- 'transfer_method': 'onchain', // onchain, local
4668
+ 'ccy': currency['id'],
4669
+ 'to_address': address,
4670
+ 'amount': this.numberToString(amount), // the actual amount without fees, https://www.coinex.com/fees
4672
4671
  };
4673
4672
  if (networkCode !== undefined) {
4674
- request['smart_contract_name'] = this.networkCodeToId(networkCode);
4673
+ request['chain'] = this.networkCodeToId(networkCode); // required for on-chain, not required for inter-user transfer
4675
4674
  }
4676
- const response = await this.v1PrivatePostBalanceCoinWithdraw(this.extend(request, params));
4675
+ const response = await this.v2PrivatePostAssetsWithdraw(this.extend(request, params));
4677
4676
  //
4678
4677
  // {
4679
4678
  // "code": 0,
4680
4679
  // "data": {
4681
- // "actual_amount": "1.00000000",
4682
- // "amount": "1.00000000",
4683
- // "coin_address": "1KAv3pazbTk2JnQ5xTo6fpKK7p1it2RzD4",
4684
- // "coin_type": "BCH",
4685
- // "coin_withdraw_id": 206,
4680
+ // "withdraw_id": 31193755,
4681
+ // "created_at": 1716874165038,
4682
+ // "withdraw_method": "ON_CHAIN",
4683
+ // "ccy": "USDT",
4684
+ // "amount": "17.3",
4685
+ // "actual_amount": "15",
4686
+ // "chain": "TRC20",
4687
+ // "tx_fee": "2.3",
4688
+ // "fee_asset": "USDT",
4689
+ // "fee_amount": "2.3",
4690
+ // "to_address": "TY5vq3MT6b5cQVAHWHtpGyPg1ERcQgi3UN",
4691
+ // "memo": "",
4692
+ // "tx_id": "",
4686
4693
  // "confirmations": 0,
4687
- // "create_time": 1524228297,
4688
- // "status": "audit",
4689
- // "tx_fee": "0",
4690
- // "tx_id": ""
4694
+ // "explorer_address_url": "https://tronscan.org/#/address/TY5vq3MT6b5cQVAHWHtpGyPg1ERcQgi3UN",
4695
+ // "explorer_tx_url": "https://tronscan.org/#/transaction/",
4696
+ // "remark": "",
4697
+ // "status": "audit_required"
4691
4698
  // },
4692
- // "message": "Ok"
4699
+ // "message": "OK"
4693
4700
  // }
4694
4701
  //
4695
4702
  const transaction = this.safeDict(response, 'data', {});
@@ -4800,7 +4807,7 @@ export default class coinex extends Exchange {
4800
4807
  // "remark": ""
4801
4808
  // }
4802
4809
  //
4803
- // fetchWithdrawals
4810
+ // fetchWithdrawals and withdraw
4804
4811
  //
4805
4812
  // {
4806
4813
  // "withdraw_id": 259364,
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/coinlist.js';
2
- import type { Account, Balances, Currencies, Currency, Dict, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntries, TransferEntry } from './base/types.js';
2
+ import type { Account, Balances, Currencies, Currency, Dict, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntries, TransferEntry, int } from './base/types.js';
3
3
  /**
4
4
  * @class coinlist
5
5
  * @augments Exchange
@@ -10,7 +10,7 @@ export default class coinlist extends Exchange {
10
10
  fetchTime(params?: {}): Promise<number>;
11
11
  fetchCurrencies(params?: {}): Promise<Currencies>;
12
12
  fetchMarkets(params?: {}): Promise<Market[]>;
13
- parseMarket(market: any): Market;
13
+ parseMarket(market: Dict): Market;
14
14
  fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
15
15
  fetchTicker(symbol: string, params?: {}): Promise<Ticker>;
16
16
  parseTicker(ticker: Dict, market?: Market): Ticker;
@@ -81,5 +81,5 @@ export default class coinlist extends Exchange {
81
81
  body: any;
82
82
  headers: any;
83
83
  };
84
- handleErrors(code: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
84
+ handleErrors(code: int, reason: string, url: string, method: string, headers: Dict, body: string, response: any, requestHeaders: any, requestBody: any): any;
85
85
  }
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/coinmate.js';
2
- import type { Balances, Currency, Dict, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction } from './base/types.js';
2
+ import type { Balances, Currency, Dict, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, int } from './base/types.js';
3
3
  /**
4
4
  * @class coinmate
5
5
  * @augments Exchange
@@ -14,7 +14,7 @@ export default class coinmate extends Exchange {
14
14
  fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
15
15
  parseTicker(ticker: Dict, market?: Market): Ticker;
16
16
  fetchDepositsWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
17
- parseTransactionStatus(status: any): string;
17
+ parseTransactionStatus(status: Str): string;
18
18
  parseTransaction(transaction: Dict, currency?: Currency): Transaction;
19
19
  withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
20
20
  fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
@@ -38,5 +38,5 @@ export default class coinmate extends Exchange {
38
38
  body: any;
39
39
  headers: any;
40
40
  };
41
- handleErrors(code: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
41
+ handleErrors(code: int, reason: string, url: string, method: string, headers: Dict, body: string, response: any, requestHeaders: any, requestBody: any): any;
42
42
  }
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/coinmetro.js';
2
- import { Balances, Currencies, Currency, Dict, IndexType, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade } from './base/types.js';
2
+ import { Balances, Currencies, Currency, Dict, IndexType, int, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade } from './base/types.js';
3
3
  /**
4
4
  * @class coinmetro
5
5
  * @augments Exchange
@@ -8,7 +8,7 @@ export default class coinmetro extends Exchange {
8
8
  describe(): any;
9
9
  fetchCurrencies(params?: {}): Promise<Currencies>;
10
10
  fetchMarkets(params?: {}): Promise<Market[]>;
11
- parseMarket(market: any): Market;
11
+ parseMarket(market: Dict): Market;
12
12
  parseMarketId(marketId: any): Dict;
13
13
  parseMarketPrecisionAndLimits(currencyId: any): Dict;
14
14
  fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
@@ -69,5 +69,5 @@ export default class coinmetro extends Exchange {
69
69
  body: any;
70
70
  headers: any;
71
71
  };
72
- handleErrors(code: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
72
+ handleErrors(code: int, reason: string, url: string, method: string, headers: Dict, body: string, response: any, requestHeaders: any, requestBody: any): any;
73
73
  }
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/coinone.js';
2
- import type { Balances, Currencies, Dict, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade } from './base/types.js';
2
+ import type { Balances, Currencies, Dict, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, int } from './base/types.js';
3
3
  /**
4
4
  * @class coinone
5
5
  * @augments Exchange
@@ -30,5 +30,5 @@ export default class coinone extends Exchange {
30
30
  body: any;
31
31
  headers: any;
32
32
  };
33
- handleErrors(code: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
33
+ handleErrors(code: int, reason: string, url: string, method: string, headers: Dict, body: string, response: any, requestHeaders: any, requestBody: any): any;
34
34
  }
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/coinsph.js';
2
- import type { Balances, Currency, Dict, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction } from './base/types.js';
2
+ import type { Balances, Currency, Dict, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, int } from './base/types.js';
3
3
  /**
4
4
  * @class coinsph
5
5
  * @augments Exchange
@@ -48,7 +48,7 @@ export default class coinsph extends Exchange {
48
48
  fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
49
49
  fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
50
50
  parseTransaction(transaction: Dict, currency?: Currency): Transaction;
51
- parseTransactionStatus(status: any): string;
51
+ parseTransactionStatus(status: Str): string;
52
52
  fetchDepositAddress(code: string, params?: {}): Promise<{
53
53
  currency: string;
54
54
  address: string;
@@ -71,5 +71,5 @@ export default class coinsph extends Exchange {
71
71
  body: any;
72
72
  headers: any;
73
73
  };
74
- handleErrors(code: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
74
+ handleErrors(code: int, reason: string, url: string, method: string, headers: Dict, body: string, response: any, requestHeaders: any, requestBody: any): any;
75
75
  }
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/cryptocom.js';
2
- import type { Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, Str, Ticker, OrderRequest, Balances, Transaction, OrderBook, Tickers, Strings, Currency, Market, Num, Account, CancellationRequest, Dict } from './base/types.js';
2
+ import type { Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, Str, Ticker, OrderRequest, Balances, Transaction, OrderBook, Tickers, Strings, Currency, Market, Num, Account, CancellationRequest, Dict, int } from './base/types.js';
3
3
  /**
4
4
  * @class cryptocom
5
5
  * @augments Exchange
@@ -96,5 +96,5 @@ export default class cryptocom extends Exchange {
96
96
  body: any;
97
97
  headers: any;
98
98
  };
99
- handleErrors(code: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
99
+ handleErrors(code: int, reason: string, url: string, method: string, headers: Dict, body: string, response: any, requestHeaders: any, requestBody: any): any;
100
100
  }