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/lbank.js CHANGED
@@ -448,66 +448,65 @@ export default class lbank extends Exchange {
448
448
  //
449
449
  const currenciesData = this.safeList(response, 'data', []);
450
450
  const grouped = this.groupBy(currenciesData, 'assetCode');
451
- const groupedKeys = Object.keys(grouped);
452
- const result = {};
453
- for (let i = 0; i < groupedKeys.length; i++) {
454
- const id = (groupedKeys[i]).toString(); // some currencies are numeric
455
- const code = this.safeCurrencyCode(id);
456
- const networksRaw = grouped[id];
457
- const networks = {};
458
- for (let j = 0; j < networksRaw.length; j++) {
459
- const networkEntry = networksRaw[j];
460
- let networkId = this.safeString(networkEntry, 'chain');
461
- if (networkId === undefined) {
462
- networkId = this.safeString(networkEntry, 'assetCode'); // use type as fallback if networkId is not present
463
- }
464
- const networkCode = this.networkIdToCode(networkId);
465
- networks[networkCode] = {
466
- 'id': networkId,
467
- 'network': networkCode,
468
- 'limits': {
469
- 'withdraw': {
470
- 'min': this.safeNumber(networkEntry, 'min'),
471
- 'max': undefined,
472
- },
473
- 'deposit': {
474
- 'min': this.safeNumber(networkEntry, 'minTransfer'),
475
- 'max': undefined,
476
- },
477
- },
478
- 'active': undefined,
479
- 'deposit': undefined,
480
- 'withdraw': this.safeBool(networkEntry, 'canWithDraw'),
481
- 'fee': this.safeNumber(networkEntry, 'fee'),
482
- 'precision': this.parseNumber(this.parsePrecision(this.safeString(networkEntry, 'transferAmtScale'))),
483
- 'info': networkEntry,
484
- };
451
+ const values = Object.values(grouped);
452
+ return this.parseCurrencies(values);
453
+ }
454
+ parseCurrency(rawCurrency) {
455
+ const id = this.safeString(rawCurrency[0], 'assetCode'); // first member is guaranteed
456
+ const code = this.safeCurrencyCode(id);
457
+ const networksRaw = rawCurrency;
458
+ const networks = {};
459
+ for (let j = 0; j < networksRaw.length; j++) {
460
+ const networkEntry = networksRaw[j];
461
+ let networkId = this.safeString(networkEntry, 'chain');
462
+ if (networkId === undefined) {
463
+ networkId = this.safeString(networkEntry, 'assetCode'); // use type as fallback if networkId is not present
485
464
  }
486
- result[code] = this.safeCurrencyStructure({
487
- 'id': id,
488
- 'code': code,
489
- 'precision': undefined,
490
- 'type': undefined,
491
- 'name': undefined,
492
- 'active': undefined,
493
- 'deposit': undefined,
494
- 'withdraw': undefined,
495
- 'fee': undefined,
465
+ const networkCode = this.networkIdToCode(networkId, code);
466
+ networks[networkCode] = {
467
+ 'id': networkId,
468
+ 'network': networkCode,
496
469
  'limits': {
497
470
  'withdraw': {
498
- 'min': undefined,
471
+ 'min': this.safeNumber(networkEntry, 'min'),
499
472
  'max': undefined,
500
473
  },
501
474
  'deposit': {
502
- 'min': undefined,
475
+ 'min': this.safeNumber(networkEntry, 'minTransfer'),
503
476
  'max': undefined,
504
477
  },
505
478
  },
506
- 'networks': networks,
507
- 'info': networksRaw,
508
- });
479
+ 'active': undefined,
480
+ 'deposit': undefined,
481
+ 'withdraw': this.safeBool(networkEntry, 'canWithDraw'),
482
+ 'fee': this.safeNumber(networkEntry, 'fee'),
483
+ 'precision': this.parseNumber(this.parsePrecision(this.safeString(networkEntry, 'transferAmtScale'))),
484
+ 'info': networkEntry,
485
+ };
509
486
  }
510
- return result;
487
+ return this.safeCurrencyStructure({
488
+ 'id': id,
489
+ 'code': code,
490
+ 'precision': undefined,
491
+ 'type': undefined,
492
+ 'name': undefined,
493
+ 'active': undefined,
494
+ 'deposit': undefined,
495
+ 'withdraw': undefined,
496
+ 'fee': undefined,
497
+ 'limits': {
498
+ 'withdraw': {
499
+ 'min': undefined,
500
+ 'max': undefined,
501
+ },
502
+ 'deposit': {
503
+ 'min': undefined,
504
+ 'max': undefined,
505
+ },
506
+ },
507
+ 'networks': networks,
508
+ 'info': networksRaw,
509
+ });
511
510
  }
512
511
  /**
513
512
  * @method
@@ -1055,9 +1054,10 @@ export default class lbank extends Exchange {
1055
1054
  let fee = undefined;
1056
1055
  const feeCost = this.safeString(trade, 'tradeFee');
1057
1056
  if (feeCost !== undefined) {
1057
+ const feeCurr = (side === 'buy') ? market['base'] : market['quote'];
1058
1058
  fee = {
1059
1059
  'cost': feeCost,
1060
- 'currency': (side === 'buy') ? market['base'] : market['quote'],
1060
+ 'currency': feeCurr,
1061
1061
  'rate': this.safeString(trade, 'tradeFeeRate'),
1062
1062
  };
1063
1063
  }
@@ -1180,11 +1180,13 @@ export default class lbank extends Exchange {
1180
1180
  const duration = this.parseTimeframe(timeframe);
1181
1181
  since = this.milliseconds() - (duration * 1000 * limit);
1182
1182
  }
1183
+ const parsedSince = this.parseToInt(since / 1000);
1184
+ const parsedLimit = Math.min(limit + 1, 2000); // max 2000;
1183
1185
  const request = {
1184
1186
  'symbol': market['id'],
1185
1187
  'type': this.safeString(this.timeframes, timeframe, timeframe),
1186
- 'time': this.parseToInt(since / 1000),
1187
- 'size': Math.min(limit + 1, 2000), // max 2000
1188
+ 'time': parsedSince,
1189
+ 'size': parsedLimit,
1188
1190
  };
1189
1191
  const response = await this.spotPublicGetKline(this.extend(request, params));
1190
1192
  const ohlcvs = this.safeList(response, 'data', []);
@@ -2267,7 +2269,7 @@ export default class lbank extends Exchange {
2267
2269
  return {
2268
2270
  'info': response,
2269
2271
  'currency': code,
2270
- 'network': this.networkIdToCode(this.safeString(result, 'netWork')),
2272
+ 'network': this.networkIdToCode(this.safeString(result, 'netWork'), code),
2271
2273
  'address': address,
2272
2274
  'tag': tag,
2273
2275
  };
@@ -2456,7 +2458,7 @@ export default class lbank extends Exchange {
2456
2458
  'txid': txid,
2457
2459
  'timestamp': timestamp,
2458
2460
  'datetime': this.iso8601(timestamp),
2459
- 'network': this.networkIdToCode(this.safeString(transaction, 'networkName')),
2461
+ 'network': this.networkIdToCode(this.safeString(transaction, 'networkName'), code),
2460
2462
  'address': address,
2461
2463
  'addressTo': addressTo,
2462
2464
  'addressFrom': addressFrom,
@@ -2661,7 +2663,7 @@ export default class lbank extends Exchange {
2661
2663
  const networkEntry = networkList[j];
2662
2664
  const fee = this.safeNumber(networkEntry, 'withdrawFee');
2663
2665
  if (fee !== undefined) {
2664
- const networkCode = this.networkIdToCode(this.safeString(networkEntry, 'name'));
2666
+ const networkCode = this.networkIdToCode(this.safeString(networkEntry, 'name'), code);
2665
2667
  withdrawFees[code][networkCode] = fee;
2666
2668
  }
2667
2669
  }
@@ -2713,7 +2715,7 @@ export default class lbank extends Exchange {
2713
2715
  if (canWithdraw === 'true') {
2714
2716
  const currencyId = this.safeString(item, 'assetCode');
2715
2717
  const codeInner = this.safeCurrencyCode(currencyId);
2716
- let network = this.networkIdToCode(this.safeString(item, 'chain'));
2718
+ let network = this.networkIdToCode(this.safeString(item, 'chain'), codeInner);
2717
2719
  if (network === undefined) {
2718
2720
  network = codeInner;
2719
2721
  }
@@ -2864,7 +2866,7 @@ export default class lbank extends Exchange {
2864
2866
  const resultCodeInfo = result[code]['info'];
2865
2867
  resultCodeInfo.push(fee);
2866
2868
  }
2867
- const networkCode = this.networkIdToCode(this.safeString(fee, 'chain'));
2869
+ const networkCode = this.networkIdToCode(this.safeString(fee, 'chain'), code);
2868
2870
  if (networkCode !== undefined) {
2869
2871
  result[code]['networks'][networkCode] = {
2870
2872
  'withdraw': {
@@ -2917,10 +2919,11 @@ export default class lbank extends Exchange {
2917
2919
  // }
2918
2920
  //
2919
2921
  const result = this.depositWithdrawFee(fee);
2922
+ const code = this.safeString(currency, 'code');
2920
2923
  const networkList = this.safeValue(fee, 'networkList', []);
2921
2924
  for (let j = 0; j < networkList.length; j++) {
2922
2925
  const networkEntry = networkList[j];
2923
- const networkCode = this.networkIdToCode(this.safeString(networkEntry, 'name'));
2926
+ const networkCode = this.networkIdToCode(this.safeString(networkEntry, 'name'), code);
2924
2927
  const withdrawFee = this.safeNumber(networkEntry, 'withdrawFee');
2925
2928
  const isDefault = this.safeValue(networkEntry, 'isDefault');
2926
2929
  if (withdrawFee !== undefined) {
@@ -2973,9 +2976,10 @@ export default class lbank extends Exchange {
2973
2976
  else {
2974
2977
  signatureMethod = 'HmacSHA256';
2975
2978
  }
2979
+ const finalSig = signatureMethod; // java req
2976
2980
  const auth = this.rawencode(this.keysort(this.extend({
2977
2981
  'echostr': echostr,
2978
- 'signature_method': signatureMethod,
2982
+ 'signature_method': finalSig,
2979
2983
  'timestamp': timestamp,
2980
2984
  }, query)));
2981
2985
  const encoded = this.encode(auth);
@@ -13,7 +13,7 @@ export default class lighter extends Exchange {
13
13
  * @method
14
14
  * @name lighter#preLoadLighterLibrary
15
15
  * @description if the required credentials are available in options, it will pre-load the lighter Signer to avoid delaying sensitive calls like createOrder the first time they're executed
16
- * @param params
16
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
17
17
  * @returns {boolean} true if the signer was loaded, false otherwise
18
18
  */
19
19
  preLoadLighterLibrary(params?: {}): Promise<boolean>;
@@ -110,6 +110,7 @@ export default class lighter extends Exchange {
110
110
  * @returns {object} an associative dictionary of currencies
111
111
  */
112
112
  fetchCurrencies(params?: {}): Promise<Currencies>;
113
+ parseCurrency(rawCurrency: Dict): Currency;
113
114
  /**
114
115
  * @method
115
116
  * @name lighter#fetchOrderBook
package/js/src/lighter.js CHANGED
@@ -438,7 +438,7 @@ export default class lighter extends Exchange {
438
438
  * @method
439
439
  * @name lighter#preLoadLighterLibrary
440
440
  * @description if the required credentials are available in options, it will pre-load the lighter Signer to avoid delaying sensitive calls like createOrder the first time they're executed
441
- * @param params
441
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
442
442
  * @returns {boolean} true if the signer was loaded, false otherwise
443
443
  */
444
444
  async preLoadLighterLibrary(params = {}) {
@@ -1270,44 +1270,42 @@ export default class lighter extends Exchange {
1270
1270
  // }
1271
1271
  //
1272
1272
  const data = this.safeList(response, 'asset_details', []);
1273
- const result = {};
1274
- for (let i = 0; i < data.length; i++) {
1275
- const entry = data[i];
1276
- const id = this.safeString(entry, 'asset_id');
1277
- const code = this.safeCurrencyCode(this.safeString(entry, 'symbol'));
1278
- const decimals = this.safeString(entry, 'decimals');
1279
- const isUSDC = (code === 'USDC');
1280
- let depositMin = undefined;
1281
- let withdrawMin = undefined;
1282
- if (isUSDC) {
1283
- depositMin = this.safeNumber(entry, 'min_transfer_amount');
1284
- withdrawMin = this.safeNumber(entry, 'min_withdrawal_amount');
1285
- }
1286
- result[code] = this.safeCurrencyStructure({
1287
- 'id': id,
1288
- 'name': code,
1289
- 'code': code,
1290
- 'precision': this.parseNumber('1e-' + decimals),
1291
- 'active': true,
1292
- 'fee': undefined,
1293
- 'networks': {},
1294
- 'deposit': isUSDC,
1295
- 'withdraw': isUSDC,
1296
- 'type': 'crypto',
1297
- 'limits': {
1298
- 'deposit': {
1299
- 'min': depositMin,
1300
- 'max': undefined,
1301
- },
1302
- 'withdraw': {
1303
- 'min': withdrawMin,
1304
- 'max': undefined,
1305
- },
1273
+ return this.parseCurrencies(data);
1274
+ }
1275
+ parseCurrency(rawCurrency) {
1276
+ const id = this.safeString(rawCurrency, 'asset_id');
1277
+ const code = this.safeCurrencyCode(this.safeString(rawCurrency, 'symbol'));
1278
+ const decimals = this.safeString(rawCurrency, 'decimals');
1279
+ const isUSDC = (code === 'USDC');
1280
+ let depositMin = undefined;
1281
+ let withdrawMin = undefined;
1282
+ if (isUSDC) {
1283
+ depositMin = this.safeNumber(rawCurrency, 'min_transfer_amount');
1284
+ withdrawMin = this.safeNumber(rawCurrency, 'min_withdrawal_amount');
1285
+ }
1286
+ return this.safeCurrencyStructure({
1287
+ 'id': id,
1288
+ 'name': code,
1289
+ 'code': code,
1290
+ 'precision': this.parseNumber('1e-' + decimals),
1291
+ 'active': true,
1292
+ 'fee': undefined,
1293
+ 'networks': {},
1294
+ 'deposit': isUSDC,
1295
+ 'withdraw': isUSDC,
1296
+ 'type': 'crypto',
1297
+ 'limits': {
1298
+ 'deposit': {
1299
+ 'min': depositMin,
1300
+ 'max': undefined,
1306
1301
  },
1307
- 'info': entry,
1308
- });
1309
- }
1310
- return result;
1302
+ 'withdraw': {
1303
+ 'min': withdrawMin,
1304
+ 'max': undefined,
1305
+ },
1306
+ },
1307
+ 'info': rawCurrency,
1308
+ });
1311
1309
  }
1312
1310
  /**
1313
1311
  * @method
package/js/src/luno.d.ts CHANGED
@@ -14,6 +14,7 @@ export default class luno extends Exchange {
14
14
  * @returns {dict} an associative dictionary of currencies
15
15
  */
16
16
  fetchCurrencies(params?: {}): Promise<Currencies>;
17
+ parseCurrency(rawCurrency: Dict): Currency;
17
18
  /**
18
19
  * @method
19
20
  * @name luno#fetchMarkets
package/js/src/luno.js CHANGED
@@ -326,39 +326,19 @@ export default class luno extends Exchange {
326
326
  // }
327
327
  //
328
328
  const currenciesData = this.safeList(response, 'data', []);
329
- const result = {};
330
- for (let i = 0; i < currenciesData.length; i++) {
331
- const networkEntry = currenciesData[i];
332
- const id = this.safeString(networkEntry, 'native_currency');
333
- const code = this.safeCurrencyCode(id);
334
- if (!(code in result)) {
335
- result[code] = {
336
- 'id': id,
337
- 'code': code,
338
- 'precision': undefined,
339
- 'type': undefined,
340
- 'name': undefined,
341
- 'active': undefined,
342
- 'deposit': undefined,
343
- 'withdraw': undefined,
344
- 'fee': undefined,
345
- 'limits': {
346
- 'withdraw': {
347
- 'min': undefined,
348
- 'max': undefined,
349
- },
350
- 'deposit': {
351
- 'min': undefined,
352
- 'max': undefined,
353
- },
354
- },
355
- 'networks': {},
356
- 'info': {},
357
- };
358
- }
329
+ const grouped = this.groupBy(currenciesData, 'native_currency');
330
+ const values = Object.values(grouped);
331
+ return this.parseCurrencies(values);
332
+ }
333
+ parseCurrency(rawCurrency) {
334
+ const id = this.safeString(rawCurrency[0], 'native_currency'); // first item is guaranteed
335
+ const code = this.safeCurrencyCode(id);
336
+ const networks = {};
337
+ for (let i = 0; i < rawCurrency.length; i++) {
338
+ const networkEntry = rawCurrency[i];
359
339
  const networkId = this.safeString(networkEntry, 'name');
360
- const networkCode = this.networkIdToCode(networkId);
361
- result[code]['networks'][networkCode] = {
340
+ const networkCode = this.networkIdToCode(networkId, code);
341
+ networks[networkCode] = {
362
342
  'id': networkId,
363
343
  'network': networkCode,
364
344
  'limits': {
@@ -378,18 +358,30 @@ export default class luno extends Exchange {
378
358
  'precision': undefined,
379
359
  'info': networkEntry,
380
360
  };
381
- // add entry in info
382
- const info = this.safeList(result[code], 'info', []);
383
- info.push(networkEntry);
384
- result[code]['info'] = info;
385
361
  }
386
- // only after all entries are formed in currencies, restructure each entry
387
- const allKeys = Object.keys(result);
388
- for (let i = 0; i < allKeys.length; i++) {
389
- const code = allKeys[i];
390
- result[code] = this.safeCurrencyStructure(result[code]); // this is needed after adding network entry
391
- }
392
- return result;
362
+ return this.safeCurrencyStructure({
363
+ 'id': id,
364
+ 'code': code,
365
+ 'precision': undefined,
366
+ 'type': undefined,
367
+ 'name': undefined,
368
+ 'active': undefined,
369
+ 'deposit': undefined,
370
+ 'withdraw': undefined,
371
+ 'fee': undefined,
372
+ 'limits': {
373
+ 'withdraw': {
374
+ 'min': undefined,
375
+ 'max': undefined,
376
+ },
377
+ 'deposit': {
378
+ 'min': undefined,
379
+ 'max': undefined,
380
+ },
381
+ },
382
+ 'networks': networks,
383
+ 'info': rawCurrency,
384
+ });
393
385
  }
394
386
  /**
395
387
  * @method
@@ -1271,7 +1263,7 @@ export default class luno extends Exchange {
1271
1263
  const firstWord = this.safeString(words, 0);
1272
1264
  const thirdWord = this.safeString(words, 2);
1273
1265
  const fourthWord = this.safeString(words, 3);
1274
- let type = this.safeString(types, firstWord, undefined);
1266
+ let type = this.safeString(types, firstWord);
1275
1267
  if ((type === undefined) && (thirdWord === 'fee')) {
1276
1268
  type = 'fee';
1277
1269
  }
package/js/src/mercado.js CHANGED
@@ -680,6 +680,7 @@ export default class mercado extends Exchange {
680
680
  const filled = this.safeString(order, 'executed_quantity');
681
681
  const lastTradeTimestamp = this.safeTimestamp(order, 'updated_timestamp');
682
682
  const rawTrades = this.safeValue(order, 'operations', []);
683
+ const symbol = market['symbol'];
683
684
  return this.safeOrder({
684
685
  'info': order,
685
686
  'id': id,
@@ -687,7 +688,7 @@ export default class mercado extends Exchange {
687
688
  'timestamp': timestamp,
688
689
  'datetime': this.iso8601(timestamp),
689
690
  'lastTradeTimestamp': lastTradeTimestamp,
690
- 'symbol': market['symbol'],
691
+ 'symbol': symbol,
691
692
  'type': 'limit',
692
693
  'timeInForce': undefined,
693
694
  'postOnly': undefined,
package/js/src/mexc.d.ts CHANGED
@@ -41,6 +41,7 @@ export default class mexc extends Exchange {
41
41
  * @returns {object} an associative dictionary of currencies
42
42
  */
43
43
  fetchCurrencies(params?: {}): Promise<Currencies>;
44
+ parseCurrency(rawCurrency: Dict): Currency;
44
45
  /**
45
46
  * @method
46
47
  * @name mexc#fetchMarkets
@@ -83,7 +84,7 @@ export default class mexc extends Exchange {
83
84
  * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/?id=order-book-structure} indexed by market symbols
84
85
  */
85
86
  fetchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
86
- parseBidAsk(bidask: any, priceKey?: IndexType, amountKey?: IndexType, countOrIdKey?: IndexType): number[];
87
+ parseOrderBookBidAsk(bidask: any, priceKey?: IndexType, amountKey?: IndexType, countOrIdKey?: IndexType): number[];
87
88
  /**
88
89
  * @method
89
90
  * @name mexc#fetchTrades
@@ -626,8 +627,8 @@ export default class mexc extends Exchange {
626
627
  * @description fetch a history of internal transfers made on an account
627
628
  * @see https://mexcdevelop.github.io/apidocs/spot_v2_en/#get-internal-assets-transfer-records
628
629
  * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-the-user-39-s-asset-transfer-records
629
- * @see https://www.mexc.com/api-docs/spot-v3/wallet-endpoints#query-user-universal-transfer-history * @param {string} code unified currency code of the currency transferred
630
- * @param code
630
+ * @see https://www.mexc.com/api-docs/spot-v3/wallet-endpoints#query-user-universal-transfer-history
631
+ * @param {string} [code] unified currency code of the currency transferred
631
632
  * @param {int} [since] the earliest time in ms to fetch transfers for
632
633
  * @param {int} [limit] the maximum number of transfers structures to retrieve
633
634
  * @param {object} [params] extra parameters specific to the exchange API endpoint