ccxt 4.2.71 → 4.2.73

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 (139) hide show
  1. package/README.md +124 -122
  2. package/build.sh +1 -1
  3. package/dist/ccxt.browser.js +3293 -378
  4. package/dist/ccxt.browser.min.js +4 -4
  5. package/dist/cjs/ccxt.js +6 -1
  6. package/dist/cjs/src/abstract/coinbaseinternational.js +9 -0
  7. package/dist/cjs/src/ascendex.js +149 -2
  8. package/dist/cjs/src/base/Exchange.js +30 -6
  9. package/dist/cjs/src/btcturk.js +3 -3
  10. package/dist/cjs/src/coinbaseinternational.js +2019 -0
  11. package/dist/cjs/src/gate.js +1 -1
  12. package/dist/cjs/src/hyperliquid.js +8 -2
  13. package/dist/cjs/src/mexc.js +1 -1
  14. package/dist/cjs/src/okx.js +1 -1
  15. package/dist/cjs/src/pro/bingx.js +29 -6
  16. package/dist/cjs/src/pro/coinbaseinternational.js +645 -0
  17. package/dist/cjs/src/pro/hitbtc.js +16 -7
  18. package/js/ccxt.d.ts +8 -2
  19. package/js/ccxt.js +6 -2
  20. package/js/src/abstract/coinbaseinternational.d.ts +42 -0
  21. package/js/src/abstract/coinbaseinternational.js +11 -0
  22. package/js/src/ace.d.ts +2 -2
  23. package/js/src/alpaca.d.ts +2 -2
  24. package/js/src/ascendex.d.ts +7 -3
  25. package/js/src/ascendex.js +149 -2
  26. package/js/src/base/Exchange.d.ts +81 -78
  27. package/js/src/base/Exchange.js +30 -6
  28. package/js/src/base/types.d.ts +10 -0
  29. package/js/src/bigone.d.ts +2 -2
  30. package/js/src/binance.d.ts +8 -8
  31. package/js/src/bingx.d.ts +4 -4
  32. package/js/src/bit2c.d.ts +2 -2
  33. package/js/src/bitbank.d.ts +2 -2
  34. package/js/src/bitbns.d.ts +2 -2
  35. package/js/src/bitfinex.d.ts +3 -3
  36. package/js/src/bitfinex2.d.ts +5 -5
  37. package/js/src/bitflyer.d.ts +2 -2
  38. package/js/src/bitget.d.ts +4 -4
  39. package/js/src/bithumb.d.ts +2 -2
  40. package/js/src/bitmart.d.ts +4 -4
  41. package/js/src/bitmex.d.ts +3 -3
  42. package/js/src/bitopro.d.ts +2 -2
  43. package/js/src/bitrue.d.ts +5 -5
  44. package/js/src/bitso.d.ts +2 -2
  45. package/js/src/bitstamp.d.ts +2 -2
  46. package/js/src/bitteam.d.ts +2 -2
  47. package/js/src/bitvavo.d.ts +4 -4
  48. package/js/src/bl3p.d.ts +2 -2
  49. package/js/src/blockchaincom.d.ts +2 -2
  50. package/js/src/blofin.d.ts +4 -4
  51. package/js/src/btcalpha.d.ts +2 -2
  52. package/js/src/btcbox.d.ts +2 -2
  53. package/js/src/btcmarkets.d.ts +2 -2
  54. package/js/src/btcturk.d.ts +2 -2
  55. package/js/src/btcturk.js +3 -3
  56. package/js/src/bybit.d.ts +5 -5
  57. package/js/src/cex.d.ts +4 -4
  58. package/js/src/coinbase.d.ts +3 -3
  59. package/js/src/coinbaseinternational.d.ts +146 -0
  60. package/js/src/coinbaseinternational.js +2020 -0
  61. package/js/src/coinbasepro.d.ts +2 -2
  62. package/js/src/coincheck.d.ts +2 -2
  63. package/js/src/coinex.d.ts +4 -4
  64. package/js/src/coinlist.d.ts +3 -3
  65. package/js/src/coinmate.d.ts +2 -2
  66. package/js/src/coinmetro.d.ts +2 -2
  67. package/js/src/coinone.d.ts +2 -2
  68. package/js/src/coinsph.d.ts +2 -2
  69. package/js/src/coinspot.d.ts +2 -2
  70. package/js/src/cryptocom.d.ts +4 -4
  71. package/js/src/currencycom.d.ts +2 -2
  72. package/js/src/delta.d.ts +3 -3
  73. package/js/src/deribit.d.ts +3 -3
  74. package/js/src/digifinex.d.ts +3 -3
  75. package/js/src/exmo.d.ts +3 -3
  76. package/js/src/gate.d.ts +5 -5
  77. package/js/src/gate.js +1 -1
  78. package/js/src/gemini.d.ts +2 -2
  79. package/js/src/hitbtc.d.ts +4 -4
  80. package/js/src/hollaex.d.ts +2 -2
  81. package/js/src/htx.d.ts +6 -6
  82. package/js/src/huobijp.d.ts +2 -2
  83. package/js/src/hyperliquid.d.ts +4 -3
  84. package/js/src/hyperliquid.js +9 -3
  85. package/js/src/idex.d.ts +3 -3
  86. package/js/src/independentreserve.d.ts +2 -2
  87. package/js/src/indodax.d.ts +2 -2
  88. package/js/src/kraken.d.ts +3 -3
  89. package/js/src/krakenfutures.d.ts +4 -4
  90. package/js/src/kucoin.d.ts +4 -4
  91. package/js/src/kucoinfutures.d.ts +4 -4
  92. package/js/src/kuna.d.ts +2 -2
  93. package/js/src/latoken.d.ts +2 -2
  94. package/js/src/lbank.d.ts +2 -2
  95. package/js/src/luno.d.ts +2 -2
  96. package/js/src/lykke.d.ts +2 -2
  97. package/js/src/mercado.d.ts +2 -2
  98. package/js/src/mexc.d.ts +2 -2
  99. package/js/src/mexc.js +1 -1
  100. package/js/src/ndax.d.ts +3 -3
  101. package/js/src/novadax.d.ts +2 -2
  102. package/js/src/oceanex.d.ts +2 -2
  103. package/js/src/okcoin.d.ts +3 -3
  104. package/js/src/okx.d.ts +4 -4
  105. package/js/src/okx.js +1 -1
  106. package/js/src/onetrading.d.ts +2 -2
  107. package/js/src/p2b.d.ts +2 -2
  108. package/js/src/paymium.d.ts +2 -2
  109. package/js/src/phemex.d.ts +3 -3
  110. package/js/src/poloniex.d.ts +3 -3
  111. package/js/src/poloniexfutures.d.ts +4 -4
  112. package/js/src/pro/binance.d.ts +3 -3
  113. package/js/src/pro/bingx.d.ts +1 -0
  114. package/js/src/pro/bingx.js +29 -6
  115. package/js/src/pro/bitvavo.d.ts +11 -11
  116. package/js/src/pro/bybit.d.ts +1 -1
  117. package/js/src/pro/cex.d.ts +8 -8
  118. package/js/src/pro/coinbase.d.ts +2 -2
  119. package/js/src/pro/coinbaseinternational.d.ts +28 -0
  120. package/js/src/pro/coinbaseinternational.js +646 -0
  121. package/js/src/pro/cryptocom.d.ts +2 -2
  122. package/js/src/pro/hitbtc.d.ts +2 -2
  123. package/js/src/pro/hitbtc.js +16 -7
  124. package/js/src/pro/kraken.d.ts +3 -3
  125. package/js/src/pro/okx.d.ts +3 -3
  126. package/js/src/pro/poloniex.d.ts +5 -5
  127. package/js/src/probit.d.ts +2 -2
  128. package/js/src/timex.d.ts +3 -3
  129. package/js/src/tokocrypto.d.ts +2 -2
  130. package/js/src/upbit.d.ts +2 -2
  131. package/js/src/wavesexchange.d.ts +2 -2
  132. package/js/src/wazirx.d.ts +2 -2
  133. package/js/src/whitebit.d.ts +2 -2
  134. package/js/src/woo.d.ts +5 -5
  135. package/js/src/yobit.d.ts +2 -2
  136. package/js/src/zaif.d.ts +2 -2
  137. package/js/src/zonda.d.ts +2 -2
  138. package/package.json +1 -1
  139. package/skip-tests.json +13 -0
