ccxt 4.5.55 → 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 (321) hide show
  1. package/README.md +215 -10
  2. package/dist/ccxt.browser.min.js +10 -10
  3. package/dist/cjs/ccxt.js +6 -11
  4. package/dist/cjs/src/aftermath.js +10 -5
  5. package/dist/cjs/src/alpaca.js +2 -2
  6. package/dist/cjs/src/apex.js +26 -17
  7. package/dist/cjs/src/arkham.js +10 -7
  8. package/dist/cjs/src/ascendex.js +8 -5
  9. package/dist/cjs/src/aster.js +7 -4
  10. package/dist/cjs/src/backpack.js +4 -4
  11. package/dist/cjs/src/base/Exchange.js +72 -35
  12. package/dist/cjs/src/base/functions/io.js +25 -0
  13. package/dist/cjs/src/base/functions.js +1 -0
  14. package/dist/cjs/src/bigone.js +10 -7
  15. package/dist/cjs/src/binance.js +196 -198
  16. package/dist/cjs/src/bingx.js +7 -7
  17. package/dist/cjs/src/bitfinex.js +71 -58
  18. package/dist/cjs/src/bitflyer.js +2 -1
  19. package/dist/cjs/src/bitget.js +16 -5
  20. package/dist/cjs/src/bitmart.js +18 -10
  21. package/dist/cjs/src/bitmex.js +8 -5
  22. package/dist/cjs/src/bitopro.js +2 -2
  23. package/dist/cjs/src/bitrue.js +4 -3
  24. package/dist/cjs/src/bitso.js +7 -4
  25. package/dist/cjs/src/bitstamp.js +7 -4
  26. package/dist/cjs/src/bitteam.js +1 -1
  27. package/dist/cjs/src/bittrade.js +2 -2
  28. package/dist/cjs/src/bitvavo.js +457 -34
  29. package/dist/cjs/src/blofin.js +28 -4
  30. package/dist/cjs/src/bullish.js +6 -5
  31. package/dist/cjs/src/bybit.js +19 -17
  32. package/dist/cjs/src/bybiteu.js +1 -0
  33. package/dist/cjs/src/bydfi.js +1 -1
  34. package/dist/cjs/src/cex.js +3 -3
  35. package/dist/cjs/src/coinbase.js +75 -65
  36. package/dist/cjs/src/coinbaseexchange.js +4 -3
  37. package/dist/cjs/src/coinbaseinternational.js +17 -10
  38. package/dist/cjs/src/coinex.js +79 -77
  39. package/dist/cjs/src/coinmetro.js +1 -1
  40. package/dist/cjs/src/coinsph.js +5 -5
  41. package/dist/cjs/src/cryptocom.js +52 -54
  42. package/dist/cjs/src/cryptomus.js +43 -39
  43. package/dist/cjs/src/deepcoin.js +9 -5
  44. package/dist/cjs/src/delta.js +53 -53
  45. package/dist/cjs/src/deribit.js +35 -35
  46. package/dist/cjs/src/derive.js +31 -31
  47. package/dist/cjs/src/digifinex.js +45 -45
  48. package/dist/cjs/src/exmo.js +104 -122
  49. package/dist/cjs/src/extended.js +3497 -0
  50. package/dist/cjs/src/foxbit.js +72 -76
  51. package/dist/cjs/src/gate.js +53 -53
  52. package/dist/cjs/src/gemini.js +45 -45
  53. package/dist/cjs/src/grvt.js +17 -11
  54. package/dist/cjs/src/hashkey.js +56 -58
  55. package/dist/cjs/src/hibachi.js +1 -1
  56. package/dist/cjs/src/hitbtc.js +5 -14
  57. package/dist/cjs/src/hollaex.js +51 -54
  58. package/dist/cjs/src/htx.js +84 -72
  59. package/dist/cjs/src/hyperliquid.js +60 -55
  60. package/dist/cjs/src/indodax.js +4 -3
  61. package/dist/cjs/src/kraken.js +71 -71
  62. package/dist/cjs/src/krakenfutures.js +2 -1
  63. package/dist/cjs/src/kucoin.js +3 -2
  64. package/dist/cjs/src/latoken.js +30 -32
  65. package/dist/cjs/src/lbank.js +64 -60
  66. package/dist/cjs/src/lighter.js +36 -38
  67. package/dist/cjs/src/luno.js +36 -44
  68. package/dist/cjs/src/mercado.js +2 -1
  69. package/dist/cjs/src/mexc.js +72 -63
  70. package/dist/cjs/src/modetrade.js +51 -53
  71. package/dist/cjs/src/ndax.js +35 -37
  72. package/dist/cjs/src/okx.js +23 -5
  73. package/dist/cjs/src/onetrading.js +21 -23
  74. package/dist/cjs/src/p2b.js +8 -4
  75. package/dist/cjs/src/paradex.js +3 -2
  76. package/dist/cjs/src/phemex.js +47 -47
  77. package/dist/cjs/src/poloniex.js +19 -13
  78. package/dist/cjs/src/pro/alpaca.js +1 -1
  79. package/dist/cjs/src/pro/apex.js +11 -2
  80. package/dist/cjs/src/pro/arkham.js +1 -1
  81. package/dist/cjs/src/pro/aster.js +10 -9
  82. package/dist/cjs/src/pro/backpack.js +1 -1
  83. package/dist/cjs/src/pro/binance.js +6 -6
  84. package/dist/cjs/src/pro/bingx.js +7 -2
  85. package/dist/cjs/src/pro/bitget.js +1 -1
  86. package/dist/cjs/src/pro/bithumb.js +1 -1
  87. package/dist/cjs/src/pro/bitmart.js +10 -0
  88. package/dist/cjs/src/pro/bitmex.js +1 -1
  89. package/dist/cjs/src/pro/bitstamp.js +1 -1
  90. package/dist/cjs/src/pro/blockchaincom.js +1 -1
  91. package/dist/cjs/src/pro/bybit.js +1 -1
  92. package/dist/cjs/src/pro/cex.js +1 -1
  93. package/dist/cjs/src/pro/coinex.js +1 -1
  94. package/dist/cjs/src/pro/coinone.js +1 -1
  95. package/dist/cjs/src/pro/cryptocom.js +3 -1
  96. package/dist/cjs/src/pro/dydx.js +1 -1
  97. package/dist/cjs/src/pro/exmo.js +1 -1
  98. package/dist/cjs/src/pro/extended.js +865 -0
  99. package/dist/cjs/src/pro/gate.js +1 -1
  100. package/dist/cjs/src/pro/grvt.js +8 -0
  101. package/dist/cjs/src/pro/htx.js +4 -4
  102. package/dist/cjs/src/pro/independentreserve.js +1 -1
  103. package/dist/cjs/src/pro/krakenfutures.js +16 -4
  104. package/dist/cjs/src/pro/kucoin.js +1 -1
  105. package/dist/cjs/src/pro/luno.js +3 -3
  106. package/dist/cjs/src/pro/modetrade.js +3 -3
  107. package/dist/cjs/src/pro/okx.js +4 -4
  108. package/dist/cjs/src/pro/onetrading.js +1 -1
  109. package/dist/cjs/src/pro/toobit.js +1 -1
  110. package/dist/cjs/src/pro/weex.js +1 -1
  111. package/dist/cjs/src/pro/woo.js +4 -4
  112. package/dist/cjs/src/pro/woofipro.js +3 -3
  113. package/dist/cjs/src/pro/xt.js +1 -1
  114. package/dist/cjs/src/static_dependencies/starknet/utils/hash/classHash.js +7 -7
  115. package/dist/cjs/src/tokocrypto.js +1 -1
  116. package/dist/cjs/src/toobit.js +3 -3
  117. package/dist/cjs/src/upbit.js +3 -3
  118. package/dist/cjs/src/weex.js +57 -62
  119. package/dist/cjs/src/whitebit.js +61 -63
  120. package/dist/cjs/src/woo.js +66 -55
  121. package/dist/cjs/src/woofipro.js +54 -48
  122. package/dist/cjs/src/xt.js +3 -2
  123. package/dist/cjs/src/yobit.js +4 -2
  124. package/dist/cjs/src/zebpay.js +73 -75
  125. package/js/ccxt.d.ts +8 -14
  126. package/js/ccxt.js +6 -10
  127. package/js/src/abstract/bitvavo.d.ts +15 -7
  128. package/js/src/abstract/extended.d.ts +58 -0
  129. package/js/src/abstract/mexc.d.ts +1 -0
  130. package/js/src/aftermath.js +10 -5
  131. package/js/src/alpaca.js +2 -2
  132. package/js/src/apex.d.ts +1 -1
  133. package/js/src/apex.js +26 -17
  134. package/js/src/arkham.js +10 -7
  135. package/js/src/ascendex.js +8 -5
  136. package/js/src/aster.js +7 -4
  137. package/js/src/backpack.js +4 -4
  138. package/js/src/base/Exchange.d.ts +10 -6
  139. package/js/src/base/Exchange.js +72 -35
  140. package/js/src/base/functions/io.d.ts +7 -0
  141. package/js/src/base/functions/io.js +24 -0
  142. package/js/src/bigone.js +10 -7
  143. package/js/src/binance.d.ts +2 -0
  144. package/js/src/binance.js +200 -202
  145. package/js/src/bingx.js +7 -7
  146. package/js/src/bitfinex.d.ts +2 -0
  147. package/js/src/bitfinex.js +71 -58
  148. package/js/src/bitflyer.js +2 -1
  149. package/js/src/bitget.js +16 -5
  150. package/js/src/bitmart.js +18 -10
  151. package/js/src/bitmex.js +8 -5
  152. package/js/src/bitopro.js +2 -2
  153. package/js/src/bitrue.js +4 -3
  154. package/js/src/bitso.js +7 -4
  155. package/js/src/bitstamp.js +7 -4
  156. package/js/src/bitteam.js +1 -1
  157. package/js/src/bittrade.js +2 -2
  158. package/js/src/bitvavo.d.ts +114 -21
  159. package/js/src/bitvavo.js +457 -34
  160. package/js/src/blofin.d.ts +1 -0
  161. package/js/src/blofin.js +28 -4
  162. package/js/src/bullish.js +6 -5
  163. package/js/src/bybit.d.ts +1 -1
  164. package/js/src/bybit.js +19 -17
  165. package/js/src/bybiteu.js +1 -0
  166. package/js/src/bydfi.js +1 -1
  167. package/js/src/cex.js +3 -3
  168. package/js/src/coinbase.d.ts +63 -56
  169. package/js/src/coinbase.js +75 -65
  170. package/js/src/coinbaseexchange.js +4 -3
  171. package/js/src/coinbaseinternational.d.ts +1 -1
  172. package/js/src/coinbaseinternational.js +17 -10
  173. package/js/src/coinex.d.ts +2 -1
  174. package/js/src/coinex.js +79 -77
  175. package/js/src/coinmetro.d.ts +1 -1
  176. package/js/src/coinmetro.js +1 -1
  177. package/js/src/coinsph.js +5 -5
  178. package/js/src/cryptocom.d.ts +1 -0
  179. package/js/src/cryptocom.js +52 -54
  180. package/js/src/cryptomus.d.ts +2 -1
  181. package/js/src/cryptomus.js +43 -39
  182. package/js/src/deepcoin.js +9 -5
  183. package/js/src/delta.d.ts +1 -0
  184. package/js/src/delta.js +53 -53
  185. package/js/src/deribit.d.ts +1 -0
  186. package/js/src/deribit.js +35 -35
  187. package/js/src/derive.d.ts +1 -0
  188. package/js/src/derive.js +31 -31
  189. package/js/src/digifinex.d.ts +1 -0
  190. package/js/src/digifinex.js +45 -45
  191. package/js/src/exmo.d.ts +1 -0
  192. package/js/src/exmo.js +104 -122
  193. package/js/src/extended.d.ts +554 -0
  194. package/js/src/extended.js +3490 -0
  195. package/js/src/foxbit.d.ts +1 -0
  196. package/js/src/foxbit.js +72 -76
  197. package/js/src/gate.d.ts +1 -0
  198. package/js/src/gate.js +53 -53
  199. package/js/src/gemini.d.ts +2 -1
  200. package/js/src/gemini.js +45 -45
  201. package/js/src/grvt.d.ts +1 -1
  202. package/js/src/grvt.js +17 -11
  203. package/js/src/hashkey.d.ts +1 -0
  204. package/js/src/hashkey.js +56 -58
  205. package/js/src/hibachi.d.ts +1 -1
  206. package/js/src/hibachi.js +1 -1
  207. package/js/src/hitbtc.d.ts +0 -1
  208. package/js/src/hitbtc.js +5 -14
  209. package/js/src/hollaex.d.ts +1 -0
  210. package/js/src/hollaex.js +51 -54
  211. package/js/src/htx.d.ts +1 -0
  212. package/js/src/htx.js +84 -72
  213. package/js/src/hyperliquid.d.ts +5 -4
  214. package/js/src/hyperliquid.js +60 -55
  215. package/js/src/indodax.js +4 -3
  216. package/js/src/kraken.d.ts +2 -1
  217. package/js/src/kraken.js +71 -71
  218. package/js/src/krakenfutures.js +2 -1
  219. package/js/src/kucoin.js +3 -2
  220. package/js/src/latoken.d.ts +1 -0
  221. package/js/src/latoken.js +30 -32
  222. package/js/src/lbank.d.ts +1 -0
  223. package/js/src/lbank.js +64 -60
  224. package/js/src/lighter.d.ts +2 -1
  225. package/js/src/lighter.js +36 -38
  226. package/js/src/luno.d.ts +1 -0
  227. package/js/src/luno.js +36 -44
  228. package/js/src/mercado.js +2 -1
  229. package/js/src/mexc.d.ts +4 -3
  230. package/js/src/mexc.js +72 -63
  231. package/js/src/modetrade.d.ts +1 -0
  232. package/js/src/modetrade.js +51 -53
  233. package/js/src/ndax.d.ts +1 -0
  234. package/js/src/ndax.js +35 -37
  235. package/js/src/okx.js +23 -5
  236. package/js/src/onetrading.d.ts +2 -1
  237. package/js/src/onetrading.js +21 -23
  238. package/js/src/p2b.js +8 -4
  239. package/js/src/paradex.js +3 -2
  240. package/js/src/phemex.d.ts +1 -0
  241. package/js/src/phemex.js +47 -47
  242. package/js/src/poloniex.js +19 -13
  243. package/js/src/pro/alpaca.js +1 -1
  244. package/js/src/pro/apex.js +11 -2
  245. package/js/src/pro/arkham.js +1 -1
  246. package/js/src/pro/aster.js +10 -9
  247. package/js/src/pro/backpack.js +1 -1
  248. package/js/src/pro/binance.d.ts +1 -1
  249. package/js/src/pro/binance.js +6 -6
  250. package/js/src/pro/bingx.js +7 -2
  251. package/js/src/pro/bitget.js +1 -1
  252. package/js/src/pro/bithumb.js +1 -1
  253. package/js/src/pro/bitmart.js +10 -0
  254. package/js/src/pro/bitmex.js +1 -1
  255. package/js/src/pro/bitstamp.js +1 -1
  256. package/js/src/pro/blockchaincom.js +1 -1
  257. package/js/src/pro/bybit.js +1 -1
  258. package/js/src/pro/cex.js +1 -1
  259. package/js/src/pro/coinex.js +1 -1
  260. package/js/src/pro/coinone.js +1 -1
  261. package/js/src/pro/cryptocom.js +3 -1
  262. package/js/src/pro/dydx.js +1 -1
  263. package/js/src/pro/exmo.js +1 -1
  264. package/js/src/pro/extended.d.ts +126 -0
  265. package/js/src/pro/extended.js +858 -0
  266. package/js/src/pro/gate.js +1 -1
  267. package/js/src/pro/grvt.js +8 -0
  268. package/js/src/pro/htx.d.ts +4 -4
  269. package/js/src/pro/htx.js +4 -4
  270. package/js/src/pro/independentreserve.js +1 -1
  271. package/js/src/pro/krakenfutures.d.ts +4 -4
  272. package/js/src/pro/krakenfutures.js +16 -4
  273. package/js/src/pro/kucoin.js +1 -1
  274. package/js/src/pro/luno.d.ts +1 -1
  275. package/js/src/pro/luno.js +3 -3
  276. package/js/src/pro/modetrade.d.ts +3 -3
  277. package/js/src/pro/modetrade.js +3 -3
  278. package/js/src/pro/okx.d.ts +4 -4
  279. package/js/src/pro/okx.js +4 -4
  280. package/js/src/pro/onetrading.js +1 -1
  281. package/js/src/pro/toobit.js +1 -1
  282. package/js/src/pro/weex.js +1 -1
  283. package/js/src/pro/woo.d.ts +4 -4
  284. package/js/src/pro/woo.js +4 -4
  285. package/js/src/pro/woofipro.d.ts +3 -3
  286. package/js/src/pro/woofipro.js +3 -3
  287. package/js/src/pro/xt.js +1 -1
  288. package/js/src/tokocrypto.js +1 -1
  289. package/js/src/toobit.d.ts +1 -1
  290. package/js/src/toobit.js +3 -3
  291. package/js/src/upbit.js +3 -3
  292. package/js/src/weex.d.ts +1 -0
  293. package/js/src/weex.js +57 -62
  294. package/js/src/whitebit.d.ts +1 -0
  295. package/js/src/whitebit.js +61 -63
  296. package/js/src/woo.d.ts +1 -0
  297. package/js/src/woo.js +66 -55
  298. package/js/src/woofipro.d.ts +1 -0
  299. package/js/src/woofipro.js +54 -48
  300. package/js/src/xt.js +3 -2
  301. package/js/src/yobit.js +4 -2
  302. package/js/src/zebpay.d.ts +2 -1
  303. package/js/src/zebpay.js +73 -75
  304. package/package.json +25 -11
  305. package/dist/cjs/src/gateio.js +0 -18
  306. package/dist/cjs/src/oxfun.js +0 -2931
  307. package/dist/cjs/src/pro/gateio.js +0 -18
  308. package/dist/cjs/src/pro/oxfun.js +0 -1113
  309. package/js/src/abstract/gateio.d.ts +0 -346
  310. package/js/src/abstract/gateio.js +0 -5
  311. package/js/src/abstract/oxfun.d.ts +0 -37
  312. package/js/src/gateio.d.ts +0 -4
  313. package/js/src/gateio.js +0 -11
  314. package/js/src/oxfun.d.ts +0 -442
  315. package/js/src/oxfun.js +0 -2924
  316. package/js/src/pro/gateio.d.ts +0 -4
  317. package/js/src/pro/gateio.js +0 -11
  318. package/js/src/pro/oxfun.d.ts +0 -234
  319. package/js/src/pro/oxfun.js +0 -1106
  320. /package/dist/cjs/src/abstract/{oxfun.js → extended.js} +0 -0
  321. /package/js/src/abstract/{oxfun.js → extended.js} +0 -0
