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
@@ -346,7 +346,7 @@ export default class coinbaseinternational extends Exchange {
346
346
  }
347
347
  throw new ArgumentsRequired(this.id + ' ' + methodName + '() requires a portfolio parameter or set the default portfolio with this.options["portfolio"]');
348
348
  }
349
- async handleNetworkIdAndParams(currencyCode, methodName, params) {
349
+ async handleNetworkIdAndParams(currencyCode, methodName, params = {}) {
350
350
  let networkId = undefined;
351
351
  [networkId, params] = this.handleOptionAndParams(params, methodName, 'network_arn_id');
352
352
  if (networkId === undefined) {
@@ -522,9 +522,10 @@ export default class coinbaseinternational extends Exchange {
522
522
  }
523
523
  const market = this.market(symbol);
524
524
  const page = this.safeInteger(params, pageKey, 1) - 1;
525
+ const offSet = this.safeInteger2(params, 'offset', 'result_offset', page * maxEntriesPerRequest);
525
526
  const request = {
526
527
  'instrument': market['id'],
527
- 'result_offset': this.safeInteger2(params, 'offset', 'result_offset', page * maxEntriesPerRequest),
528
+ 'result_offset': offSet,
528
529
  };
529
530
  if (limit !== undefined) {
530
531
  request['result_limit'] = limit;
@@ -944,8 +945,9 @@ export default class coinbaseinternational extends Exchange {
944
945
  return await this.fetchPaginatedCallIncremental('fetchDepositsWithdrawals', code, since, limit, params, pageKey, maxEntriesPerRequest);
945
946
  }
946
947
  const page = this.safeInteger(params, pageKey, 1) - 1;
948
+ const offSet = this.safeInteger2(params, 'offset', 'result_offset', page * maxEntriesPerRequest);
947
949
  const request = {
948
- 'result_offset': this.safeInteger2(params, 'offset', 'result_offset', page * maxEntriesPerRequest),
950
+ 'result_offset': offSet,
949
951
  };
950
952
  if (since !== undefined) {
951
953
  request['time_from'] = this.iso8601(since);
@@ -1182,13 +1184,14 @@ export default class coinbaseinternational extends Exchange {
1182
1184
  const addressFrom = this.safeStringN(transaction, ['from_address', 'from_cb_account', this.safeStringN(fromPorfolio, ['id', 'uuid', 'name']), 'from_counterparty_id']);
1183
1185
  const toPorfolio = this.safeDict(transaction, 'from_portfolio', {});
1184
1186
  const addressTo = this.safeStringN(transaction, ['to_address', 'to_cb_account', this.safeStringN(toPorfolio, ['id', 'uuid', 'name']), 'to_counterparty_id']);
1187
+ const code = this.safeString(currency, 'code');
1185
1188
  return {
1186
1189
  'info': transaction,
1187
1190
  'id': this.safeString(transaction, 'transfer_uuid'),
1188
1191
  'txid': this.safeString(transaction, 'transaction_uuid'),
1189
1192
  'timestamp': this.parse8601(datetime),
1190
1193
  'datetime': datetime,
1191
- 'network': this.networkIdToCode(this.safeString(transaction, 'network_name')),
1194
+ 'network': this.networkIdToCode(this.safeString(transaction, 'network_name'), code),
1192
1195
  'address': undefined,
1193
1196
  'addressTo': addressTo,
1194
1197
  'addressFrom': addressFrom,
@@ -1380,16 +1383,18 @@ export default class coinbaseinternational extends Exchange {
1380
1383
  settleId = quoteId;
1381
1384
  symbol += ':' + quoteId;
1382
1385
  }
1386
+ const isLinear = isSpot ? undefined : (settleId === quoteId);
1387
+ const isInverse = isSpot ? undefined : (settleId !== quoteId);
1383
1388
  return {
1384
1389
  'id': marketId,
1385
1390
  'lowercaseId': marketId.toLowerCase(),
1386
1391
  'symbol': symbol,
1387
1392
  'base': baseId,
1388
1393
  'quote': quoteId,
1389
- 'settle': settleId ? settleId : undefined,
1394
+ 'settle': settleId,
1390
1395
  'baseId': baseId,
1391
1396
  'quoteId': quoteId,
1392
- 'settleId': settleId ? settleId : undefined,
1397
+ 'settleId': settleId,
1393
1398
  'type': isSpot ? 'spot' : 'swap',
1394
1399
  'spot': isSpot,
1395
1400
  'margin': false,
@@ -1398,8 +1403,8 @@ export default class coinbaseinternational extends Exchange {
1398
1403
  'option': false,
1399
1404
  'active': this.safeString(market, 'trading_state') === 'TRADING',
1400
1405
  'contract': !isSpot,
1401
- 'linear': isSpot ? undefined : (settleId === quoteId),
1402
- 'inverse': isSpot ? undefined : (settleId !== quoteId),
1406
+ 'linear': isLinear,
1407
+ 'inverse': isInverse,
1403
1408
  'taker': fees['trading']['taker'],
1404
1409
  'maker': fees['trading']['maker'],
1405
1410
  'contractSize': isSpot ? undefined : 1,
@@ -2048,9 +2053,10 @@ export default class coinbaseinternational extends Exchange {
2048
2053
  return await this.fetchPaginatedCallIncremental('fetchOpenOrders', symbol, since, limit, params, pageKey, maxEntriesPerRequest);
2049
2054
  }
2050
2055
  const page = this.safeInteger(params, pageKey, 1) - 1;
2056
+ const offSet = this.safeInteger2(params, 'offset', 'result_offset', page * maxEntriesPerRequest);
2051
2057
  const request = {
2052
2058
  'portfolio': portfolio,
2053
- 'result_offset': this.safeInteger2(params, 'offset', 'result_offset', page * maxEntriesPerRequest),
2059
+ 'result_offset': offSet,
2054
2060
  };
2055
2061
  let market = undefined;
2056
2062
  if (symbol) {
@@ -2132,8 +2138,9 @@ export default class coinbaseinternational extends Exchange {
2132
2138
  market = this.market(symbol);
2133
2139
  }
2134
2140
  const page = this.safeInteger(params, pageKey, 1) - 1;
2141
+ const offSet = this.safeInteger2(params, 'offset', 'result_offset', page * maxEntriesPerRequest);
2135
2142
  const request = {
2136
- 'result_offset': this.safeInteger2(params, 'offset', 'result_offset', page * maxEntriesPerRequest),
2143
+ 'result_offset': offSet,
2137
2144
  };
2138
2145
  if (limit !== undefined) {
2139
2146
  if (limit > 100) {
@@ -15,6 +15,7 @@ export default class coinex extends Exchange {
15
15
  * @returns {object} an associative dictionary of currencies
16
16
  */
17
17
  fetchCurrencies(params?: {}): Promise<Currencies>;
18
+ parseCurrency(coin: any): Currency;
18
19
  /**
19
20
  * @method
20
21
  * @name coinex#fetchMarkets
@@ -657,7 +658,7 @@ export default class coinex extends Exchange {
657
658
  * @name coinex#fetchDepositWithdrawFees
658
659
  * @description fetch the fees for deposits and withdrawals
659
660
  * @see https://docs.coinex.com/api/v2/assets/deposit-withdrawal/http/list-all-deposit-withdrawal-config
660
- * @param codes
661
+ * @param {string[]} [codes] list of unified currency codes
661
662
  * @param {object} [params] extra parameters specific to the exchange API endpoint
662
663
  * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/?id=fee-structure}
663
664
  */
package/js/src/coinex.js CHANGED
@@ -725,90 +725,88 @@ export default class coinex extends Exchange {
725
725
  // }
726
726
  //
727
727
  const data = this.safeList(response, 'data', []);
728
- const result = {};
729
- for (let i = 0; i < data.length; i++) {
730
- const coin = data[i];
731
- const asset = this.safeDict(coin, 'asset', {});
732
- const chains = this.safeList(coin, 'chains', []);
733
- const currencyId = this.safeString(asset, 'ccy');
734
- if (currencyId === undefined) {
735
- continue; // coinex returns empty structures for some reason
736
- }
737
- const code = this.safeCurrencyCode(currencyId);
738
- const canDeposit = this.safeBool(asset, 'deposit_enabled');
739
- const canWithdraw = this.safeBool(asset, 'withdraw_enabled');
740
- const firstChain = this.safeDict(chains, 0, {});
741
- const firstPrecisionString = this.parsePrecision(this.safeString(firstChain, 'withdrawal_precision'));
742
- const networks = {};
743
- for (let j = 0; j < chains.length; j++) {
744
- const chain = chains[j];
745
- const networkId = this.safeString(chain, 'chain');
746
- const networkCode = this.networkIdToCode(networkId, code);
747
- if (networkId === undefined) {
748
- continue;
749
- }
750
- const precisionString = this.parsePrecision(this.safeString(chain, 'withdrawal_precision'));
751
- const feeString = this.safeString(chain, 'withdrawal_fee');
752
- const minNetworkDepositString = this.safeString(chain, 'min_deposit_amount');
753
- const minNetworkWithdrawString = this.safeString(chain, 'min_withdraw_amount');
754
- const canDepositChain = this.safeBool(chain, 'deposit_enabled');
755
- const canWithdrawChain = this.safeBool(chain, 'withdraw_enabled');
756
- const network = {
757
- 'id': networkId,
758
- 'network': networkCode,
759
- 'name': undefined,
760
- 'active': canDepositChain && canWithdrawChain,
761
- 'deposit': canDepositChain,
762
- 'withdraw': canWithdrawChain,
763
- 'fee': this.parseNumber(feeString),
764
- 'precision': this.parseNumber(precisionString),
765
- 'limits': {
766
- 'amount': {
767
- 'min': undefined,
768
- 'max': undefined,
769
- },
770
- 'deposit': {
771
- 'min': this.parseNumber(minNetworkDepositString),
772
- 'max': undefined,
773
- },
774
- 'withdraw': {
775
- 'min': this.parseNumber(minNetworkWithdrawString),
776
- 'max': undefined,
777
- },
778
- },
779
- 'info': chain,
780
- };
781
- networks[networkCode] = network;
728
+ return this.parseCurrencies(data);
729
+ }
730
+ parseCurrency(coin) {
731
+ const asset = this.safeDict(coin, 'asset', {});
732
+ const chains = this.safeList(coin, 'chains', []);
733
+ const currencyId = this.safeString(asset, 'ccy');
734
+ if (currencyId === undefined) {
735
+ return undefined; // coinex returns empty structures for some reason
736
+ }
737
+ const code = this.safeCurrencyCode(currencyId);
738
+ const canDeposit = this.safeBool(asset, 'deposit_enabled');
739
+ const canWithdraw = this.safeBool(asset, 'withdraw_enabled');
740
+ const firstChain = this.safeDict(chains, 0, {});
741
+ const firstPrecisionString = this.parsePrecision(this.safeString(firstChain, 'withdrawal_precision'));
742
+ const networks = {};
743
+ for (let j = 0; j < chains.length; j++) {
744
+ const chain = chains[j];
745
+ const networkId = this.safeString(chain, 'chain');
746
+ const networkCode = this.networkIdToCode(networkId, code);
747
+ if (networkId === undefined) {
748
+ continue;
782
749
  }
783
- result[code] = this.safeCurrencyStructure({
784
- 'id': currencyId,
785
- 'code': code,
750
+ const precisionString = this.parsePrecision(this.safeString(chain, 'withdrawal_precision'));
751
+ const feeString = this.safeString(chain, 'withdrawal_fee');
752
+ const minNetworkDepositString = this.safeString(chain, 'min_deposit_amount');
753
+ const minNetworkWithdrawString = this.safeString(chain, 'min_withdraw_amount');
754
+ const canDepositChain = this.safeBool(chain, 'deposit_enabled');
755
+ const canWithdrawChain = this.safeBool(chain, 'withdraw_enabled');
756
+ const network = {
757
+ 'id': networkId,
758
+ 'network': networkCode,
786
759
  'name': undefined,
787
- 'active': canDeposit && canWithdraw,
788
- 'deposit': canDeposit,
789
- 'withdraw': canWithdraw,
790
- 'fee': undefined,
791
- 'precision': this.parseNumber(firstPrecisionString),
760
+ 'active': canDepositChain && canWithdrawChain,
761
+ 'deposit': canDepositChain,
762
+ 'withdraw': canWithdrawChain,
763
+ 'fee': this.parseNumber(feeString),
764
+ 'precision': this.parseNumber(precisionString),
792
765
  'limits': {
793
766
  'amount': {
794
767
  'min': undefined,
795
768
  'max': undefined,
796
769
  },
797
770
  'deposit': {
798
- 'min': undefined,
771
+ 'min': this.parseNumber(minNetworkDepositString),
799
772
  'max': undefined,
800
773
  },
801
774
  'withdraw': {
802
- 'min': undefined,
775
+ 'min': this.parseNumber(minNetworkWithdrawString),
803
776
  'max': undefined,
804
777
  },
805
778
  },
806
- 'networks': networks,
807
- 'type': 'crypto',
808
- 'info': coin,
809
- });
810
- }
811
- return result;
779
+ 'info': chain,
780
+ };
781
+ networks[networkCode] = network;
782
+ }
783
+ return this.safeCurrencyStructure({
784
+ 'id': currencyId,
785
+ 'code': code,
786
+ 'name': undefined,
787
+ 'active': canDeposit && canWithdraw,
788
+ 'deposit': canDeposit,
789
+ 'withdraw': canWithdraw,
790
+ 'fee': undefined,
791
+ 'precision': this.parseNumber(firstPrecisionString),
792
+ 'limits': {
793
+ 'amount': {
794
+ 'min': undefined,
795
+ 'max': undefined,
796
+ },
797
+ 'deposit': {
798
+ 'min': undefined,
799
+ 'max': undefined,
800
+ },
801
+ 'withdraw': {
802
+ 'min': undefined,
803
+ 'max': undefined,
804
+ },
805
+ },
806
+ 'networks': networks,
807
+ 'type': 'crypto',
808
+ 'info': coin,
809
+ });
812
810
  }
813
811
  /**
814
812
  * @method
@@ -3993,7 +3991,7 @@ export default class coinex extends Exchange {
3993
3991
  if (networkCode === undefined) {
3994
3992
  throw new ArgumentsRequired(this.id + ' fetchDepositAddress() requires a "network" parameter');
3995
3993
  }
3996
- request['chain'] = this.networkCodeToId(networkCode); // required for on-chain, not required for inter-user transfer
3994
+ request['chain'] = this.networkCodeToId(networkCode, currency['code']); // required for on-chain, not required for inter-user transfer
3997
3995
  const response = await this.v2PrivateGetAssetsDepositAddress(this.extend(request, params));
3998
3996
  //
3999
3997
  // {
@@ -4498,11 +4496,13 @@ export default class coinex extends Exchange {
4498
4496
  const marketId = this.safeString(info, 'market');
4499
4497
  market = this.safeMarket(marketId, market, undefined, 'swap');
4500
4498
  const maxNotional = this.safeNumber(tier, 'amount');
4499
+ const curr = market['linear'] ? market['base'] : market['quote'];
4500
+ const notional = minNotional;
4501
4501
  tiers.push({
4502
4502
  'tier': this.sum(i, 1),
4503
4503
  'symbol': this.safeSymbol(marketId, market, undefined, 'swap'),
4504
- 'currency': market['linear'] ? market['base'] : market['quote'],
4505
- 'minNotional': minNotional,
4504
+ 'currency': curr,
4505
+ 'minNotional': notional,
4506
4506
  'maxNotional': maxNotional,
4507
4507
  'maintenanceMarginRate': this.safeNumber(tier, 'maintenance_margin_rate'),
4508
4508
  'maxLeverage': this.safeInteger(tier, 'leverage'),
@@ -4917,7 +4917,7 @@ export default class coinex extends Exchange {
4917
4917
  let networkCode = undefined;
4918
4918
  [networkCode, params] = this.handleNetworkCodeAndParams(params);
4919
4919
  if (networkCode !== undefined) {
4920
- request['chain'] = this.networkCodeToId(networkCode); // required for on-chain, not required for inter-user transfer
4920
+ request['chain'] = this.networkCodeToId(networkCode, currency['code']); // required for on-chain, not required for inter-user transfer
4921
4921
  }
4922
4922
  const response = await this.v2PrivatePostAssetsWithdraw(this.extend(request, params));
4923
4923
  //
@@ -5124,7 +5124,7 @@ export default class coinex extends Exchange {
5124
5124
  'txid': txid,
5125
5125
  'timestamp': timestamp,
5126
5126
  'datetime': this.iso8601(timestamp),
5127
- 'network': this.networkIdToCode(networkId),
5127
+ 'network': this.networkIdToCode(networkId, code),
5128
5128
  'address': address,
5129
5129
  'addressTo': address,
5130
5130
  'addressFrom': undefined,
@@ -5717,7 +5717,7 @@ export default class coinex extends Exchange {
5717
5717
  * @name coinex#fetchDepositWithdrawFees
5718
5718
  * @description fetch the fees for deposits and withdrawals
5719
5719
  * @see https://docs.coinex.com/api/v2/assets/deposit-withdrawal/http/list-all-deposit-withdrawal-config
5720
- * @param codes
5720
+ * @param {string[]} [codes] list of unified currency codes
5721
5721
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5722
5722
  * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/?id=fee-structure}
5723
5723
  */
@@ -5827,7 +5827,9 @@ export default class coinex extends Exchange {
5827
5827
  result['withdraw']['percentage'] = false;
5828
5828
  const networkId = this.safeString(entry, 'chain');
5829
5829
  if (networkId) {
5830
- const networkCode = this.networkIdToCode(networkId, this.safeString(asset, 'ccy'));
5830
+ const currencyId = this.safeString(asset, 'ccy');
5831
+ const feeCode = this.safeCurrencyCode(currencyId, currency);
5832
+ const networkCode = this.networkIdToCode(networkId, feeCode);
5831
5833
  result['networks'][networkCode] = {
5832
5834
  'withdraw': {
5833
5835
  'fee': this.safeNumber(entry, 'withdrawal_fee'),
@@ -79,7 +79,7 @@ export default class coinmetro extends Exchange {
79
79
  * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/?id=order-book-structure} indexed by market symbols
80
80
  */
81
81
  fetchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
82
- parseBidsAsks(bidasks: any, priceKey?: IndexType, amountKey?: IndexType, countOrIdKey?: IndexType): any[];
82
+ parseOrderBookBidsAsks(bidasks: any, priceKey?: IndexType, amountKey?: IndexType, countOrIdKey?: IndexType): any[];
83
83
  /**
84
84
  * @method
85
85
  * @name coinmetro#fetchTickers
@@ -886,7 +886,7 @@ export default class coinmetro extends Exchange {
886
886
  orderbook['nonce'] = this.safeInteger(book, 'seqNumber');
887
887
  return orderbook;
888
888
  }
889
- parseBidsAsks(bidasks, priceKey = 0, amountKey = 1, countOrIdKey = 2) {
889
+ parseOrderBookBidsAsks(bidasks, priceKey = 0, amountKey = 1, countOrIdKey = 2) {
890
890
  const prices = Object.keys(bidasks);
891
891
  const result = [];
892
892
  for (let i = 0; i < prices.length; i++) {
package/js/src/coinsph.js CHANGED
@@ -623,7 +623,7 @@ export default class coinsph extends Exchange {
623
623
  for (let j = 0; j < networkList.length; j++) {
624
624
  const networkItem = networkList[j];
625
625
  const network = this.safeString(networkItem, 'network');
626
- const networkCode = this.networkIdToCode(network);
626
+ const networkCode = this.networkIdToCode(network, code);
627
627
  networks[networkCode] = {
628
628
  'info': networkItem,
629
629
  'id': network,
@@ -1272,12 +1272,12 @@ export default class coinsph extends Exchange {
1272
1272
  'currency': this.safeCurrencyCode(feeCurrencyId),
1273
1273
  };
1274
1274
  }
1275
- const isBuyer = this.safeBool2(trade, 'isBuyer', 'isBuyerMaker', undefined);
1275
+ const isBuyer = this.safeBool2(trade, 'isBuyer', 'isBuyerMaker');
1276
1276
  let side = undefined;
1277
1277
  if (isBuyer !== undefined) {
1278
1278
  side = (isBuyer === true) ? 'buy' : 'sell';
1279
1279
  }
1280
- const isMaker = this.safeString2(trade, 'isMaker', undefined);
1280
+ const isMaker = this.safeString(trade, 'isMaker');
1281
1281
  let takerOrMaker = undefined;
1282
1282
  if (isMaker !== undefined) {
1283
1283
  takerOrMaker = (isMaker === 'true') ? 'maker' : 'taker';
@@ -1672,7 +1672,7 @@ export default class coinsph extends Exchange {
1672
1672
  const marketId = this.safeString(order, 'symbol');
1673
1673
  market = this.safeMarket(marketId, market);
1674
1674
  const timestamp = this.safeInteger2(order, 'time', 'transactTime');
1675
- const trades = this.safeValue(order, 'fills', undefined);
1675
+ const trades = this.safeValue(order, 'fills');
1676
1676
  let triggerPrice = this.safeString(order, 'stopPrice');
1677
1677
  if (Precise.stringEq(triggerPrice, '0')) {
1678
1678
  triggerPrice = undefined;
@@ -2213,7 +2213,7 @@ export default class coinsph extends Exchange {
2213
2213
  if (response === undefined) {
2214
2214
  return undefined;
2215
2215
  }
2216
- const responseCode = this.safeString(response, 'code', undefined);
2216
+ const responseCode = this.safeString(response, 'code');
2217
2217
  if ((responseCode !== undefined) && (responseCode !== '200') && (responseCode !== '0')) {
2218
2218
  const feedback = this.id + ' ' + body;
2219
2219
  this.throwBroadlyMatchedException(this.exceptions['broad'], body, feedback);
@@ -15,6 +15,7 @@ export default class cryptocom extends Exchange {
15
15
  * @returns {object} an associative dictionary of currencies
16
16
  */
17
17
  fetchCurrencies(params?: {}): Promise<Currencies>;
18
+ parseCurrency(currency: Dict): Currency;
18
19
  /**
19
20
  * @method
20
21
  * @name cryptocom#fetchMarkets
@@ -559,7 +559,8 @@ export default class cryptocom extends Exchange {
559
559
  response = await this.v1PrivatePostPrivateGetCurrencyNetworks(params);
560
560
  }
561
561
  catch (e) {
562
- if (e instanceof ExchangeError) {
562
+ const erString = this.exceptionMessage(e);
563
+ if (erString.indexOf('"msg":"SYS_ERROR"') >= 0) {
563
564
  // sub-accounts can't access this endpoint
564
565
  // {"code":"10001","msg":"SYS_ERROR"}
565
566
  return {};
@@ -612,57 +613,54 @@ export default class cryptocom extends Exchange {
612
613
  //
613
614
  const resultData = this.safeDict(response, 'result', {});
614
615
  const currencyMap = this.safeDict(resultData, 'currency_map', {});
615
- const keys = Object.keys(currencyMap);
616
- const result = {};
617
- for (let i = 0; i < keys.length; i++) {
618
- const key = keys[i];
619
- const currency = currencyMap[key];
620
- const id = key;
621
- const code = this.safeCurrencyCode(id);
622
- const networks = {};
623
- const chains = this.safeList(currency, 'network_list', []);
624
- for (let j = 0; j < chains.length; j++) {
625
- const chain = chains[j];
626
- const networkId = this.safeString(chain, 'network_id');
627
- const network = this.networkIdToCode(networkId);
628
- networks[network] = {
629
- 'info': chain,
630
- 'id': networkId,
631
- 'network': network,
632
- 'active': undefined,
633
- 'deposit': this.safeBool(chain, 'deposit_enabled', false),
634
- 'withdraw': this.safeBool(chain, 'withdraw_enabled', false),
635
- 'fee': this.safeNumber(chain, 'withdrawal_fee'),
636
- 'precision': undefined,
637
- 'limits': {
638
- 'withdraw': {
639
- 'min': this.safeNumber(chain, 'min_withdrawal_amount'),
640
- 'max': undefined,
641
- },
642
- },
643
- };
644
- }
645
- result[code] = this.safeCurrencyStructure({
646
- 'info': currency,
647
- 'id': id,
648
- 'code': code,
649
- 'name': this.safeString(currency, 'full_name'),
616
+ const enhancedArray = this.addKeyInArrayItems(currencyMap, '_coin_id');
617
+ return this.parseCurrencies(enhancedArray);
618
+ }
619
+ parseCurrency(currency) {
620
+ const id = this.safeString(currency, '_coin_id');
621
+ const code = this.safeCurrencyCode(id);
622
+ const networks = {};
623
+ const chains = this.safeList(currency, 'network_list', []);
624
+ for (let j = 0; j < chains.length; j++) {
625
+ const chain = chains[j];
626
+ const networkId = this.safeString(chain, 'network_id');
627
+ const network = this.networkIdToCode(networkId, code);
628
+ networks[network] = {
629
+ 'info': chain,
630
+ 'id': networkId,
631
+ 'network': network,
650
632
  'active': undefined,
651
- 'deposit': undefined,
652
- 'withdraw': undefined,
653
- 'fee': undefined,
633
+ 'deposit': this.safeBool(chain, 'deposit_enabled', false),
634
+ 'withdraw': this.safeBool(chain, 'withdraw_enabled', false),
635
+ 'fee': this.safeNumber(chain, 'withdrawal_fee'),
654
636
  'precision': undefined,
655
637
  'limits': {
656
- 'amount': {
657
- 'min': undefined,
638
+ 'withdraw': {
639
+ 'min': this.safeNumber(chain, 'min_withdrawal_amount'),
658
640
  'max': undefined,
659
641
  },
660
642
  },
661
- 'type': 'crypto',
662
- 'networks': networks,
663
- });
643
+ };
664
644
  }
665
- return result;
645
+ return this.safeCurrencyStructure({
646
+ 'info': currency,
647
+ 'id': id,
648
+ 'code': code,
649
+ 'name': this.safeString(currency, 'full_name'),
650
+ 'active': undefined,
651
+ 'deposit': undefined,
652
+ 'withdraw': undefined,
653
+ 'fee': undefined,
654
+ 'precision': undefined,
655
+ 'limits': {
656
+ 'amount': {
657
+ 'min': undefined,
658
+ 'max': undefined,
659
+ },
660
+ },
661
+ 'type': 'crypto',
662
+ 'networks': networks,
663
+ });
666
664
  }
667
665
  /**
668
666
  * @method
@@ -806,6 +804,8 @@ export default class cryptocom extends Exchange {
806
804
  symbol = symbol + ':' + quote + '-' + this.yymmdd(expiry) + '-' + strike + '-' + symbolOptionType;
807
805
  contract = true;
808
806
  }
807
+ const isLinear = (contract) ? true : undefined;
808
+ const isInverse = (contract) ? false : undefined;
809
809
  result.push({
810
810
  'id': this.safeString(market, 'symbol'),
811
811
  'symbol': symbol,
@@ -823,8 +823,8 @@ export default class cryptocom extends Exchange {
823
823
  'option': option,
824
824
  'active': this.safeBool(market, 'tradable'),
825
825
  'contract': contract,
826
- 'linear': (contract) ? true : undefined,
827
- 'inverse': (contract) ? false : undefined,
826
+ 'linear': isLinear,
827
+ 'inverse': isInverse,
828
828
  'contractSize': this.safeNumber(market, 'contract_size'),
829
829
  'expiry': expiry,
830
830
  'expiryDatetime': this.iso8601(expiry),
@@ -2014,7 +2014,7 @@ export default class cryptocom extends Exchange {
2014
2014
  }
2015
2015
  let networkCode = undefined;
2016
2016
  [networkCode, params] = this.handleNetworkCodeAndParams(params);
2017
- const networkId = this.networkCodeToId(networkCode);
2017
+ const networkId = this.networkCodeToId(networkCode, code);
2018
2018
  if (networkId !== undefined) {
2019
2019
  request['network_id'] = networkId;
2020
2020
  }
@@ -2115,10 +2115,8 @@ export default class cryptocom extends Exchange {
2115
2115
  if (network in depositAddresses) {
2116
2116
  return depositAddresses[network];
2117
2117
  }
2118
- else {
2119
- const keys = Object.keys(depositAddresses);
2120
- return depositAddresses[keys[0]];
2121
- }
2118
+ const keys = Object.keys(depositAddresses);
2119
+ return depositAddresses[keys[0]];
2122
2120
  }
2123
2121
  /**
2124
2122
  * @method
@@ -3329,8 +3327,8 @@ export default class cryptocom extends Exchange {
3329
3327
  paramsKeys = object;
3330
3328
  }
3331
3329
  else {
3332
- const sorted = this.keysort(object);
3333
- paramsKeys = Object.keys(sorted);
3330
+ const objectKeys = Object.keys(object);
3331
+ paramsKeys = this.sort(objectKeys);
3334
3332
  }
3335
3333
  for (let i = 0; i < paramsKeys.length; i++) {
3336
3334
  const key = paramsKeys[i];
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/cryptomus.js';
2
- import type { Balances, Currencies, Dict, int, Int, Market, Num, Order, OrderBook, OrderType, OrderSide, Str, Strings, Ticker, Tickers, Trade, TradingFees } from './base/types.js';
2
+ import type { Balances, Currencies, Dict, int, Int, Market, Num, Order, OrderBook, OrderType, OrderSide, Str, Strings, Ticker, Tickers, Trade, TradingFees, Currency } from './base/types.js';
3
3
  /**
4
4
  * @class cryptomus
5
5
  * @augments Exchange
@@ -25,6 +25,7 @@ export default class cryptomus extends Exchange {
25
25
  * @returns {object} an associative dictionary of currencies
26
26
  */
27
27
  fetchCurrencies(params?: {}): Promise<Currencies>;
28
+ parseCurrency(rawCurrency: Dict): Currency;
28
29
  /**
29
30
  * @method
30
31
  * @name cryptomus#fetchTickers