@@ -247,7 +247,10 @@ class hitbtc extends hitbtc$1 {
247
247
  // }
248
248
  // }
249
249
  //
250
- const data = this.safeValue2(message, 'snapshot', 'update', {});
250
+ const snapshot = this.safeDict(message, 'snapshot');
251
+ const update = this.safeDict(message, 'update');
252
+ const data = snapshot ? snapshot : update;
253
+ const type = snapshot ? 'snapshot' : 'update';
251
254
  const marketIds = Object.keys(data);
252
255
  for (let i = 0; i < marketIds.length; i++) {
253
256
  const marketId = marketIds[i];
@@ -256,17 +259,23 @@ class hitbtc extends hitbtc$1 {
256
259
  const item = data[marketId];
257
260
  const messageHash = 'orderbooks::' + symbol;
258
261
  if (!(symbol in this.orderbooks)) {
259
- const subscription = this.safeValue(client.subscriptions, messageHash, {});
262
+ const subscription = this.safeDict(client.subscriptions, messageHash, {});
260
263
  const limit = this.safeInteger(subscription, 'limit');
261
264
  this.orderbooks[symbol] = this.orderBook({}, limit);
262
265
  }
266
+ const orderbook = this.orderbooks[symbol];
263
267
  const timestamp = this.safeInteger(item, 't');
264
268
  const nonce = this.safeInteger(item, 's');
265
- const orderbook = this.orderbooks[symbol];
266
- const asks = this.safeValue(item, 'a', []);
267
- const bids = this.safeValue(item, 'b', []);
268
- this.handleDeltas(orderbook['asks'], asks);
269
- this.handleDeltas(orderbook['bids'], bids);
269
+ if (type === 'snapshot') {
270
+ const parsedSnapshot = this.parseOrderBook(item, symbol, timestamp, 'b', 'a');
271
+ orderbook.reset(parsedSnapshot);
272
+ }
273
+ else {
274
+ const asks = this.safeList(item, 'a', []);
275
+ const bids = this.safeList(item, 'b', []);
276
+ this.handleDeltas(orderbook['asks'], asks);
277
+ this.handleDeltas(orderbook['bids'], bids);
278
+ }
270
279
  orderbook['timestamp'] = timestamp;
271
280
  orderbook['datetime'] = this.iso8601(timestamp);
272
281
  orderbook['nonce'] = nonce;
package/js/ccxt.d.ts CHANGED
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
4
4
  import * as errors from './src/base/errors.js';
5
5
  import type { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, Leverage, Leverages } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
7
- declare const version = "4.2.70";
7
+ declare const version = "4.2.72";
8
8
  import ace from './src/ace.js';
9
9
  import alpaca from './src/alpaca.js';
10
10
  import ascendex from './src/ascendex.js';
@@ -44,6 +44,7 @@ import btcturk from './src/btcturk.js';
44
44
  import bybit from './src/bybit.js';
45
45
  import cex from './src/cex.js';
46
46
  import coinbase from './src/coinbase.js';
47
+ import coinbaseinternational from './src/coinbaseinternational.js';
47
48
  import coinbasepro from './src/coinbasepro.js';
48
49
  import coincheck from './src/coincheck.js';
49
50
  import coinex from './src/coinex.js';
@@ -129,6 +130,7 @@ import blockchaincomPro from './src/pro/blockchaincom.js';
129
130
  import bybitPro from './src/pro/bybit.js';
130
131
  import cexPro from './src/pro/cex.js';
131
132
  import coinbasePro from './src/pro/coinbase.js';
133
+ import coinbaseinternationalPro from './src/pro/coinbaseinternational.js';
132
134
  import coinbaseproPro from './src/pro/coinbasepro.js';
133
135
  import coincheckPro from './src/pro/coincheck.js';
134
136
  import coinexPro from './src/pro/coinex.js';
@@ -208,6 +210,7 @@ declare const exchanges: {
208
210
  bybit: typeof bybit;
209
211
  cex: typeof cex;
210
212
  coinbase: typeof coinbase;
213
+ coinbaseinternational: typeof coinbaseinternational;
211
214
  coinbasepro: typeof coinbasepro;
212
215
  coincheck: typeof coincheck;
213
216
  coinex: typeof coinex;
@@ -295,6 +298,7 @@ declare const pro: {
295
298
  bybit: typeof bybitPro;
296
299
  cex: typeof cexPro;
297
300
  coinbase: typeof coinbasePro;
301
+ coinbaseinternational: typeof coinbaseinternationalPro;
298
302
  coinbasepro: typeof coinbaseproPro;
299
303
  coincheck: typeof coincheckPro;
300
304
  coinex: typeof coinexPro;
@@ -364,6 +368,7 @@ declare const ccxt: {
364
368
  bybit: typeof bybitPro;
365
369
  cex: typeof cexPro;
366
370
  coinbase: typeof coinbasePro;
371
+ coinbaseinternational: typeof coinbaseinternationalPro;
367
372
  coinbasepro: typeof coinbaseproPro;
368
373
  coincheck: typeof coincheckPro;
369
374
  coinex: typeof coinexPro;
@@ -444,6 +449,7 @@ declare const ccxt: {
444
449
  bybit: typeof bybit;
445
450
  cex: typeof cex;
446
451
  coinbase: typeof coinbase;
452
+ coinbaseinternational: typeof coinbaseinternational;
447
453
  coinbasepro: typeof coinbasepro;
448
454
  coincheck: typeof coincheck;
449
455
  coinex: typeof coinex;
@@ -507,5 +513,5 @@ declare const ccxt: {
507
513
  zaif: typeof zaif;
508
514
  zonda: typeof zonda;
509
515
  } & typeof functions & typeof errors;
510
- export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange, Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, Leverage, Leverages, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bitteam, bitvavo, bl3p, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bybit, cex, coinbase, coinbasepro, coincheck, coinex, coinlist, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, currencycom, delta, deribit, digifinex, exmo, fmfwio, gate, gateio, gemini, hitbtc, hitbtc3, hollaex, htx, huobi, huobijp, hyperliquid, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, luno, lykke, mercado, mexc, ndax, novadax, oceanex, okcoin, okx, onetrading, p2b, paymium, phemex, poloniex, poloniexfutures, probit, timex, tokocrypto, upbit, wavesexchange, wazirx, whitebit, woo, yobit, zaif, zonda, };
516
+ export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange, Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, Leverage, Leverages, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bitteam, bitvavo, bl3p, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bybit, cex, coinbase, coinbaseinternational, coinbasepro, coincheck, coinex, coinlist, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, currencycom, delta, deribit, digifinex, exmo, fmfwio, gate, gateio, gemini, hitbtc, hitbtc3, hollaex, htx, huobi, huobijp, hyperliquid, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, luno, lykke, mercado, mexc, ndax, novadax, oceanex, okcoin, okx, onetrading, p2b, paymium, phemex, poloniex, poloniexfutures, probit, timex, tokocrypto, upbit, wavesexchange, wazirx, whitebit, woo, yobit, zaif, zonda, };
511
517
  export default ccxt;
package/js/ccxt.js CHANGED
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
38
38
  import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.2.71';
41
+ const version = '4.2.73';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -80,6 +80,7 @@ import btcturk from './src/btcturk.js';
80
80
  import bybit from './src/bybit.js';
81
81
  import cex from './src/cex.js';
82
82
  import coinbase from './src/coinbase.js';
83
+ import coinbaseinternational from './src/coinbaseinternational.js';
83
84
  import coinbasepro from './src/coinbasepro.js';
84
85
  import coincheck from './src/coincheck.js';
85
86
  import coinex from './src/coinex.js';
@@ -166,6 +167,7 @@ import blockchaincomPro from './src/pro/blockchaincom.js';
166
167
  import bybitPro from './src/pro/bybit.js';
167
168
  import cexPro from './src/pro/cex.js';
168
169
  import coinbasePro from './src/pro/coinbase.js';
170
+ import coinbaseinternationalPro from './src/pro/coinbaseinternational.js';
169
171
  import coinbaseproPro from './src/pro/coinbasepro.js';
170
172
  import coincheckPro from './src/pro/coincheck.js';
171
173
  import coinexPro from './src/pro/coinex.js';
@@ -245,6 +247,7 @@ const exchanges = {
245
247
  'bybit': bybit,
246
248
  'cex': cex,
247
249
  'coinbase': coinbase,
250
+ 'coinbaseinternational': coinbaseinternational,
248
251
  'coinbasepro': coinbasepro,
249
252
  'coincheck': coincheck,
250
253
  'coinex': coinex,
@@ -332,6 +335,7 @@ const pro = {
332
335
  'bybit': bybitPro,
333
336
  'cex': cexPro,
334
337
  'coinbase': coinbasePro,
338
+ 'coinbaseinternational': coinbaseinternationalPro,
335
339
  'coinbasepro': coinbaseproPro,
336
340
  'coincheck': coincheckPro,
337
341
  'coinex': coinexPro,
@@ -384,6 +388,6 @@ pro.exchanges = Object.keys(pro);
384
388
  pro['Exchange'] = Exchange; // now the same for rest and ts
385
389
  //-----------------------------------------------------------------------------
386
390
  const ccxt = Object.assign({ version, Exchange, Precise, 'exchanges': Object.keys(exchanges), 'pro': pro }, exchanges, functions, errors);
387
- export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bitteam, bitvavo, bl3p, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bybit, cex, coinbase, coinbasepro, coincheck, coinex, coinlist, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, currencycom, delta, deribit, digifinex, exmo, fmfwio, gate, gateio, gemini, hitbtc, hitbtc3, hollaex, htx, huobi, huobijp, hyperliquid, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, luno, lykke, mercado, mexc, ndax, novadax, oceanex, okcoin, okx, onetrading, p2b, paymium, phemex, poloniex, poloniexfutures, probit, timex, tokocrypto, upbit, wavesexchange, wazirx, whitebit, woo, yobit, zaif, zonda, };
391
+ export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bitteam, bitvavo, bl3p, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bybit, cex, coinbase, coinbaseinternational, coinbasepro, coincheck, coinex, coinlist, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, currencycom, delta, deribit, digifinex, exmo, fmfwio, gate, gateio, gemini, hitbtc, hitbtc3, hollaex, htx, huobi, huobijp, hyperliquid, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, luno, lykke, mercado, mexc, ndax, novadax, oceanex, okcoin, okx, onetrading, p2b, paymium, phemex, poloniex, poloniexfutures, probit, timex, tokocrypto, upbit, wavesexchange, wazirx, whitebit, woo, yobit, zaif, zonda, };
388
392
  export default ccxt;
389
393
  //-----------------------------------------------------------------------------
@@ -0,0 +1,42 @@
1
+ import { implicitReturnType } from '../base/types.js';
2
+ import { Exchange as _Exchange } from '../base/Exchange.js';
3
+ interface Exchange {
4
+ v1PublicGetAssets(params?: {}): Promise<implicitReturnType>;
5
+ v1PublicGetAssetsAssets(params?: {}): Promise<implicitReturnType>;
6
+ v1PublicGetAssetsAssetNetworks(params?: {}): Promise<implicitReturnType>;
7
+ v1PublicGetInstruments(params?: {}): Promise<implicitReturnType>;
8
+ v1PublicGetInstrumentsInstrument(params?: {}): Promise<implicitReturnType>;
9
+ v1PublicGetInstrumentsInstrumentQuote(params?: {}): Promise<implicitReturnType>;
10
+ v1PublicGetInstrumentsInstrumentFunding(params?: {}): Promise<implicitReturnType>;
11
+ v1PublicGet(params?: {}): Promise<implicitReturnType>;
12
+ v1PrivateGetOrders(params?: {}): Promise<implicitReturnType>;
13
+ v1PrivateGetOrdersId(params?: {}): Promise<implicitReturnType>;
14
+ v1PrivateGetPortfolios(params?: {}): Promise<implicitReturnType>;
15
+ v1PrivateGetPortfoliosPortfolio(params?: {}): Promise<implicitReturnType>;
16
+ v1PrivateGetPortfoliosPortfolioDetail(params?: {}): Promise<implicitReturnType>;
17
+ v1PrivateGetPortfoliosPortfolioSummary(params?: {}): Promise<implicitReturnType>;
18
+ v1PrivateGetPortfoliosPortfolioBalances(params?: {}): Promise<implicitReturnType>;
19
+ v1PrivateGetPortfoliosPortfolioBalancesAsset(params?: {}): Promise<implicitReturnType>;
20
+ v1PrivateGetPortfoliosPortfolioPositions(params?: {}): Promise<implicitReturnType>;
21
+ v1PrivateGetPortfoliosPortfolioPositionsInstrument(params?: {}): Promise<implicitReturnType>;
22
+ v1PrivateGetPortfoliosFills(params?: {}): Promise<implicitReturnType>;
23
+ v1PrivateGetPortfoliosPortfolioFills(params?: {}): Promise<implicitReturnType>;
24
+ v1PrivateGetTransfers(params?: {}): Promise<implicitReturnType>;
25
+ v1PrivateGetTransfersTransferUuid(params?: {}): Promise<implicitReturnType>;
26
+ v1PrivatePostOrders(params?: {}): Promise<implicitReturnType>;
27
+ v1PrivatePostPortfolios(params?: {}): Promise<implicitReturnType>;
28
+ v1PrivatePostPortfoliosMargin(params?: {}): Promise<implicitReturnType>;
29
+ v1PrivatePostPortfoliosTransfer(params?: {}): Promise<implicitReturnType>;
30
+ v1PrivatePostTransfersWithdraw(params?: {}): Promise<implicitReturnType>;
31
+ v1PrivatePostTransfersAddress(params?: {}): Promise<implicitReturnType>;
32
+ v1PrivatePostTransfersCreateCounterpartyId(params?: {}): Promise<implicitReturnType>;
33
+ v1PrivatePostTransfersValidateCounterpartyId(params?: {}): Promise<implicitReturnType>;
34
+ v1PrivatePostTransfersWithdrawCounterparty(params?: {}): Promise<implicitReturnType>;
35
+ v1PrivatePutOrdersId(params?: {}): Promise<implicitReturnType>;
36
+ v1PrivatePutPortfoliosPortfolio(params?: {}): Promise<implicitReturnType>;
37
+ v1PrivateDeleteOrders(params?: {}): Promise<implicitReturnType>;
38
+ v1PrivateDeleteOrdersId(params?: {}): Promise<implicitReturnType>;
39
+ }
40
+ declare abstract class Exchange extends _Exchange {
41
+ }
42
+ export default Exchange;
@@ -0,0 +1,11 @@
1
+ // ----------------------------------------------------------------------------
2
+
3
+ // PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
4
+ // https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
+ // EDIT THE CORRESPONDENT .ts FILE INSTEAD
6
+
7
+ // -------------------------------------------------------------------------------
8
+ import { Exchange as _Exchange } from '../base/Exchange.js';
9
+ class Exchange extends _Exchange {
10
+ }
11
+ export default Exchange;
package/js/src/ace.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/ace.js';
2
- import type { Balances, Int, Market, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade } from './base/types.js';
2
+ import type { Balances, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade } from './base/types.js';
3
3
  /**
4
4
  * @class ace
5
5
  * @augments Exchange
@@ -16,7 +16,7 @@ export default class ace extends Exchange {
16
16
  fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
17
17
  parseOrderStatus(status: any): string;
18
18
  parseOrder(order: any, market?: Market): Order;
19
- createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: number, params?: {}): Promise<Order>;
19
+ createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
20
20
  cancelOrder(id: string, symbol?: Str, params?: {}): Promise<any>;
21
21
  fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
22
22
  fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/alpaca.js';
2
- import type { Int, Market, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Trade } from './base/types.js';
2
+ import type { Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Trade } from './base/types.js';
3
3
  /**
4
4
  * @class alpaca
5
5
  * @augments Exchange
@@ -13,7 +13,7 @@ export default class alpaca extends Exchange {
13
13
  fetchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
14
14
  fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
15
15
  parseOHLCV(ohlcv: any, market?: Market): OHLCV;
16
- createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: number, params?: {}): Promise<Order>;
16
+ createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
17
17
  cancelOrder(id: string, symbol?: Str, params?: {}): Promise<any>;
18
18
  cancelAllOrders(symbol?: Str, params?: {}): Promise<any>;
19
19
  fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/ascendex.js';
2
- import type { TransferEntry, FundingHistory, Int, OHLCV, Order, OrderSide, OrderType, OrderRequest, Str, Trade, Balances, Transaction, Ticker, OrderBook, Tickers, Strings, Currency, Market } from './base/types.js';
2
+ import type { TransferEntry, FundingHistory, Int, OHLCV, Order, OrderSide, OrderType, OrderRequest, Str, Trade, Balances, Transaction, Ticker, OrderBook, Tickers, Strings, Num, Currency, Market, Leverage, Leverages, MarginModes, MarginMode } from './base/types.js';
3
3
  /**
4
4
  * @class ascendex
5
5
  * @augments Exchange
@@ -31,8 +31,8 @@ export default class ascendex extends Exchange {
31
31
  parseOrderStatus(status: any): string;
32
32
  parseOrder(order: any, market?: Market): Order;
33
33
  fetchTradingFees(params?: {}): Promise<{}>;
34
- createOrderRequest(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: number, params?: {}): any;
35
- createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: number, params?: {}): Promise<Order>;
34
+ createOrderRequest(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): any;
35
+ createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
36
36
  createOrders(orders: OrderRequest[], params?: {}): Promise<Order[]>;
37
37
  fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
38
38
  fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
@@ -126,6 +126,10 @@ export default class ascendex extends Exchange {
126
126
  id: any;
127
127
  amount: number;
128
128
  };
129
+ fetchMarginModes(symbols?: string[], params?: {}): Promise<MarginModes>;
130
+ parseMarginMode(marginMode: any, market?: any): MarginMode;
131
+ fetchLeverages(symbols?: string[], params?: {}): Promise<Leverages>;
132
+ parseLeverage(leverage: any, market?: any): Leverage;
129
133
  sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
130
134
  url: string;
131
135
  method: string;
@@ -60,9 +60,11 @@ export default class ascendex extends Exchange {
60
60
  'fetchFundingRateHistory': false,
61
61
  'fetchFundingRates': true,
62
62
  'fetchIndexOHLCV': false,
63
- 'fetchLeverage': false,
63
+ 'fetchLeverage': 'emulated',
64
+ 'fetchLeverages': true,
64
65
  'fetchLeverageTiers': true,
65
- 'fetchMarginMode': false,
66
+ 'fetchMarginMode': 'emulated',
67
+ 'fetchMarginModes': true,
66
68
  'fetchMarketLeverageTiers': 'emulated',
67
69
  'fetchMarkets': true,
68
70
  'fetchMarkOHLCV': false,
@@ -3278,6 +3280,151 @@ export default class ascendex extends Exchange {
3278
3280
  'amount': this.safeNumber(income, 'paymentInUSDT'),
3279
3281
  };
3280
3282
  }
3283
+ async fetchMarginModes(symbols = undefined, params = {}) {
3284
+ /**
3285
+ * @method
3286
+ * @name ascendex#fetchMarginMode
3287
+ * @description fetches the set margin mode of the user
3288
+ * @see https://ascendex.github.io/ascendex-futures-pro-api-v2/#position
3289
+ * @param {string[]} [symbols] a list of unified market symbols
3290
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3291
+ * @returns {object} a list of [margin mode structures]{@link https://docs.ccxt.com/#/?id=margin-mode-structure}
3292
+ */
3293
+ await this.loadMarkets();
3294
+ await this.loadAccounts();
3295
+ const account = this.safeValue(this.accounts, 0, {});
3296
+ const accountGroup = this.safeString(account, 'id');
3297
+ const request = {
3298
+ 'account-group': accountGroup,
3299
+ };
3300
+ const response = await this.v2PrivateAccountGroupGetFuturesPosition(this.extend(request, params));
3301
+ //
3302
+ // {
3303
+ // "code": 0,
3304
+ // "data": {
3305
+ // "accountId": "fut2ODPhGiY71Pl4vtXnOZ00ssgD7QGn",
3306
+ // "ac": "FUTURES",
3307
+ // "collaterals": [
3308
+ // {
3309
+ // "asset": "USDT",
3310
+ // "balance": "44.570287262",
3311
+ // "referencePrice": "1",
3312
+ // "discountFactor": "1"
3313
+ // }
3314
+ // ],
3315
+ // "contracts": [
3316
+ // {
3317
+ // "symbol": "BTC-PERP",
3318
+ // "side": "LONG",
3319
+ // "position": "0.0001",
3320
+ // "referenceCost": "-3.12277254",
3321
+ // "unrealizedPnl": "-0.001700233",
3322
+ // "realizedPnl": "0",
3323
+ // "avgOpenPrice": "31209",
3324
+ // "marginType": "isolated",
3325
+ // "isolatedMargin": "1.654972977",
3326
+ // "leverage": "2",
3327
+ // "takeProfitPrice": "0",
3328
+ // "takeProfitTrigger": "market",
3329
+ // "stopLossPrice": "0",
3330
+ // "stopLossTrigger": "market",
3331
+ // "buyOpenOrderNotional": "0",
3332
+ // "sellOpenOrderNotional": "0",
3333
+ // "markPrice": "31210.723063672",
3334
+ // "indexPrice": "31223.148857925"
3335
+ // },
3336
+ // ]
3337
+ // }
3338
+ // }
3339
+ //
3340
+ const data = this.safeDict(response, 'data', {});
3341
+ const marginModes = this.safeList(data, 'contracts', []);
3342
+ return this.parseMarginModes(marginModes, symbols, 'symbol');
3343
+ }
3344
+ parseMarginMode(marginMode, market = undefined) {
3345
+ const marketId = this.safeString(marginMode, 'symbol');
3346
+ const marginType = this.safeString(marginMode, 'marginType');
3347
+ const margin = (marginType === 'crossed') ? 'cross' : 'isolated';
3348
+ return {
3349
+ 'info': marginMode,
3350
+ 'symbol': this.safeSymbol(marketId, market),
3351
+ 'marginMode': margin,
3352
+ };
3353
+ }
3354
+ async fetchLeverages(symbols = undefined, params = {}) {
3355
+ /**
3356
+ * @method
3357
+ * @name ascendex#fetchLeverages
3358
+ * @description fetch the set leverage for all contract markets
3359
+ * @see https://ascendex.github.io/ascendex-futures-pro-api-v2/#position
3360
+ * @param {string[]} [symbols] a list of unified market symbols
3361
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3362
+ * @returns {object} a list of [leverage structures]{@link https://docs.ccxt.com/#/?id=leverage-structure}
3363
+ */
3364
+ await this.loadMarkets();
3365
+ await this.loadAccounts();
3366
+ const account = this.safeValue(this.accounts, 0, {});
3367
+ const accountGroup = this.safeString(account, 'id');
3368
+ const request = {
3369
+ 'account-group': accountGroup,
3370
+ };
3371
+ const response = await this.v2PrivateAccountGroupGetFuturesPosition(this.extend(request, params));
3372
+ //
3373
+ // {
3374
+ // "code": 0,
3375
+ // "data": {
3376
+ // "accountId": "fut2ODPhGiY71Pl4vtXnOZ00ssgD7QGn",
3377
+ // "ac": "FUTURES",
3378
+ // "collaterals": [
3379
+ // {
3380
+ // "asset": "USDT",
3381
+ // "balance": "44.570287262",
3382
+ // "referencePrice": "1",
3383
+ // "discountFactor": "1"
3384
+ // }
3385
+ // ],
3386
+ // "contracts": [
3387
+ // {
3388
+ // "symbol": "BTC-PERP",
3389
+ // "side": "LONG",
3390
+ // "position": "0.0001",
3391
+ // "referenceCost": "-3.12277254",
3392
+ // "unrealizedPnl": "-0.001700233",
3393
+ // "realizedPnl": "0",
3394
+ // "avgOpenPrice": "31209",
3395
+ // "marginType": "isolated",
3396
+ // "isolatedMargin": "1.654972977",
3397
+ // "leverage": "2",
3398
+ // "takeProfitPrice": "0",
3399
+ // "takeProfitTrigger": "market",
3400
+ // "stopLossPrice": "0",
3401
+ // "stopLossTrigger": "market",
3402
+ // "buyOpenOrderNotional": "0",
3403
+ // "sellOpenOrderNotional": "0",
3404
+ // "markPrice": "31210.723063672",
3405
+ // "indexPrice": "31223.148857925"
3406
+ // },
3407
+ // ]
3408
+ // }
3409
+ // }
3410
+ //
3411
+ const data = this.safeDict(response, 'data', {});
3412
+ const leverages = this.safeList(data, 'contracts', []);
3413
+ return this.parseLeverages(leverages, symbols, 'symbol');
3414
+ }
3415
+ parseLeverage(leverage, market = undefined) {
3416
+ const marketId = this.safeString(leverage, 'symbol');
3417
+ const leverageValue = this.safeInteger(leverage, 'leverage');
3418
+ const marginType = this.safeString(leverage, 'marginType');
3419
+ const marginMode = (marginType === 'crossed') ? 'cross' : 'isolated';
3420
+ return {
3421
+ 'info': leverage,
3422
+ 'symbol': this.safeSymbol(marketId, market),
3423
+ 'marginMode': marginMode,
3424
+ 'longLeverage': leverageValue,
3425
+ 'shortLeverage': leverageValue,
3426
+ };
3427
+ }
3281
3428
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
3282
3429
  const version = api[0];
3283
3430
  const access = api[1];