ccxt 4.5.56 → 4.5.57

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 (261) hide show
  1. package/README.md +10 -9
  2. package/dist/ccxt.browser.min.js +10 -10
  3. package/dist/cjs/ccxt.js +6 -11
  4. package/dist/cjs/src/apex.js +1 -1
  5. package/dist/cjs/src/arkham.js +3 -3
  6. package/dist/cjs/src/ascendex.js +2 -2
  7. package/dist/cjs/src/aster.js +7 -4
  8. package/dist/cjs/src/backpack.js +4 -4
  9. package/dist/cjs/src/base/Exchange.js +69 -32
  10. package/dist/cjs/src/base/functions/io.js +25 -0
  11. package/dist/cjs/src/base/functions.js +1 -0
  12. package/dist/cjs/src/bigone.js +3 -3
  13. package/dist/cjs/src/binance.js +192 -194
  14. package/dist/cjs/src/bingx.js +3 -3
  15. package/dist/cjs/src/bitfinex.js +71 -58
  16. package/dist/cjs/src/bitget.js +2 -2
  17. package/dist/cjs/src/bitmart.js +13 -6
  18. package/dist/cjs/src/bitmex.js +1 -1
  19. package/dist/cjs/src/bitopro.js +1 -1
  20. package/dist/cjs/src/bitrue.js +2 -2
  21. package/dist/cjs/src/bitso.js +1 -1
  22. package/dist/cjs/src/bitstamp.js +2 -1
  23. package/dist/cjs/src/bitteam.js +1 -1
  24. package/dist/cjs/src/bittrade.js +0 -1
  25. package/dist/cjs/src/bitvavo.js +457 -34
  26. package/dist/cjs/src/blofin.js +26 -3
  27. package/dist/cjs/src/bullish.js +6 -5
  28. package/dist/cjs/src/bydfi.js +1 -1
  29. package/dist/cjs/src/cex.js +3 -3
  30. package/dist/cjs/src/coinbase.js +75 -65
  31. package/dist/cjs/src/coinbaseexchange.js +2 -2
  32. package/dist/cjs/src/coinbaseinternational.js +2 -1
  33. package/dist/cjs/src/coinex.js +74 -74
  34. package/dist/cjs/src/coinmetro.js +1 -1
  35. package/dist/cjs/src/coinsph.js +1 -1
  36. package/dist/cjs/src/cryptocom.js +46 -48
  37. package/dist/cjs/src/cryptomus.js +43 -39
  38. package/dist/cjs/src/deepcoin.js +3 -2
  39. package/dist/cjs/src/delta.js +51 -52
  40. package/dist/cjs/src/deribit.js +31 -33
  41. package/dist/cjs/src/derive.js +26 -28
  42. package/dist/cjs/src/digifinex.js +43 -44
  43. package/dist/cjs/src/exmo.js +92 -83
  44. package/dist/cjs/src/extended.js +3497 -0
  45. package/dist/cjs/src/foxbit.js +71 -75
  46. package/dist/cjs/src/gate.js +53 -53
  47. package/dist/cjs/src/gemini.js +41 -43
  48. package/dist/cjs/src/grvt.js +4 -4
  49. package/dist/cjs/src/hashkey.js +52 -54
  50. package/dist/cjs/src/hitbtc.js +3 -13
  51. package/dist/cjs/src/hollaex.js +51 -54
  52. package/dist/cjs/src/htx.js +75 -67
  53. package/dist/cjs/src/hyperliquid.js +41 -42
  54. package/dist/cjs/src/indodax.js +2 -2
  55. package/dist/cjs/src/kraken.js +57 -58
  56. package/dist/cjs/src/kucoin.js +3 -2
  57. package/dist/cjs/src/latoken.js +30 -32
  58. package/dist/cjs/src/lbank.js +56 -56
  59. package/dist/cjs/src/lighter.js +35 -37
  60. package/dist/cjs/src/luno.js +35 -43
  61. package/dist/cjs/src/mexc.js +48 -49
  62. package/dist/cjs/src/modetrade.js +50 -52
  63. package/dist/cjs/src/ndax.js +35 -37
  64. package/dist/cjs/src/okx.js +17 -2
  65. package/dist/cjs/src/onetrading.js +21 -23
  66. package/dist/cjs/src/phemex.js +43 -45
  67. package/dist/cjs/src/poloniex.js +17 -12
  68. package/dist/cjs/src/pro/alpaca.js +1 -1
  69. package/dist/cjs/src/pro/apex.js +1 -1
  70. package/dist/cjs/src/pro/arkham.js +1 -1
  71. package/dist/cjs/src/pro/backpack.js +1 -1
  72. package/dist/cjs/src/pro/binance.js +3 -3
  73. package/dist/cjs/src/pro/bitget.js +1 -1
  74. package/dist/cjs/src/pro/bithumb.js +1 -1
  75. package/dist/cjs/src/pro/bitstamp.js +1 -1
  76. package/dist/cjs/src/pro/blockchaincom.js +1 -1
  77. package/dist/cjs/src/pro/bybit.js +1 -1
  78. package/dist/cjs/src/pro/cex.js +1 -1
  79. package/dist/cjs/src/pro/coinex.js +1 -1
  80. package/dist/cjs/src/pro/coinone.js +1 -1
  81. package/dist/cjs/src/pro/cryptocom.js +3 -1
  82. package/dist/cjs/src/pro/dydx.js +1 -1
  83. package/dist/cjs/src/pro/exmo.js +1 -1
  84. package/dist/cjs/src/pro/extended.js +865 -0
  85. package/dist/cjs/src/pro/gate.js +1 -1
  86. package/dist/cjs/src/pro/independentreserve.js +1 -1
  87. package/dist/cjs/src/pro/kucoin.js +1 -1
  88. package/dist/cjs/src/pro/luno.js +3 -3
  89. package/dist/cjs/src/pro/onetrading.js +1 -1
  90. package/dist/cjs/src/pro/toobit.js +1 -1
  91. package/dist/cjs/src/pro/weex.js +1 -1
  92. package/dist/cjs/src/static_dependencies/starknet/utils/hash/classHash.js +7 -7
  93. package/dist/cjs/src/tokocrypto.js +1 -1
  94. package/dist/cjs/src/toobit.js +2 -2
  95. package/dist/cjs/src/upbit.js +3 -3
  96. package/dist/cjs/src/weex.js +57 -62
  97. package/dist/cjs/src/whitebit.js +61 -63
  98. package/dist/cjs/src/woo.js +65 -54
  99. package/dist/cjs/src/woofipro.js +53 -47
  100. package/dist/cjs/src/xt.js +1 -1
  101. package/dist/cjs/src/zebpay.js +70 -72
  102. package/js/ccxt.d.ts +8 -14
  103. package/js/ccxt.js +6 -10
  104. package/js/src/abstract/bitvavo.d.ts +15 -7
  105. package/js/src/abstract/extended.d.ts +58 -0
  106. package/js/src/apex.js +1 -1
  107. package/js/src/arkham.js +3 -3
  108. package/js/src/ascendex.js +2 -2
  109. package/js/src/aster.js +7 -4
  110. package/js/src/backpack.js +4 -4
  111. package/js/src/base/Exchange.d.ts +10 -6
  112. package/js/src/base/Exchange.js +69 -32
  113. package/js/src/base/functions/io.d.ts +7 -0
  114. package/js/src/base/functions/io.js +24 -0
  115. package/js/src/bigone.js +3 -3
  116. package/js/src/binance.d.ts +2 -0
  117. package/js/src/binance.js +196 -198
  118. package/js/src/bingx.js +3 -3
  119. package/js/src/bitfinex.d.ts +2 -0
  120. package/js/src/bitfinex.js +71 -58
  121. package/js/src/bitget.js +2 -2
  122. package/js/src/bitmart.js +13 -6
  123. package/js/src/bitmex.js +1 -1
  124. package/js/src/bitopro.js +1 -1
  125. package/js/src/bitrue.js +2 -2
  126. package/js/src/bitso.js +1 -1
  127. package/js/src/bitstamp.js +2 -1
  128. package/js/src/bitteam.js +1 -1
  129. package/js/src/bittrade.js +0 -1
  130. package/js/src/bitvavo.d.ts +114 -21
  131. package/js/src/bitvavo.js +457 -34
  132. package/js/src/blofin.d.ts +1 -0
  133. package/js/src/blofin.js +26 -3
  134. package/js/src/bullish.js +6 -5
  135. package/js/src/bydfi.js +1 -1
  136. package/js/src/cex.js +3 -3
  137. package/js/src/coinbase.d.ts +63 -56
  138. package/js/src/coinbase.js +75 -65
  139. package/js/src/coinbaseexchange.js +2 -2
  140. package/js/src/coinbaseinternational.js +2 -1
  141. package/js/src/coinex.d.ts +1 -0
  142. package/js/src/coinex.js +74 -74
  143. package/js/src/coinmetro.d.ts +1 -1
  144. package/js/src/coinmetro.js +1 -1
  145. package/js/src/coinsph.js +1 -1
  146. package/js/src/cryptocom.d.ts +1 -0
  147. package/js/src/cryptocom.js +46 -48
  148. package/js/src/cryptomus.d.ts +2 -1
  149. package/js/src/cryptomus.js +43 -39
  150. package/js/src/deepcoin.js +3 -2
  151. package/js/src/delta.d.ts +1 -0
  152. package/js/src/delta.js +51 -52
  153. package/js/src/deribit.d.ts +1 -0
  154. package/js/src/deribit.js +31 -33
  155. package/js/src/derive.d.ts +1 -0
  156. package/js/src/derive.js +26 -28
  157. package/js/src/digifinex.d.ts +1 -0
  158. package/js/src/digifinex.js +43 -44
  159. package/js/src/exmo.d.ts +1 -0
  160. package/js/src/exmo.js +92 -83
  161. package/js/src/extended.d.ts +554 -0
  162. package/js/src/extended.js +3490 -0
  163. package/js/src/foxbit.d.ts +1 -0
  164. package/js/src/foxbit.js +71 -75
  165. package/js/src/gate.d.ts +1 -0
  166. package/js/src/gate.js +53 -53
  167. package/js/src/gemini.d.ts +2 -1
  168. package/js/src/gemini.js +41 -43
  169. package/js/src/grvt.js +4 -4
  170. package/js/src/hashkey.d.ts +1 -0
  171. package/js/src/hashkey.js +52 -54
  172. package/js/src/hitbtc.d.ts +0 -1
  173. package/js/src/hitbtc.js +3 -13
  174. package/js/src/hollaex.d.ts +1 -0
  175. package/js/src/hollaex.js +51 -54
  176. package/js/src/htx.d.ts +1 -0
  177. package/js/src/htx.js +75 -67
  178. package/js/src/hyperliquid.d.ts +1 -0
  179. package/js/src/hyperliquid.js +41 -42
  180. package/js/src/indodax.js +2 -2
  181. package/js/src/kraken.d.ts +2 -1
  182. package/js/src/kraken.js +57 -58
  183. package/js/src/kucoin.js +3 -2
  184. package/js/src/latoken.d.ts +1 -0
  185. package/js/src/latoken.js +30 -32
  186. package/js/src/lbank.d.ts +1 -0
  187. package/js/src/lbank.js +56 -56
  188. package/js/src/lighter.d.ts +1 -0
  189. package/js/src/lighter.js +35 -37
  190. package/js/src/luno.d.ts +1 -0
  191. package/js/src/luno.js +35 -43
  192. package/js/src/mexc.d.ts +2 -1
  193. package/js/src/mexc.js +48 -49
  194. package/js/src/modetrade.d.ts +1 -0
  195. package/js/src/modetrade.js +50 -52
  196. package/js/src/ndax.d.ts +1 -0
  197. package/js/src/ndax.js +35 -37
  198. package/js/src/okx.js +17 -2
  199. package/js/src/onetrading.d.ts +2 -1
  200. package/js/src/onetrading.js +21 -23
  201. package/js/src/phemex.d.ts +1 -0
  202. package/js/src/phemex.js +43 -45
  203. package/js/src/poloniex.js +17 -12
  204. package/js/src/pro/alpaca.js +1 -1
  205. package/js/src/pro/apex.js +1 -1
  206. package/js/src/pro/arkham.js +1 -1
  207. package/js/src/pro/backpack.js +1 -1
  208. package/js/src/pro/binance.js +3 -3
  209. package/js/src/pro/bitget.js +1 -1
  210. package/js/src/pro/bithumb.js +1 -1
  211. package/js/src/pro/bitstamp.js +1 -1
  212. package/js/src/pro/blockchaincom.js +1 -1
  213. package/js/src/pro/bybit.js +1 -1
  214. package/js/src/pro/cex.js +1 -1
  215. package/js/src/pro/coinex.js +1 -1
  216. package/js/src/pro/coinone.js +1 -1
  217. package/js/src/pro/cryptocom.js +3 -1
  218. package/js/src/pro/dydx.js +1 -1
  219. package/js/src/pro/exmo.js +1 -1
  220. package/js/src/pro/extended.d.ts +126 -0
  221. package/js/src/pro/extended.js +858 -0
  222. package/js/src/pro/gate.js +1 -1
  223. package/js/src/pro/independentreserve.js +1 -1
  224. package/js/src/pro/kucoin.js +1 -1
  225. package/js/src/pro/luno.d.ts +1 -1
  226. package/js/src/pro/luno.js +3 -3
  227. package/js/src/pro/onetrading.js +1 -1
  228. package/js/src/pro/toobit.js +1 -1
  229. package/js/src/pro/weex.js +1 -1
  230. package/js/src/tokocrypto.js +1 -1
  231. package/js/src/toobit.js +2 -2
  232. package/js/src/upbit.js +3 -3
  233. package/js/src/weex.d.ts +1 -0
  234. package/js/src/weex.js +57 -62
  235. package/js/src/whitebit.d.ts +1 -0
  236. package/js/src/whitebit.js +61 -63
  237. package/js/src/woo.d.ts +1 -0
  238. package/js/src/woo.js +65 -54
  239. package/js/src/woofipro.d.ts +1 -0
  240. package/js/src/woofipro.js +53 -47
  241. package/js/src/xt.js +1 -1
  242. package/js/src/zebpay.d.ts +2 -1
  243. package/js/src/zebpay.js +70 -72
  244. package/package.json +7 -7
  245. package/dist/cjs/src/gateio.js +0 -18
  246. package/dist/cjs/src/oxfun.js +0 -2933
  247. package/dist/cjs/src/pro/gateio.js +0 -18
  248. package/dist/cjs/src/pro/oxfun.js +0 -1113
  249. package/js/src/abstract/gateio.d.ts +0 -346
  250. package/js/src/abstract/gateio.js +0 -5
  251. package/js/src/abstract/oxfun.d.ts +0 -37
  252. package/js/src/gateio.d.ts +0 -4
  253. package/js/src/gateio.js +0 -11
  254. package/js/src/oxfun.d.ts +0 -442
  255. package/js/src/oxfun.js +0 -2926
  256. package/js/src/pro/gateio.d.ts +0 -4
  257. package/js/src/pro/gateio.js +0 -11
  258. package/js/src/pro/oxfun.d.ts +0 -234
  259. package/js/src/pro/oxfun.js +0 -1106
  260. /package/dist/cjs/src/abstract/{oxfun.js → extended.js} +0 -0
  261. /package/js/src/abstract/{oxfun.js → extended.js} +0 -0