package/js/src/paradex.js CHANGED
@@ -622,6 +622,7 @@ export default class paradex extends Exchange {
622
622
  else {
623
623
  expiry = undefined;
624
624
  }
625
+ const expireDatetime = (expiry === 0) ? undefined : this.iso8601(expiry);
625
626
  return this.safeMarketStructure({
626
627
  'id': marketId,
627
628
  'symbol': symbol,
@@ -645,7 +646,7 @@ export default class paradex extends Exchange {
645
646
  'maker': makerFee,
646
647
  'contractSize': this.parseNumber('1'),
647
648
  'expiry': expiry,
648
- 'expiryDatetime': (expiry === 0) ? undefined : this.iso8601(expiry),
649
+ 'expiryDatetime': expireDatetime,
649
650
  'strike': this.parseNumber(strikePrice),
650
651
  'optionType': this.safeStringLower(market, 'option_type'),
651
652
  'precision': {
@@ -1491,7 +1492,7 @@ export default class paradex extends Exchange {
1491
1492
  'GTC': 'GTC',
1492
1493
  'POST_ONLY': 'PO',
1493
1494
  };
1494
- return this.safeString(timeInForces, timeInForce, undefined);
1495
+ return this.safeString(timeInForces, timeInForce);
1495
1496
  }
1496
1497
  parseOrderStatus(status) {
1497
1498
  if (status !== undefined) {
@@ -26,6 +26,7 @@ export default class phemex extends Exchange {
26
26
  * @returns {object} an associative dictionary of currencies
27
27
  */
28
28
  fetchCurrencies(params?: {}): Promise<Currencies>;
29
+ parseCurrency(rawCurrency: Dict): Currency;
29
30
  customParseBidAsk(bidask: any, priceKey?: number, amountKey?: number, market?: Market): number[];
30
31
  customParseOrderBook(orderbook: any, symbol: any, timestamp?: any, bidsKey?: string, asksKey?: string, priceKey?: number, amountKey?: number, market?: Market): any;
31
32
  /**
package/js/src/phemex.js CHANGED
@@ -726,6 +726,7 @@ export default class phemex extends Exchange {
726
726
  // "1.0"
727
727
  contractSize = this.parseNumber(contractSizeString);
728
728
  }
729
+ const isLinear = !inverse;
729
730
  return this.safeMarketStructure({
730
731
  'id': id,
731
732
  'symbol': base + '/' + quote + ':' + settle,
@@ -743,7 +744,7 @@ export default class phemex extends Exchange {
743
744
  'option': false,
744
745
  'active': status === 'Listed',
745
746
  'contract': true,
746
- 'linear': !inverse,
747
+ 'linear': isLinear,
747
748
  'inverse': inverse,
748
749
  'taker': this.parseNumber(this.fromEn(takerFeeRateEr, ratioScale)),
749
750
  'maker': this.parseNumber(this.fromEn(makerFeeRateEr, ratioScale)),
@@ -1138,50 +1139,48 @@ export default class phemex extends Exchange {
1138
1139
  // }
1139
1140
  const data = this.safeValue(response, 'data', {});
1140
1141
  const currencies = this.safeValue(data, 'currencies', []);
1141
- const result = {};
1142
- for (let i = 0; i < currencies.length; i++) {
1143
- const currency = currencies[i];
1144
- const id = this.safeString(currency, 'currency');
1145
- const code = this.safeCurrencyCode(id);
1146
- const valueScaleString = this.safeString(currency, 'valueScale');
1147
- const valueScale = parseInt(valueScaleString);
1148
- const minValueEv = this.safeString(currency, 'minValueEv');
1149
- const maxValueEv = this.safeString(currency, 'maxValueEv');
1150
- let minAmount = undefined;
1151
- let maxAmount = undefined;
1152
- let precision = undefined;
1153
- if (valueScale !== undefined) {
1154
- const precisionString = this.parsePrecision(valueScaleString);
1155
- precision = this.parseNumber(precisionString);
1156
- minAmount = this.parseNumber(Precise.stringMul(minValueEv, precisionString));
1157
- maxAmount = this.parseNumber(Precise.stringMul(maxValueEv, precisionString));
1158
- }
1159
- result[code] = this.safeCurrencyStructure({
1160
- 'id': id,
1161
- 'info': currency,
1162
- 'code': code,
1163
- 'name': this.safeString(currency, 'name'),
1164
- 'active': this.safeString(currency, 'status') === 'Listed',
1165
- 'deposit': undefined,
1166
- 'withdraw': undefined,
1167
- 'fee': undefined,
1168
- 'precision': precision,
1169
- 'limits': {
1170
- 'amount': {
1171
- 'min': minAmount,
1172
- 'max': maxAmount,
1173
- },
1174
- 'withdraw': {
1175
- 'min': undefined,
1176
- 'max': undefined,
1177
- },
1142
+ return this.parseCurrencies(currencies);
1143
+ }
1144
+ parseCurrency(rawCurrency) {
1145
+ const id = this.safeString(rawCurrency, 'currency');
1146
+ const code = this.safeCurrencyCode(id);
1147
+ const valueScaleString = this.safeString(rawCurrency, 'valueScale');
1148
+ const valueScale = parseInt(valueScaleString);
1149
+ const minValueEv = this.safeString(rawCurrency, 'minValueEv');
1150
+ const maxValueEv = this.safeString(rawCurrency, 'maxValueEv');
1151
+ let minAmount = undefined;
1152
+ let maxAmount = undefined;
1153
+ let precision = undefined;
1154
+ if (valueScale !== undefined) {
1155
+ const precisionString = this.parsePrecision(valueScaleString);
1156
+ precision = this.parseNumber(precisionString);
1157
+ minAmount = this.parseNumber(Precise.stringMul(minValueEv, precisionString));
1158
+ maxAmount = this.parseNumber(Precise.stringMul(maxValueEv, precisionString));
1159
+ }
1160
+ return this.safeCurrencyStructure({
1161
+ 'id': id,
1162
+ 'info': rawCurrency,
1163
+ 'code': code,
1164
+ 'name': this.safeString(rawCurrency, 'name'),
1165
+ 'active': this.safeString(rawCurrency, 'status') === 'Listed',
1166
+ 'deposit': undefined,
1167
+ 'withdraw': undefined,
1168
+ 'fee': undefined,
1169
+ 'precision': precision,
1170
+ 'limits': {
1171
+ 'amount': {
1172
+ 'min': minAmount,
1173
+ 'max': maxAmount,
1178
1174
  },
1179
- 'valueScale': valueScale,
1180
- 'networks': undefined,
1181
- 'type': 'crypto',
1182
- });
1183
- }
1184
- return result;
1175
+ 'withdraw': {
1176
+ 'min': undefined,
1177
+ 'max': undefined,
1178
+ },
1179
+ },
1180
+ 'valueScale': valueScale,
1181
+ 'networks': undefined,
1182
+ 'type': 'crypto',
1183
+ });
1185
1184
  }
1186
1185
  customParseBidAsk(bidask, priceKey = 0, amountKey = 1, market = undefined) {
1187
1186
  if (market === undefined) {
@@ -3805,7 +3804,7 @@ export default class phemex extends Exchange {
3805
3804
  'txid': txid,
3806
3805
  'timestamp': timestamp,
3807
3806
  'datetime': this.iso8601(timestamp),
3808
- 'network': this.networkIdToCode(networkId),
3807
+ 'network': this.networkIdToCode(networkId, code),
3809
3808
  'address': address,
3810
3809
  'addressTo': address,
3811
3810
  'addressFrom': undefined,
@@ -4662,11 +4661,12 @@ export default class phemex extends Exchange {
4662
4661
  for (let i = 0; i < riskLimits.length; i++) {
4663
4662
  const tier = riskLimits[i];
4664
4663
  const maxNotional = this.safeInteger(tier, 'limit');
4664
+ const minNotionalResponse = minNotional; // java req
4665
4665
  tiers.push({
4666
4666
  'tier': this.sum(i, 1),
4667
4667
  'symbol': this.safeSymbol(marketId, market),
4668
4668
  'currency': market['settle'],
4669
- 'minNotional': minNotional,
4669
+ 'minNotional': minNotionalResponse,
4670
4670
  'maxNotional': maxNotional,
4671
4671
  'maintenanceMarginRate': this.safeString(tier, 'maintenanceMargin'),
4672
4672
  'maxLeverage': undefined,
@@ -5077,7 +5077,7 @@ export default class phemex extends Exchange {
5077
5077
  [networkCode, params] = this.handleNetworkCodeAndParams(params);
5078
5078
  let networkId = undefined;
5079
5079
  if (networkCode !== undefined) {
5080
- networkId = this.networkCodeToId(networkCode);
5080
+ networkId = this.networkCodeToId(networkCode, code);
5081
5081
  }
5082
5082
  const stableCoins = this.safeValue(this.options, 'stableCoins');
5083
5083
  if (networkId === undefined) {
@@ -917,6 +917,7 @@ export default class poloniex extends Exchange {
917
917
  if (alias !== undefined) {
918
918
  type = 'future';
919
919
  }
920
+ const marketType = (type === 'future') ? 'future' : 'swap';
920
921
  return {
921
922
  'id': id,
922
923
  'symbol': symbol,
@@ -926,7 +927,7 @@ export default class poloniex extends Exchange {
926
927
  'baseId': baseId,
927
928
  'quoteId': quoteId,
928
929
  'settleId': settleId,
929
- 'type': (type === 'future') ? 'future' : 'swap',
930
+ 'type': marketType,
930
931
  'spot': false,
931
932
  'margin': false,
932
933
  'swap': type === 'swap',
@@ -2772,14 +2773,23 @@ export default class poloniex extends Exchange {
2772
2773
  async withdraw(code, amount, address, tag = undefined, params = {}) {
2773
2774
  [tag, params] = this.handleWithdrawTagAndParams(tag, params);
2774
2775
  this.checkAddress(address);
2775
- const [request, extraParams, currency, networkEntry] = this.prepareRequestForDepositAddress(code, params);
2776
- params = extraParams;
2777
- request['amount'] = this.currencyToPrecision(code, amount);
2778
- request['address'] = address;
2776
+ const currency = this.currency(code);
2777
+ const request = {
2778
+ 'coin': currency['id'],
2779
+ 'amount': this.currencyToPrecision(code, amount),
2780
+ 'address': address,
2781
+ };
2782
+ let networkCode = undefined;
2783
+ [networkCode, params] = this.handleNetworkCodeAndParams(params);
2784
+ if (networkCode === undefined) {
2785
+ // we need to know the network to find out the currency-junction
2786
+ throw new ArgumentsRequired(this.id + ' withdraw requires a network parameter for ' + code + '.');
2787
+ }
2788
+ request['network'] = this.networkCodeToId(networkCode, code);
2779
2789
  if (tag !== undefined) {
2780
2790
  request['paymentId'] = tag;
2781
2791
  }
2782
- const response = await this.privatePostWalletsWithdraw(this.extend(request, params));
2792
+ const response = await this.privatePostV2WalletsWithdraw(this.extend(request, params));
2783
2793
  //
2784
2794
  // {
2785
2795
  // "response": "Withdrew 1.00000000 USDT.",
@@ -2787,11 +2797,7 @@ export default class poloniex extends Exchange {
2787
2797
  // "withdrawalNumber": 13449869
2788
2798
  // }
2789
2799
  //
2790
- const withdrawResponse = {
2791
- 'response': response,
2792
- 'withdrawNetworkEntry': networkEntry,
2793
- };
2794
- return this.parseTransaction(withdrawResponse, currency);
2800
+ return this.parseTransaction(response, currency);
2795
2801
  }
2796
2802
  async fetchTransactionsHelper(code = undefined, since = undefined, limit = undefined, params = {}) {
2797
2803
  await this.loadMarkets();
@@ -3004,7 +3010,7 @@ export default class poloniex extends Exchange {
3004
3010
  for (let j = 0; j < childChains.length; j++) {
3005
3011
  let networkId = childChains[j];
3006
3012
  networkId = networkId.replace(code, '');
3007
- const networkCode = this.networkIdToCode(networkId);
3013
+ const networkCode = this.networkIdToCode(networkId, currency['code']);
3008
3014
  const networkInfo = this.safeValue(response, networkId);
3009
3015
  const networkObject = {};
3010
3016
  const withdrawFee = this.safeNumber(networkInfo, 'withdrawalFee');
@@ -3040,7 +3046,7 @@ export default class poloniex extends Exchange {
3040
3046
  };
3041
3047
  depositWithdrawFee['withdraw'] = withdrawResult;
3042
3048
  depositWithdrawFee['deposit'] = depositResult;
3043
- const networkCode = this.networkIdToCode(networkId);
3049
+ const networkCode = this.networkIdToCode(networkId, this.safeString(currency, 'code'));
3044
3050
  depositWithdrawFee['networks'][networkCode] = {
3045
3051
  'withdraw': withdrawResult,
3046
3052
  'deposit': depositResult,
@@ -262,7 +262,7 @@ export default class alpaca extends alpacaRest {
262
262
  client.resolve(orderbook, messageHash);
263
263
  }
264
264
  handleDelta(bookside, delta) {
265
- const bidAsk = this.parseBidAsk(delta, 'p', 's');
265
+ const bidAsk = this.parseOrderBookBidAsk(delta, 'p', 's');
266
266
  bookside.storeArray(bidAsk);
267
267
  }
268
268
  handleDeltas(bookside, deltas) {
@@ -336,7 +336,7 @@ export default class apex extends apexRest {
336
336
  client.resolve(orderbook, messageHash);
337
337
  }
338
338
  handleDelta(bookside, delta) {
339
- const bidAsk = this.parseBidAsk(delta, 0, 1);
339
+ const bidAsk = this.parseOrderBookBidAsk(delta, 0, 1);
340
340
  bookside.storeArray(bidAsk);
341
341
  }
342
342
  handleDeltas(bookside, deltas) {
@@ -762,7 +762,7 @@ export default class apex extends apexRest {
762
762
  async loadPositionsSnapshot(client, messageHash) {
763
763
  // as only one ws channel gives positions for all types, for snapshot must load all positions
764
764
  const fetchFunctions = [
765
- this.fetchPositions(undefined),
765
+ this.fetchPositions(),
766
766
  ];
767
767
  const promises = await Promise.all(fetchFunctions);
768
768
  this.positions = new ArrayCacheBySymbolBySide();
@@ -932,6 +932,15 @@ export default class apex extends apexRest {
932
932
  const ret_msg = this.safeString(message, 'ret_msg');
933
933
  const request = this.safeValue(message, 'request', {});
934
934
  const op = this.safeString(request, 'op');
935
+ // Benign re-subscribe notice (same shape as bitmart 90008 /
936
+ // krakenfutures "Already subscribed"): the original subscription
937
+ // is still active and delivering data on this socket. Without
938
+ // this short-circuit the catch-clause's `client.reject(error,
939
+ // messageHash)` rejects every in-flight future on the connection
940
+ // because apex doesn't echo a `reqId` on these warnings.
941
+ if (ret_msg !== undefined && ret_msg.indexOf('already subscribed') >= 0) {
942
+ return false;
943
+ }
935
944
  if (op === 'auth') {
936
945
  throw new AuthenticationError('Authentication failed: ' + ret_msg);
937
946
  }
@@ -292,7 +292,7 @@ export default class arkham extends arkhamRest {
292
292
  client.resolve(this.orderbooks[symbol], messageHash);
293
293
  }
294
294
  handleDelta(bookside, delta) {
295
- const bidAsk = this.parseBidAsk(delta, 'price', 'size');
295
+ const bidAsk = this.parseOrderBookBidAsk(delta, 'price', 'size');
296
296
  bookside.storeArray(bidAsk);
297
297
  }
298
298
  /**
@@ -372,13 +372,11 @@ export default class aster extends asterRest {
372
372
  }
373
373
  parseWsTicker(message, marketType) {
374
374
  const event = this.safeString(message, 'e');
375
- const part = event.split('@');
376
- const channel = this.safeString(part, 1);
377
375
  const marketId = this.safeString(message, 's');
378
376
  const timestamp = this.safeInteger(message, 'E');
379
377
  const market = this.safeMarket(marketId, undefined, undefined, marketType);
380
378
  const last = this.safeString(message, 'c');
381
- if (channel === 'markPriceUpdate') {
379
+ if (event === 'markPriceUpdate') {
382
380
  return this.safeTicker({
383
381
  'symbol': market['symbol'],
384
382
  'timestamp': timestamp,
@@ -1198,7 +1196,12 @@ export default class aster extends asterRest {
1198
1196
  return;
1199
1197
  }
1200
1198
  try {
1201
- await this.sapiPrivatePutV3ListenKey(); // extend the expiry
1199
+ if (type === 'spot') {
1200
+ await this.sapiPrivatePutV3ListenKey(); // extend the expiry
1201
+ }
1202
+ else {
1203
+ await this.fapiPrivatePutV3ListenKey(); // extend the expiry
1204
+ }
1202
1205
  }
1203
1206
  catch (error) {
1204
1207
  const url = this.urls['api']['ws']['private'][type] + '/' + listenKey;
@@ -1875,13 +1878,11 @@ export default class aster extends asterRest {
1875
1878
  const messageInner = this.safeDict(message, 'data', message); // can be either wrapped in 'data' or full object itself
1876
1879
  const event = this.safeString(messageInner, 'e');
1877
1880
  const methods = {
1878
- 'ticker': this.handleTicker,
1881
+ '24hrTicker': this.handleTicker,
1879
1882
  'aggTrade': this.handleTrade,
1880
- 'depth5': this.handleOrderBook,
1881
- 'depth10': this.handleOrderBook,
1882
- 'depth20': this.handleOrderBook,
1883
+ 'depthUpdate': this.handleOrderBook,
1883
1884
  'kline': this.handleOHLCV,
1884
- 'markPrice': this.handleTicker,
1885
+ 'markPriceUpdate': this.handleTicker,
1885
1886
  'bookTicker': this.handleBidAsk,
1886
1887
  'outboundAccountPosition': this.handleBalance,
1887
1888
  'ACCOUNT_UPDATE': this.handleBalanceAndPosition,
@@ -889,7 +889,7 @@ export default class backpack extends backpackRest {
889
889
  }
890
890
  handleBidAsks(bookSide, bidAsks) {
891
891
  for (let i = 0; i < bidAsks.length; i++) {
892
- const bidAsk = this.parseBidAsk(bidAsks[i]);
892
+ const bidAsk = this.parseOrderBookBidAsk(bidAsks[i]);
893
893
  bookSide.storeArray(bidAsk);
894
894
  }
895
895
  }
@@ -597,7 +597,7 @@ export default class binance extends binanceRest {
597
597
  /**
598
598
  * @name binance#ensureUserDataStreamWsSubscribeSignature
599
599
  * @description watches best bid & ask for symbols
600
- * @param marketType {string} only support on 'spot'
600
+ * @param {string} [marketType] only supports 'spot'
601
601
  * @see {@link https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/user-data-stream-requests#subscribe-to-user-data-stream-through-signature-subscription-user_data Binance User Data Stream Documentation}
602
602
  * @returns Promise<number> The subscription ID for the user data stream
603
603
  */
@@ -1499,7 +1499,7 @@ export default class binance extends binanceRest {
1499
1499
  }
1500
1500
  const isSpot = (type === 'spot');
1501
1501
  let timezone = undefined;
1502
- [timezone, params] = this.handleParamString(params, 'timezone', undefined);
1502
+ [timezone, params] = this.handleParamString(params, 'timezone');
1503
1503
  const isUtc8 = (timezone !== undefined) && ((timezone === '+08:00') || Precise.stringEq(timezone, '8'));
1504
1504
  const rawHashes = [];
1505
1505
  const messageHashes = [];
@@ -1564,7 +1564,7 @@ export default class binance extends binanceRest {
1564
1564
  }
1565
1565
  const isSpot = (type === 'spot');
1566
1566
  let timezone = undefined;
1567
- [timezone, params] = this.handleParamString(params, 'timezone', undefined);
1567
+ [timezone, params] = this.handleParamString(params, 'timezone');
1568
1568
  const isUtc8 = (timezone !== undefined) && ((timezone === '+08:00') || Precise.stringEq(timezone, '8'));
1569
1569
  const rawHashes = [];
1570
1570
  const subMessageHashes = [];
@@ -2239,7 +2239,7 @@ export default class binance extends binanceRest {
2239
2239
  // "status":200,
2240
2240
  // "result":{
2241
2241
  // "symbol":"BTCUSDT",
2242
- // "price":"73178.50",
2242
+ // "price":"73178.60",
2243
2243
  // "time":1712527052374
2244
2244
  // }
2245
2245
  // }
@@ -2402,7 +2402,7 @@ export default class binance extends binanceRest {
2402
2402
  /**
2403
2403
  * @name binance#ensureUserDataStreamWsSubscribeSignature
2404
2404
  * @description watches best bid & ask for symbols
2405
- * @param marketType {string} only support on 'spot'
2405
+ * @param {string} [marketType] only supports 'spot'
2406
2406
  * @see {@link https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/user-data-stream-requests#subscribe-to-user-data-stream-through-signature-subscription-user_data Binance User Data Stream Documentation}
2407
2407
  * @returns Promise<number> The subscription ID for the user data stream
2408
2408
  */
@@ -3674,8 +3674,8 @@ export default class binance extends binanceRest {
3674
3674
  await this.loadMarkets();
3675
3675
  const market = this.market(symbol);
3676
3676
  const type = this.getMarketType('fetchOpenOrdersWs', market, params);
3677
- if (type !== 'spot' && type !== 'future') {
3678
- throw new BadRequest(this.id + ' fetchOpenOrdersWs only supports spot or swap markets');
3677
+ if (type !== 'spot') {
3678
+ throw new BadRequest(this.id + ' fetchOpenOrdersWs only supports spot markets');
3679
3679
  }
3680
3680
  const url = this.urls['api']['ws']['ws-api'][type];
3681
3681
  const requestId = this.requestId(url);
@@ -691,7 +691,9 @@ export default class bingx extends bingxRest {
691
691
  // const limit = [ 5, 10, 20, 50, 100 ]
692
692
  const subscriptionHash = dataType;
693
693
  const subscription = client.subscriptions[subscriptionHash];
694
- const limit = this.safeInteger(subscription, 'limit');
694
+ // see handleOHLCV — subscription.limit may be missing for non-orderbook callers;
695
+ // default to a reasonable depth instead of throwing NPE in the Java port.
696
+ const limit = this.safeInteger(subscription, 'limit', 100);
695
697
  this.orderbooks[symbol] = this.orderBook({}, limit);
696
698
  }
697
699
  orderbook = this.orderbooks[symbol];
@@ -837,7 +839,10 @@ export default class bingx extends bingxRest {
837
839
  if (this.safeValue(this.ohlcvs[symbol], rawTimeframe) === undefined) {
838
840
  const subscriptionHash = dataType;
839
841
  const subscription = client.subscriptions[subscriptionHash];
840
- const limit = this.safeInteger(subscription, 'limit');
842
+ // subscription.limit is only set when watchOHLCV registers the subscription;
843
+ // when handleMessage routes a non-OHLCV-originated subscription here (or the
844
+ // subscription dict was reset on reconnect), fall back to the OHLCVLimit option.
845
+ const limit = this.safeInteger(subscription, 'limit', this.safeInteger(this.options, 'OHLCVLimit', 1000));
841
846
  this.ohlcvs[symbol][unifiedTimeframe] = new ArrayCacheByTimestamp(limit);
842
847
  }
843
848
  const stored = this.ohlcvs[symbol][unifiedTimeframe];
@@ -943,7 +943,7 @@ export default class bitget extends bitgetRest {
943
943
  client.reject(error, messageHash);
944
944
  }
945
945
  handleDelta(bookside, delta) {
946
- const bidAsk = this.parseBidAsk(delta, 0, 1);
946
+ const bidAsk = this.parseOrderBookBidAsk(delta, 0, 1);
947
947
  // we store the string representations in the orderbook for checksum calculation
948
948
  // this simplifies the code for generating checksums as we do not need to do any complex number transformations
949
949
  bidAsk.push(delta);
@@ -247,7 +247,7 @@ export default class bithumb extends bithumbRest {
247
247
  //
248
248
  const sideId = this.safeString(delta, 'orderType');
249
249
  const side = (sideId === 'bid') ? 'bids' : 'asks';
250
- const bidAsk = this.parseBidAsk(delta, 'price', 'quantity');
250
+ const bidAsk = this.parseOrderBookBidAsk(delta, 'price', 'quantity');
251
251
  const orderbookSide = orderbook[side];
252
252
  orderbookSide.storeArray(bidAsk);
253
253
  }
@@ -1869,6 +1869,16 @@ export default class bitmart extends bitmartRest {
1869
1869
  //
1870
1870
  const errorCode = this.safeString(message, 'errorCode');
1871
1871
  const error = this.safeString(message, 'error');
1872
+ // Duplicate-subscription notice errorCode 90008: bitmart's WS rejects
1873
+ // a re-subscribe attempt on a topic that's already active on this
1874
+ // connection, but the original subscription keeps delivering data —
1875
+ // so treat it as benign. Without this short-circuit, the generic
1876
+ // client.reject below kills every unrelated in-flight future —
1877
+ // e.g. a watchOHLCV waiting on its kline subscription gets rejected
1878
+ // by an orderbook 90008 raised on the same socket.
1879
+ if (errorCode === '90008') {
1880
+ return false;
1881
+ }
1872
1882
  try {
1873
1883
  if (errorCode !== undefined || error !== undefined) {
1874
1884
  const feedback = this.id + ' ' + this.json(message);
@@ -1592,7 +1592,7 @@ export default class bitmex extends bitmexRest {
1592
1592
  if (!(marketId in numUpdatesByMarketId)) {
1593
1593
  numUpdatesByMarketId[marketId] = 0;
1594
1594
  }
1595
- numUpdatesByMarketId[marketId] = this.sum(numUpdatesByMarketId, 1);
1595
+ numUpdatesByMarketId[marketId] = this.sum(numUpdatesByMarketId[marketId], 1);
1596
1596
  const market = this.safeMarket(marketId);
1597
1597
  const symbol = market['symbol'];
1598
1598
  const orderbook = this.orderbooks[symbol];
@@ -130,7 +130,7 @@ export default class bitstamp extends bitstampRest {
130
130
  }
131
131
  handleBidAsks(bookSide, bidAsks) {
132
132
  for (let i = 0; i < bidAsks.length; i++) {
133
- const bidAsk = this.parseBidAsk(bidAsks[i]);
133
+ const bidAsk = this.parseOrderBookBidAsk(bidAsks[i]);
134
134
  bookSide.storeArray(bidAsk);
135
135
  }
136
136
  }
@@ -706,7 +706,7 @@ export default class blockchaincom extends blockchaincomRest {
706
706
  client.resolve(orderbook, messageHash);
707
707
  }
708
708
  handleDelta(bookside, delta) {
709
- const bookArray = this.parseBidAsk(delta, 'px', 'qty', 'num');
709
+ const bookArray = this.parseOrderBookBidAsk(delta, 'px', 'qty', 'num');
710
710
  bookside.storeArray(bookArray);
711
711
  }
712
712
  handleDeltas(bookside, deltas) {
@@ -1019,7 +1019,7 @@ export default class bybit extends bybitRest {
1019
1019
  }
1020
1020
  }
1021
1021
  handleDelta(bookside, delta) {
1022
- const bidAsk = this.parseBidAsk(delta, 0, 1);
1022
+ const bidAsk = this.parseOrderBookBidAsk(delta, 0, 1);
1023
1023
  bookside.storeArray(bidAsk);
1024
1024
  }
1025
1025
  handleDeltas(bookside, deltas) {
package/js/src/pro/cex.js CHANGED
@@ -1029,7 +1029,7 @@ export default class cex extends cexRest {
1029
1029
  client.resolve(storedOrderBook, messageHash);
1030
1030
  }
1031
1031
  handleDelta(bookside, delta) {
1032
- const bidAsk = this.parseBidAsk(delta, 0, 1);
1032
+ const bidAsk = this.parseOrderBookBidAsk(delta, 0, 1);
1033
1033
  bookside.storeArray(bidAsk);
1034
1034
  }
1035
1035
  handleDeltas(bookside, deltas) {
@@ -809,7 +809,7 @@ export default class coinex extends coinexRest {
809
809
  return await this.watchOrderBookForSymbols([symbol], limit, params);
810
810
  }
811
811
  handleDelta(bookside, delta) {
812
- const bidAsk = this.parseBidAsk(delta, 0, 1);
812
+ const bidAsk = this.parseOrderBookBidAsk(delta, 0, 1);
813
813
  bookside.storeArray(bidAsk);
814
814
  }
815
815
  handleDeltas(bookside, deltas) {
@@ -121,7 +121,7 @@ export default class coinone extends coinoneRest {
121
121
  client.resolve(orderbook, messageHash);
122
122
  }
123
123
  handleDelta(bookside, delta) {
124
- const bidAsk = this.parseBidAsk(delta, 'price', 'qty');
124
+ const bidAsk = this.parseOrderBookBidAsk(delta, 'price', 'qty');
125
125
  bookside.storeArray(bidAsk);
126
126
  }
127
127
  /**
@@ -1034,7 +1034,9 @@ export default class cryptocom extends cryptocomRest {
1034
1034
  }
1035
1035
  client.resolve(this.balance, messageHash);
1036
1036
  const messageHashRequest = this.safeString(message, 'id');
1037
- client.resolve(this.balance, messageHashRequest);
1037
+ if (messageHashRequest !== undefined) {
1038
+ client.resolve(this.balance, messageHashRequest);
1039
+ }
1038
1040
  }
1039
1041
  /**
1040
1042
  * @method
@@ -240,7 +240,7 @@ export default class dydx extends dydxRest {
240
240
  bookside.store(price, amount);
241
241
  }
242
242
  else {
243
- const bidAsk = this.parseBidAsk(delta, 'price', 'size');
243
+ const bidAsk = this.parseOrderBookBidAsk(delta, 'price', 'size');
244
244
  bookside.storeArray(bidAsk);
245
245
  }
246
246
  }
@@ -561,7 +561,7 @@ export default class exmo extends exmoRest {
561
561
  client.resolve(orderbook, messageHash);
562
562
  }
563
563
  handleDelta(bookside, delta) {
564
- const bidAsk = this.parseBidAsk(delta, 0, 1);
564
+ const bidAsk = this.parseOrderBookBidAsk(delta, 0, 1);
565
565
  bookside.storeArray(bidAsk);
566
566
  }
567
567
  handleDeltas(bookside, deltas) {