@@ -630,7 +630,6 @@ class modetrade extends modetrade$1["default"] {
630
630
  * @returns {object} an associative dictionary of currencies
631
631
  */
632
632
  async fetchCurrencies(params = {}) {
633
- const result = {};
634
633
  const response = await this.v1PublicGetPublicToken(params);
635
634
  //
636
635
  // {
@@ -656,66 +655,65 @@ class modetrade extends modetrade$1["default"] {
656
655
  //
657
656
  const data = this.safeDict(response, 'data', {});
658
657
  const tokenRows = this.safeList(data, 'rows', []);
659
- for (let i = 0; i < tokenRows.length; i++) {
660
- const token = tokenRows[i];
661
- const currencyId = this.safeString(token, 'token');
662
- const networks = this.safeList(token, 'chain_details');
663
- const code = this.safeCurrencyCode(currencyId);
664
- let minPrecision = undefined;
665
- const resultingNetworks = {};
666
- for (let j = 0; j < networks.length; j++) {
667
- const network = networks[j];
668
- // TODO: transform chain id to human readable name
669
- const networkId = this.safeString(network, 'chain_id');
670
- const precision = this.parsePrecision(this.safeString(network, 'decimals'));
671
- if (precision !== undefined) {
672
- minPrecision = (minPrecision === undefined) ? precision : Precise["default"].stringMin(precision, minPrecision);
673
- }
674
- resultingNetworks[networkId] = {
675
- 'id': networkId,
676
- 'network': networkId,
677
- 'limits': {
678
- 'withdraw': {
679
- 'min': undefined,
680
- 'max': undefined,
681
- },
682
- 'deposit': {
683
- 'min': undefined,
684
- 'max': undefined,
685
- },
686
- },
687
- 'active': undefined,
688
- 'deposit': undefined,
689
- 'withdraw': undefined,
690
- 'fee': this.safeNumber(network, 'withdrawal_fee'),
691
- 'precision': this.parseNumber(precision),
692
- 'info': network,
693
- };
658
+ return this.parseCurrencies(tokenRows);
659
+ }
660
+ parseCurrency(rawCurrency) {
661
+ const currencyId = this.safeString(rawCurrency, 'token');
662
+ const networks = this.safeList(rawCurrency, 'chain_details');
663
+ const code = this.safeCurrencyCode(currencyId);
664
+ let minPrecision = undefined;
665
+ const resultingNetworks = {};
666
+ for (let j = 0; j < networks.length; j++) {
667
+ const network = networks[j];
668
+ // TODO: transform chain id to human readable name
669
+ const networkId = this.safeString(network, 'chain_id');
670
+ const precision = this.parsePrecision(this.safeString(network, 'decimals'));
671
+ if (precision !== undefined) {
672
+ minPrecision = (minPrecision === undefined) ? precision : Precise["default"].stringMin(precision, minPrecision);
694
673
  }
695
- result[code] = this.safeCurrencyStructure({
696
- 'id': currencyId,
697
- 'name': currencyId,
698
- 'code': code,
699
- 'precision': this.parseNumber(minPrecision),
700
- 'active': undefined,
701
- 'fee': undefined,
702
- 'networks': resultingNetworks,
703
- 'deposit': undefined,
704
- 'withdraw': undefined,
674
+ resultingNetworks[networkId] = {
675
+ 'id': networkId,
676
+ 'network': networkId,
705
677
  'limits': {
706
- 'deposit': {
678
+ 'withdraw': {
707
679
  'min': undefined,
708
680
  'max': undefined,
709
681
  },
710
- 'withdraw': {
711
- 'min': this.safeNumber(token, 'minimum_withdraw_amount'),
682
+ 'deposit': {
683
+ 'min': undefined,
712
684
  'max': undefined,
713
685
  },
714
686
  },
715
- 'info': token,
716
- });
687
+ 'active': undefined,
688
+ 'deposit': undefined,
689
+ 'withdraw': undefined,
690
+ 'fee': this.safeNumber(network, 'withdrawal_fee'),
691
+ 'precision': this.parseNumber(precision),
692
+ 'info': network,
693
+ };
717
694
  }
718
- return result;
695
+ return this.safeCurrencyStructure({
696
+ 'id': currencyId,
697
+ 'name': currencyId,
698
+ 'code': code,
699
+ 'precision': this.parseNumber(minPrecision),
700
+ 'active': undefined,
701
+ 'fee': undefined,
702
+ 'networks': resultingNetworks,
703
+ 'deposit': undefined,
704
+ 'withdraw': undefined,
705
+ 'limits': {
706
+ 'deposit': {
707
+ 'min': undefined,
708
+ 'max': undefined,
709
+ },
710
+ 'withdraw': {
711
+ 'min': this.safeNumber(rawCurrency, 'minimum_withdraw_amount'),
712
+ 'max': undefined,
713
+ },
714
+ },
715
+ 'info': rawCurrency,
716
+ });
719
717
  }
720
718
  parseTokenAndFeeTemp(item, feeTokenKey, feeAmountKey) {
721
719
  const feeCost = this.safeString(item, feeAmountKey);
@@ -480,43 +480,41 @@ class ndax extends ndax$1["default"] {
480
480
  // },
481
481
  // ...
482
482
  //
483
- const result = {};
484
- for (let i = 0; i < response.length; i++) {
485
- const currency = response[i];
486
- const id = this.safeString(currency, 'ProductId');
487
- const code = this.safeCurrencyCode(this.safeString(currency, 'Product'));
488
- const ProductType = this.safeString(currency, 'ProductType');
489
- let type = (ProductType === 'NationalCurrency') ? 'fiat' : 'crypto';
490
- if (ProductType === 'Unknown') {
491
- // such currency is just a blanket entry
492
- type = 'other';
493
- }
494
- result[code] = this.safeCurrencyStructure({
495
- 'id': id,
496
- 'name': this.safeString(currency, 'ProductFullName'),
497
- 'code': code,
498
- 'type': type,
499
- 'precision': this.safeNumber(currency, 'TickSize'),
500
- 'info': currency,
501
- 'active': !this.safeBool(currency, 'IsDisabled'),
502
- 'deposit': this.safeBool(currency, 'DepositEnabled'),
503
- 'withdraw': this.safeBool(currency, 'WithdrawEnabled'),
504
- 'fee': undefined,
505
- 'limits': {
506
- 'amount': {
507
- 'min': undefined,
508
- 'max': undefined,
509
- },
510
- 'withdraw': {
511
- 'min': undefined,
512
- 'max': undefined,
513
- },
514
- },
515
- 'networks': {},
516
- 'margin': this.safeBool(currency, 'MarginEnabled'),
517
- });
483
+ return this.parseCurrencies(response);
484
+ }
485
+ parseCurrency(rawCurrency) {
486
+ const id = this.safeString(rawCurrency, 'ProductId');
487
+ const code = this.safeCurrencyCode(this.safeString(rawCurrency, 'Product'));
488
+ const ProductType = this.safeString(rawCurrency, 'ProductType');
489
+ let type = (ProductType === 'NationalCurrency') ? 'fiat' : 'crypto';
490
+ if (ProductType === 'Unknown') {
491
+ // such currency is just a blanket entry
492
+ type = 'other';
518
493
  }
519
- return result;
494
+ return this.safeCurrencyStructure({
495
+ 'id': id,
496
+ 'name': this.safeString(rawCurrency, 'ProductFullName'),
497
+ 'code': code,
498
+ 'type': type,
499
+ 'precision': this.safeNumber(rawCurrency, 'TickSize'),
500
+ 'info': rawCurrency,
501
+ 'active': !this.safeBool(rawCurrency, 'IsDisabled'),
502
+ 'deposit': this.safeBool(rawCurrency, 'DepositEnabled'),
503
+ 'withdraw': this.safeBool(rawCurrency, 'WithdrawEnabled'),
504
+ 'fee': undefined,
505
+ 'limits': {
506
+ 'amount': {
507
+ 'min': undefined,
508
+ 'max': undefined,
509
+ },
510
+ 'withdraw': {
511
+ 'min': undefined,
512
+ 'max': undefined,
513
+ },
514
+ },
515
+ 'networks': {},
516
+ 'margin': this.safeBool(rawCurrency, 'MarginEnabled'),
517
+ });
520
518
  }
521
519
  /**
522
520
  * @method
@@ -666,7 +664,7 @@ class ndax extends ndax$1["default"] {
666
664
  const newNonce = this.safeInteger(level, 0);
667
665
  nonce = Math.max(nonce, newNonce);
668
666
  }
669
- const bidask = this.parseBidAsk(level, priceKey, amountKey);
667
+ const bidask = this.parseOrderBookBidAsk(level, priceKey, amountKey);
670
668
  const levelSide = this.safeInteger(level, 9);
671
669
  const side = levelSide ? asksKey : bidsKey;
672
670
  const resultSide = result[side];
@@ -1517,7 +1517,18 @@ class okx extends okx$1["default"] {
1517
1517
  };
1518
1518
  }
1519
1519
  safeMarket(marketId = undefined, market = undefined, delimiter = undefined, marketType = undefined) {
1520
- const isOption = (marketId !== undefined) && ((marketId.indexOf('-C') > -1) || (marketId.indexOf('-P') > -1));
1520
+ let isOption = false;
1521
+ if (marketId !== undefined) {
1522
+ const parts = marketId.split('-');
1523
+ const partsLength = parts.length;
1524
+ // a valid OKX option ends with the call/put flag and carries expiry+strike segments,
1525
+ // e.g. the market id BTC-USD-220325-194000-P (5 parts) or the unified symbol
1526
+ // BTC/USD:USD-260611-54000-C (4 parts). Requiring more than 3 dash-separated parts avoids
1527
+ // misclassifying ordinary ids that merely contain "-C"/"-P" (such as a SPOT id like
1528
+ // "PERFTESTA-PERFTESTB") as expired options, which would crash createExpiredOptionMarket
1529
+ // on the missing expiry.
1530
+ isOption = (partsLength > 3) && (marketId.endsWith('-C') || marketId.endsWith('-P'));
1531
+ }
1521
1532
  if (isOption && !(marketId in this.markets_by_id)) {
1522
1533
  // handle expired option contracts
1523
1534
  return this.createExpiredOptionMarket(marketId);
@@ -1938,6 +1949,10 @@ class okx extends okx$1["default"] {
1938
1949
  const marketsWithoutTest = [];
1939
1950
  for (let i = 0; i < dataResponse.length; i++) {
1940
1951
  const data = dataResponse[i];
1952
+ const instId = this.safeString(data, 'instId', '');
1953
+ if (instId === '') {
1954
+ continue; // skip broken "preopen" placeholder instruments that have no instId
1955
+ }
1941
1956
  if (this.isSandboxModeEnabled) {
1942
1957
  const instFamily = this.safeString(data, 'instFamily', '');
1943
1958
  if (instFamily.startsWith('TEST')) {
@@ -9208,7 +9223,7 @@ class okx extends okx$1["default"] {
9208
9223
  request['end'] = until;
9209
9224
  }
9210
9225
  if (timeframe !== undefined) {
9211
- request['period'] = timeframe;
9226
+ request['period'] = this.safeString(this.timeframes, timeframe, timeframe);
9212
9227
  }
9213
9228
  if (since !== undefined) {
9214
9229
  request['begin'] = since;
@@ -435,29 +435,27 @@ class onetrading extends onetrading$1["default"] {
435
435
  // },
436
436
  // ]
437
437
  //
438
- const result = {};
439
- for (let i = 0; i < response.length; i++) {
440
- const currency = response[i];
441
- const id = this.safeString(currency, 'code');
442
- const code = this.safeCurrencyCode(id);
443
- result[code] = this.safeCurrencyStructure({
444
- 'id': id,
445
- 'code': code,
446
- 'name': this.safeString(currency, 'name'),
447
- 'info': currency,
448
- 'active': undefined,
449
- 'fee': undefined,
450
- 'precision': this.parseNumber(this.parsePrecision(this.safeString(currency, 'precision'))),
451
- 'withdraw': undefined,
452
- 'deposit': undefined,
453
- 'limits': {
454
- 'amount': { 'min': undefined, 'max': undefined },
455
- 'withdraw': { 'min': undefined, 'max': undefined },
456
- },
457
- 'networks': {},
458
- });
459
- }
460
- return result;
438
+ return this.parseCurrencies(response);
439
+ }
440
+ parseCurrency(rawCurrency) {
441
+ const id = this.safeString(rawCurrency, 'code');
442
+ const code = this.safeCurrencyCode(id);
443
+ return this.safeCurrencyStructure({
444
+ 'id': id,
445
+ 'code': code,
446
+ 'name': this.safeString(rawCurrency, 'name'),
447
+ 'info': rawCurrency,
448
+ 'active': undefined,
449
+ 'fee': undefined,
450
+ 'precision': this.parseNumber(this.parsePrecision(this.safeString(rawCurrency, 'precision'))),
451
+ 'withdraw': undefined,
452
+ 'deposit': undefined,
453
+ 'limits': {
454
+ 'amount': { 'min': undefined, 'max': undefined },
455
+ 'withdraw': { 'min': undefined, 'max': undefined },
456
+ },
457
+ 'networks': {},
458
+ });
461
459
  }
462
460
  /**
463
461
  * @method
@@ -1144,50 +1144,48 @@ class phemex extends phemex$1["default"] {
1144
1144
  // }
1145
1145
  const data = this.safeValue(response, 'data', {});
1146
1146
  const currencies = this.safeValue(data, 'currencies', []);
1147
- const result = {};
1148
- for (let i = 0; i < currencies.length; i++) {
1149
- const currency = currencies[i];
1150
- const id = this.safeString(currency, 'currency');
1151
- const code = this.safeCurrencyCode(id);
1152
- const valueScaleString = this.safeString(currency, 'valueScale');
1153
- const valueScale = parseInt(valueScaleString);
1154
- const minValueEv = this.safeString(currency, 'minValueEv');
1155
- const maxValueEv = this.safeString(currency, 'maxValueEv');
1156
- let minAmount = undefined;
1157
- let maxAmount = undefined;
1158
- let precision = undefined;
1159
- if (valueScale !== undefined) {
1160
- const precisionString = this.parsePrecision(valueScaleString);
1161
- precision = this.parseNumber(precisionString);
1162
- minAmount = this.parseNumber(Precise["default"].stringMul(minValueEv, precisionString));
1163
- maxAmount = this.parseNumber(Precise["default"].stringMul(maxValueEv, precisionString));
1164
- }
1165
- result[code] = this.safeCurrencyStructure({
1166
- 'id': id,
1167
- 'info': currency,
1168
- 'code': code,
1169
- 'name': this.safeString(currency, 'name'),
1170
- 'active': this.safeString(currency, 'status') === 'Listed',
1171
- 'deposit': undefined,
1172
- 'withdraw': undefined,
1173
- 'fee': undefined,
1174
- 'precision': precision,
1175
- 'limits': {
1176
- 'amount': {
1177
- 'min': minAmount,
1178
- 'max': maxAmount,
1179
- },
1180
- 'withdraw': {
1181
- 'min': undefined,
1182
- 'max': undefined,
1183
- },
1147
+ return this.parseCurrencies(currencies);
1148
+ }
1149
+ parseCurrency(rawCurrency) {
1150
+ const id = this.safeString(rawCurrency, 'currency');
1151
+ const code = this.safeCurrencyCode(id);
1152
+ const valueScaleString = this.safeString(rawCurrency, 'valueScale');
1153
+ const valueScale = parseInt(valueScaleString);
1154
+ const minValueEv = this.safeString(rawCurrency, 'minValueEv');
1155
+ const maxValueEv = this.safeString(rawCurrency, 'maxValueEv');
1156
+ let minAmount = undefined;
1157
+ let maxAmount = undefined;
1158
+ let precision = undefined;
1159
+ if (valueScale !== undefined) {
1160
+ const precisionString = this.parsePrecision(valueScaleString);
1161
+ precision = this.parseNumber(precisionString);
1162
+ minAmount = this.parseNumber(Precise["default"].stringMul(minValueEv, precisionString));
1163
+ maxAmount = this.parseNumber(Precise["default"].stringMul(maxValueEv, precisionString));
1164
+ }
1165
+ return this.safeCurrencyStructure({
1166
+ 'id': id,
1167
+ 'info': rawCurrency,
1168
+ 'code': code,
1169
+ 'name': this.safeString(rawCurrency, 'name'),
1170
+ 'active': this.safeString(rawCurrency, 'status') === 'Listed',
1171
+ 'deposit': undefined,
1172
+ 'withdraw': undefined,
1173
+ 'fee': undefined,
1174
+ 'precision': precision,
1175
+ 'limits': {
1176
+ 'amount': {
1177
+ 'min': minAmount,
1178
+ 'max': maxAmount,
1184
1179
  },
1185
- 'valueScale': valueScale,
1186
- 'networks': undefined,
1187
- 'type': 'crypto',
1188
- });
1189
- }
1190
- return result;
1180
+ 'withdraw': {
1181
+ 'min': undefined,
1182
+ 'max': undefined,
1183
+ },
1184
+ },
1185
+ 'valueScale': valueScale,
1186
+ 'networks': undefined,
1187
+ 'type': 'crypto',
1188
+ });
1191
1189
  }
1192
1190
  customParseBidAsk(bidask, priceKey = 0, amountKey = 1, market = undefined) {
1193
1191
  if (market === undefined) {
@@ -3811,7 +3809,7 @@ class phemex extends phemex$1["default"] {
3811
3809
  'txid': txid,
3812
3810
  'timestamp': timestamp,
3813
3811
  'datetime': this.iso8601(timestamp),
3814
- 'network': this.networkIdToCode(networkId),
3812
+ 'network': this.networkIdToCode(networkId, code),
3815
3813
  'address': address,
3816
3814
  'addressTo': address,
3817
3815
  'addressFrom': undefined,
@@ -5084,7 +5082,7 @@ class phemex extends phemex$1["default"] {
5084
5082
  [networkCode, params] = this.handleNetworkCodeAndParams(params);
5085
5083
  let networkId = undefined;
5086
5084
  if (networkCode !== undefined) {
5087
- networkId = this.networkCodeToId(networkCode);
5085
+ networkId = this.networkCodeToId(networkCode, code);
5088
5086
  }
5089
5087
  const stableCoins = this.safeValue(this.options, 'stableCoins');
5090
5088
  if (networkId === undefined) {
@@ -2778,14 +2778,23 @@ class poloniex extends poloniex$1["default"] {
2778
2778
  async withdraw(code, amount, address, tag = undefined, params = {}) {
2779
2779
  [tag, params] = this.handleWithdrawTagAndParams(tag, params);
2780
2780
  this.checkAddress(address);
2781
- const [request, extraParams, currency, networkEntry] = this.prepareRequestForDepositAddress(code, params);
2782
- params = extraParams;
2783
- request['amount'] = this.currencyToPrecision(code, amount);
2784
- request['address'] = address;
2781
+ const currency = this.currency(code);
2782
+ const request = {
2783
+ 'coin': currency['id'],
2784
+ 'amount': this.currencyToPrecision(code, amount),
2785
+ 'address': address,
2786
+ };
2787
+ let networkCode = undefined;
2788
+ [networkCode, params] = this.handleNetworkCodeAndParams(params);
2789
+ if (networkCode === undefined) {
2790
+ // we need to know the network to find out the currency-junction
2791
+ throw new errors.ArgumentsRequired(this.id + ' withdraw requires a network parameter for ' + code + '.');
2792
+ }
2793
+ request['network'] = this.networkCodeToId(networkCode, code);
2785
2794
  if (tag !== undefined) {
2786
2795
  request['paymentId'] = tag;
2787
2796
  }
2788
- const response = await this.privatePostWalletsWithdraw(this.extend(request, params));
2797
+ const response = await this.privatePostV2WalletsWithdraw(this.extend(request, params));
2789
2798
  //
2790
2799
  // {
2791
2800
  // "response": "Withdrew 1.00000000 USDT.",
@@ -2793,11 +2802,7 @@ class poloniex extends poloniex$1["default"] {
2793
2802
  // "withdrawalNumber": 13449869
2794
2803
  // }
2795
2804
  //
2796
- const withdrawResponse = {
2797
- 'response': response,
2798
- 'withdrawNetworkEntry': networkEntry,
2799
- };
2800
- return this.parseTransaction(withdrawResponse, currency);
2805
+ return this.parseTransaction(response, currency);
2801
2806
  }
2802
2807
  async fetchTransactionsHelper(code = undefined, since = undefined, limit = undefined, params = {}) {
2803
2808
  await this.loadMarkets();
@@ -3010,7 +3015,7 @@ class poloniex extends poloniex$1["default"] {
3010
3015
  for (let j = 0; j < childChains.length; j++) {
3011
3016
  let networkId = childChains[j];
3012
3017
  networkId = networkId.replace(code, '');
3013
- const networkCode = this.networkIdToCode(networkId);
3018
+ const networkCode = this.networkIdToCode(networkId, currency['code']);
3014
3019
  const networkInfo = this.safeValue(response, networkId);
3015
3020
  const networkObject = {};
3016
3021
  const withdrawFee = this.safeNumber(networkInfo, 'withdrawalFee');
@@ -3046,7 +3051,7 @@ class poloniex extends poloniex$1["default"] {
3046
3051
  };
3047
3052
  depositWithdrawFee['withdraw'] = withdrawResult;
3048
3053
  depositWithdrawFee['deposit'] = depositResult;
3049
- const networkCode = this.networkIdToCode(networkId);
3054
+ const networkCode = this.networkIdToCode(networkId, this.safeString(currency, 'code'));
3050
3055
  depositWithdrawFee['networks'][networkCode] = {
3051
3056
  'withdraw': withdrawResult,
3052
3057
  'deposit': depositResult,
@@ -267,7 +267,7 @@ class alpaca extends alpaca$1["default"] {
267
267
  client.resolve(orderbook, messageHash);
268
268
  }
269
269
  handleDelta(bookside, delta) {
270
- const bidAsk = this.parseBidAsk(delta, 'p', 's');
270
+ const bidAsk = this.parseOrderBookBidAsk(delta, 'p', 's');
271
271
  bookside.storeArray(bidAsk);
272
272
  }
273
273
  handleDeltas(bookside, deltas) {
@@ -341,7 +341,7 @@ class apex extends apex$1["default"] {
341
341
  client.resolve(orderbook, messageHash);
342
342
  }
343
343
  handleDelta(bookside, delta) {
344
- const bidAsk = this.parseBidAsk(delta, 0, 1);
344
+ const bidAsk = this.parseOrderBookBidAsk(delta, 0, 1);
345
345
  bookside.storeArray(bidAsk);
346
346
  }
347
347
  handleDeltas(bookside, deltas) {
@@ -297,7 +297,7 @@ class arkham extends arkham$1["default"] {
297
297
  client.resolve(this.orderbooks[symbol], messageHash);
298
298
  }
299
299
  handleDelta(bookside, delta) {
300
- const bidAsk = this.parseBidAsk(delta, 'price', 'size');
300
+ const bidAsk = this.parseOrderBookBidAsk(delta, 'price', 'size');
301
301
  bookside.storeArray(bidAsk);
302
302
  }
303
303
  /**
@@ -894,7 +894,7 @@ class backpack extends backpack$1["default"] {
894
894
  }
895
895
  handleBidAsks(bookSide, bidAsks) {
896
896
  for (let i = 0; i < bidAsks.length; i++) {
897
- const bidAsk = this.parseBidAsk(bidAsks[i]);
897
+ const bidAsk = this.parseOrderBookBidAsk(bidAsks[i]);
898
898
  bookSide.storeArray(bidAsk);
899
899
  }
900
900
  }
@@ -2244,7 +2244,7 @@ class binance extends binance$1["default"] {
2244
2244
  // "status":200,
2245
2245
  // "result":{
2246
2246
  // "symbol":"BTCUSDT",
2247
- // "price":"73178.50",
2247
+ // "price":"73178.60",
2248
2248
  // "time":1712527052374
2249
2249
  // }
2250
2250
  // }
@@ -3679,8 +3679,8 @@ class binance extends binance$1["default"] {
3679
3679
  await this.loadMarkets();
3680
3680
  const market = this.market(symbol);
3681
3681
  const type = this.getMarketType('fetchOpenOrdersWs', market, params);
3682
- if (type !== 'spot' && type !== 'future') {
3683
- throw new errors.BadRequest(this.id + ' fetchOpenOrdersWs only supports spot or swap markets');
3682
+ if (type !== 'spot') {
3683
+ throw new errors.BadRequest(this.id + ' fetchOpenOrdersWs only supports spot markets');
3684
3684
  }
3685
3685
  const url = this.urls['api']['ws']['ws-api'][type];
3686
3686
  const requestId = this.requestId(url);
@@ -942,7 +942,7 @@ class bitget extends bitget$1["default"] {
942
942
  client.reject(error, messageHash);
943
943
  }
944
944
  handleDelta(bookside, delta) {
945
- const bidAsk = this.parseBidAsk(delta, 0, 1);
945
+ const bidAsk = this.parseOrderBookBidAsk(delta, 0, 1);
946
946
  // we store the string representations in the orderbook for checksum calculation
947
947
  // this simplifies the code for generating checksums as we do not need to do any complex number transformations
948
948
  bidAsk.push(delta);
@@ -252,7 +252,7 @@ class bithumb extends bithumb$1["default"] {
252
252
  //
253
253
  const sideId = this.safeString(delta, 'orderType');
254
254
  const side = (sideId === 'bid') ? 'bids' : 'asks';
255
- const bidAsk = this.parseBidAsk(delta, 'price', 'quantity');
255
+ const bidAsk = this.parseOrderBookBidAsk(delta, 'price', 'quantity');
256
256
  const orderbookSide = orderbook[side];
257
257
  orderbookSide.storeArray(bidAsk);
258
258
  }
@@ -135,7 +135,7 @@ class bitstamp extends bitstamp$1["default"] {
135
135
  }
136
136
  handleBidAsks(bookSide, bidAsks) {
137
137
  for (let i = 0; i < bidAsks.length; i++) {
138
- const bidAsk = this.parseBidAsk(bidAsks[i]);
138
+ const bidAsk = this.parseOrderBookBidAsk(bidAsks[i]);
139
139
  bookSide.storeArray(bidAsk);
140
140
  }
141
141
  }
@@ -711,7 +711,7 @@ class blockchaincom extends blockchaincom$1["default"] {
711
711
  client.resolve(orderbook, messageHash);
712
712
  }
713
713
  handleDelta(bookside, delta) {
714
- const bookArray = this.parseBidAsk(delta, 'px', 'qty', 'num');
714
+ const bookArray = this.parseOrderBookBidAsk(delta, 'px', 'qty', 'num');
715
715
  bookside.storeArray(bookArray);
716
716
  }
717
717
  handleDeltas(bookside, deltas) {
@@ -1024,7 +1024,7 @@ class bybit extends bybit$1["default"] {
1024
1024
  }
1025
1025
  }
1026
1026
  handleDelta(bookside, delta) {
1027
- const bidAsk = this.parseBidAsk(delta, 0, 1);
1027
+ const bidAsk = this.parseOrderBookBidAsk(delta, 0, 1);
1028
1028
  bookside.storeArray(bidAsk);
1029
1029
  }
1030
1030
  handleDeltas(bookside, deltas) {
@@ -1034,7 +1034,7 @@ class cex extends cex$1["default"] {
1034
1034
  client.resolve(storedOrderBook, messageHash);
1035
1035
  }
1036
1036
  handleDelta(bookside, delta) {
1037
- const bidAsk = this.parseBidAsk(delta, 0, 1);
1037
+ const bidAsk = this.parseOrderBookBidAsk(delta, 0, 1);
1038
1038
  bookside.storeArray(bidAsk);
1039
1039
  }
1040
1040
  handleDeltas(bookside, deltas) {
@@ -814,7 +814,7 @@ class coinex extends coinex$1["default"] {
814
814
  return await this.watchOrderBookForSymbols([symbol], limit, params);
815
815
  }
816
816
  handleDelta(bookside, delta) {
817
- const bidAsk = this.parseBidAsk(delta, 0, 1);
817
+ const bidAsk = this.parseOrderBookBidAsk(delta, 0, 1);
818
818
  bookside.storeArray(bidAsk);
819
819
  }
820
820
  handleDeltas(bookside, deltas) {
@@ -126,7 +126,7 @@ class coinone extends coinone$1["default"] {
126
126
  client.resolve(orderbook, messageHash);
127
127
  }
128
128
  handleDelta(bookside, delta) {
129
- const bidAsk = this.parseBidAsk(delta, 'price', 'qty');
129
+ const bidAsk = this.parseOrderBookBidAsk(delta, 'price', 'qty');
130
130
  bookside.storeArray(bidAsk);
131
131
  }
132
132
  /**
@@ -1039,7 +1039,9 @@ class cryptocom extends cryptocom$1["default"] {
1039
1039
  }
1040
1040
  client.resolve(this.balance, messageHash);
1041
1041
  const messageHashRequest = this.safeString(message, 'id');
1042
- client.resolve(this.balance, messageHashRequest);
1042
+ if (messageHashRequest !== undefined) {
1043
+ client.resolve(this.balance, messageHashRequest);
1044
+ }
1043
1045
  }
1044
1046
  /**
1045
1047
  * @method