ccxt 4.5.56 → 4.5.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (261) hide show
  1. package/README.md +10 -9
  2. package/dist/ccxt.browser.min.js +10 -10
  3. package/dist/cjs/ccxt.js +6 -11
  4. package/dist/cjs/src/apex.js +1 -1
  5. package/dist/cjs/src/arkham.js +3 -3
  6. package/dist/cjs/src/ascendex.js +2 -2
  7. package/dist/cjs/src/aster.js +7 -4
  8. package/dist/cjs/src/backpack.js +4 -4
  9. package/dist/cjs/src/base/Exchange.js +69 -32
  10. package/dist/cjs/src/base/functions/io.js +25 -0
  11. package/dist/cjs/src/base/functions.js +1 -0
  12. package/dist/cjs/src/bigone.js +3 -3
  13. package/dist/cjs/src/binance.js +192 -194
  14. package/dist/cjs/src/bingx.js +3 -3
  15. package/dist/cjs/src/bitfinex.js +71 -58
  16. package/dist/cjs/src/bitget.js +2 -2
  17. package/dist/cjs/src/bitmart.js +13 -6
  18. package/dist/cjs/src/bitmex.js +1 -1
  19. package/dist/cjs/src/bitopro.js +1 -1
  20. package/dist/cjs/src/bitrue.js +2 -2
  21. package/dist/cjs/src/bitso.js +1 -1
  22. package/dist/cjs/src/bitstamp.js +2 -1
  23. package/dist/cjs/src/bitteam.js +1 -1
  24. package/dist/cjs/src/bittrade.js +0 -1
  25. package/dist/cjs/src/bitvavo.js +457 -34
  26. package/dist/cjs/src/blofin.js +26 -3
  27. package/dist/cjs/src/bullish.js +6 -5
  28. package/dist/cjs/src/bydfi.js +1 -1
  29. package/dist/cjs/src/cex.js +3 -3
  30. package/dist/cjs/src/coinbase.js +75 -65
  31. package/dist/cjs/src/coinbaseexchange.js +2 -2
  32. package/dist/cjs/src/coinbaseinternational.js +2 -1
  33. package/dist/cjs/src/coinex.js +74 -74
  34. package/dist/cjs/src/coinmetro.js +1 -1
  35. package/dist/cjs/src/coinsph.js +1 -1
  36. package/dist/cjs/src/cryptocom.js +46 -48
  37. package/dist/cjs/src/cryptomus.js +43 -39
  38. package/dist/cjs/src/deepcoin.js +3 -2
  39. package/dist/cjs/src/delta.js +51 -52
  40. package/dist/cjs/src/deribit.js +31 -33
  41. package/dist/cjs/src/derive.js +26 -28
  42. package/dist/cjs/src/digifinex.js +43 -44
  43. package/dist/cjs/src/exmo.js +92 -83
  44. package/dist/cjs/src/extended.js +3497 -0
  45. package/dist/cjs/src/foxbit.js +71 -75
  46. package/dist/cjs/src/gate.js +53 -53
  47. package/dist/cjs/src/gemini.js +41 -43
  48. package/dist/cjs/src/grvt.js +4 -4
  49. package/dist/cjs/src/hashkey.js +52 -54
  50. package/dist/cjs/src/hitbtc.js +3 -13
  51. package/dist/cjs/src/hollaex.js +51 -54
  52. package/dist/cjs/src/htx.js +75 -67
  53. package/dist/cjs/src/hyperliquid.js +41 -42
  54. package/dist/cjs/src/indodax.js +2 -2
  55. package/dist/cjs/src/kraken.js +57 -58
  56. package/dist/cjs/src/kucoin.js +3 -2
  57. package/dist/cjs/src/latoken.js +30 -32
  58. package/dist/cjs/src/lbank.js +56 -56
  59. package/dist/cjs/src/lighter.js +35 -37
  60. package/dist/cjs/src/luno.js +35 -43
  61. package/dist/cjs/src/mexc.js +48 -49
  62. package/dist/cjs/src/modetrade.js +50 -52
  63. package/dist/cjs/src/ndax.js +35 -37
  64. package/dist/cjs/src/okx.js +17 -2
  65. package/dist/cjs/src/onetrading.js +21 -23
  66. package/dist/cjs/src/phemex.js +43 -45
  67. package/dist/cjs/src/poloniex.js +17 -12
  68. package/dist/cjs/src/pro/alpaca.js +1 -1
  69. package/dist/cjs/src/pro/apex.js +1 -1
  70. package/dist/cjs/src/pro/arkham.js +1 -1
  71. package/dist/cjs/src/pro/backpack.js +1 -1
  72. package/dist/cjs/src/pro/binance.js +3 -3
  73. package/dist/cjs/src/pro/bitget.js +1 -1
  74. package/dist/cjs/src/pro/bithumb.js +1 -1
  75. package/dist/cjs/src/pro/bitstamp.js +1 -1
  76. package/dist/cjs/src/pro/blockchaincom.js +1 -1
  77. package/dist/cjs/src/pro/bybit.js +1 -1
  78. package/dist/cjs/src/pro/cex.js +1 -1
  79. package/dist/cjs/src/pro/coinex.js +1 -1
  80. package/dist/cjs/src/pro/coinone.js +1 -1
  81. package/dist/cjs/src/pro/cryptocom.js +3 -1
  82. package/dist/cjs/src/pro/dydx.js +1 -1
  83. package/dist/cjs/src/pro/exmo.js +1 -1
  84. package/dist/cjs/src/pro/extended.js +865 -0
  85. package/dist/cjs/src/pro/gate.js +1 -1
  86. package/dist/cjs/src/pro/independentreserve.js +1 -1
  87. package/dist/cjs/src/pro/kucoin.js +1 -1
  88. package/dist/cjs/src/pro/luno.js +3 -3
  89. package/dist/cjs/src/pro/onetrading.js +1 -1
  90. package/dist/cjs/src/pro/toobit.js +1 -1
  91. package/dist/cjs/src/pro/weex.js +1 -1
  92. package/dist/cjs/src/static_dependencies/starknet/utils/hash/classHash.js +7 -7
  93. package/dist/cjs/src/tokocrypto.js +1 -1
  94. package/dist/cjs/src/toobit.js +2 -2
  95. package/dist/cjs/src/upbit.js +3 -3
  96. package/dist/cjs/src/weex.js +57 -62
  97. package/dist/cjs/src/whitebit.js +61 -63
  98. package/dist/cjs/src/woo.js +65 -54
  99. package/dist/cjs/src/woofipro.js +53 -47
  100. package/dist/cjs/src/xt.js +1 -1
  101. package/dist/cjs/src/zebpay.js +70 -72
  102. package/js/ccxt.d.ts +8 -14
  103. package/js/ccxt.js +6 -10
  104. package/js/src/abstract/bitvavo.d.ts +15 -7
  105. package/js/src/abstract/extended.d.ts +58 -0
  106. package/js/src/apex.js +1 -1
  107. package/js/src/arkham.js +3 -3
  108. package/js/src/ascendex.js +2 -2
  109. package/js/src/aster.js +7 -4
  110. package/js/src/backpack.js +4 -4
  111. package/js/src/base/Exchange.d.ts +10 -6
  112. package/js/src/base/Exchange.js +69 -32
  113. package/js/src/base/functions/io.d.ts +7 -0
  114. package/js/src/base/functions/io.js +24 -0
  115. package/js/src/bigone.js +3 -3
  116. package/js/src/binance.d.ts +2 -0
  117. package/js/src/binance.js +196 -198
  118. package/js/src/bingx.js +3 -3
  119. package/js/src/bitfinex.d.ts +2 -0
  120. package/js/src/bitfinex.js +71 -58
  121. package/js/src/bitget.js +2 -2
  122. package/js/src/bitmart.js +13 -6
  123. package/js/src/bitmex.js +1 -1
  124. package/js/src/bitopro.js +1 -1
  125. package/js/src/bitrue.js +2 -2
  126. package/js/src/bitso.js +1 -1
  127. package/js/src/bitstamp.js +2 -1
  128. package/js/src/bitteam.js +1 -1
  129. package/js/src/bittrade.js +0 -1
  130. package/js/src/bitvavo.d.ts +114 -21
  131. package/js/src/bitvavo.js +457 -34
  132. package/js/src/blofin.d.ts +1 -0
  133. package/js/src/blofin.js +26 -3
  134. package/js/src/bullish.js +6 -5
  135. package/js/src/bydfi.js +1 -1
  136. package/js/src/cex.js +3 -3
  137. package/js/src/coinbase.d.ts +63 -56
  138. package/js/src/coinbase.js +75 -65
  139. package/js/src/coinbaseexchange.js +2 -2
  140. package/js/src/coinbaseinternational.js +2 -1
  141. package/js/src/coinex.d.ts +1 -0
  142. package/js/src/coinex.js +74 -74
  143. package/js/src/coinmetro.d.ts +1 -1
  144. package/js/src/coinmetro.js +1 -1
  145. package/js/src/coinsph.js +1 -1
  146. package/js/src/cryptocom.d.ts +1 -0
  147. package/js/src/cryptocom.js +46 -48
  148. package/js/src/cryptomus.d.ts +2 -1
  149. package/js/src/cryptomus.js +43 -39
  150. package/js/src/deepcoin.js +3 -2
  151. package/js/src/delta.d.ts +1 -0
  152. package/js/src/delta.js +51 -52
  153. package/js/src/deribit.d.ts +1 -0
  154. package/js/src/deribit.js +31 -33
  155. package/js/src/derive.d.ts +1 -0
  156. package/js/src/derive.js +26 -28
  157. package/js/src/digifinex.d.ts +1 -0
  158. package/js/src/digifinex.js +43 -44
  159. package/js/src/exmo.d.ts +1 -0
  160. package/js/src/exmo.js +92 -83
  161. package/js/src/extended.d.ts +554 -0
  162. package/js/src/extended.js +3490 -0
  163. package/js/src/foxbit.d.ts +1 -0
  164. package/js/src/foxbit.js +71 -75
  165. package/js/src/gate.d.ts +1 -0
  166. package/js/src/gate.js +53 -53
  167. package/js/src/gemini.d.ts +2 -1
  168. package/js/src/gemini.js +41 -43
  169. package/js/src/grvt.js +4 -4
  170. package/js/src/hashkey.d.ts +1 -0
  171. package/js/src/hashkey.js +52 -54
  172. package/js/src/hitbtc.d.ts +0 -1
  173. package/js/src/hitbtc.js +3 -13
  174. package/js/src/hollaex.d.ts +1 -0
  175. package/js/src/hollaex.js +51 -54
  176. package/js/src/htx.d.ts +1 -0
  177. package/js/src/htx.js +75 -67
  178. package/js/src/hyperliquid.d.ts +1 -0
  179. package/js/src/hyperliquid.js +41 -42
  180. package/js/src/indodax.js +2 -2
  181. package/js/src/kraken.d.ts +2 -1
  182. package/js/src/kraken.js +57 -58
  183. package/js/src/kucoin.js +3 -2
  184. package/js/src/latoken.d.ts +1 -0
  185. package/js/src/latoken.js +30 -32
  186. package/js/src/lbank.d.ts +1 -0
  187. package/js/src/lbank.js +56 -56
  188. package/js/src/lighter.d.ts +1 -0
  189. package/js/src/lighter.js +35 -37
  190. package/js/src/luno.d.ts +1 -0
  191. package/js/src/luno.js +35 -43
  192. package/js/src/mexc.d.ts +2 -1
  193. package/js/src/mexc.js +48 -49
  194. package/js/src/modetrade.d.ts +1 -0
  195. package/js/src/modetrade.js +50 -52
  196. package/js/src/ndax.d.ts +1 -0
  197. package/js/src/ndax.js +35 -37
  198. package/js/src/okx.js +17 -2
  199. package/js/src/onetrading.d.ts +2 -1
  200. package/js/src/onetrading.js +21 -23
  201. package/js/src/phemex.d.ts +1 -0
  202. package/js/src/phemex.js +43 -45
  203. package/js/src/poloniex.js +17 -12
  204. package/js/src/pro/alpaca.js +1 -1
  205. package/js/src/pro/apex.js +1 -1
  206. package/js/src/pro/arkham.js +1 -1
  207. package/js/src/pro/backpack.js +1 -1
  208. package/js/src/pro/binance.js +3 -3
  209. package/js/src/pro/bitget.js +1 -1
  210. package/js/src/pro/bithumb.js +1 -1
  211. package/js/src/pro/bitstamp.js +1 -1
  212. package/js/src/pro/blockchaincom.js +1 -1
  213. package/js/src/pro/bybit.js +1 -1
  214. package/js/src/pro/cex.js +1 -1
  215. package/js/src/pro/coinex.js +1 -1
  216. package/js/src/pro/coinone.js +1 -1
  217. package/js/src/pro/cryptocom.js +3 -1
  218. package/js/src/pro/dydx.js +1 -1
  219. package/js/src/pro/exmo.js +1 -1
  220. package/js/src/pro/extended.d.ts +126 -0
  221. package/js/src/pro/extended.js +858 -0
  222. package/js/src/pro/gate.js +1 -1
  223. package/js/src/pro/independentreserve.js +1 -1
  224. package/js/src/pro/kucoin.js +1 -1
  225. package/js/src/pro/luno.d.ts +1 -1
  226. package/js/src/pro/luno.js +3 -3
  227. package/js/src/pro/onetrading.js +1 -1
  228. package/js/src/pro/toobit.js +1 -1
  229. package/js/src/pro/weex.js +1 -1
  230. package/js/src/tokocrypto.js +1 -1
  231. package/js/src/toobit.js +2 -2
  232. package/js/src/upbit.js +3 -3
  233. package/js/src/weex.d.ts +1 -0
  234. package/js/src/weex.js +57 -62
  235. package/js/src/whitebit.d.ts +1 -0
  236. package/js/src/whitebit.js +61 -63
  237. package/js/src/woo.d.ts +1 -0
  238. package/js/src/woo.js +65 -54
  239. package/js/src/woofipro.d.ts +1 -0
  240. package/js/src/woofipro.js +53 -47
  241. package/js/src/xt.js +1 -1
  242. package/js/src/zebpay.d.ts +2 -1
  243. package/js/src/zebpay.js +70 -72
  244. package/package.json +7 -7
  245. package/dist/cjs/src/gateio.js +0 -18
  246. package/dist/cjs/src/oxfun.js +0 -2933
  247. package/dist/cjs/src/pro/gateio.js +0 -18
  248. package/dist/cjs/src/pro/oxfun.js +0 -1113
  249. package/js/src/abstract/gateio.d.ts +0 -346
  250. package/js/src/abstract/gateio.js +0 -5
  251. package/js/src/abstract/oxfun.d.ts +0 -37
  252. package/js/src/gateio.d.ts +0 -4
  253. package/js/src/gateio.js +0 -11
  254. package/js/src/oxfun.d.ts +0 -442
  255. package/js/src/oxfun.js +0 -2926
  256. package/js/src/pro/gateio.d.ts +0 -4
  257. package/js/src/pro/gateio.js +0 -11
  258. package/js/src/pro/oxfun.d.ts +0 -234
  259. package/js/src/pro/oxfun.js +0 -1106
  260. /package/dist/cjs/src/abstract/{oxfun.js → extended.js} +0 -0
  261. /package/js/src/abstract/{oxfun.js → extended.js} +0 -0
@@ -1647,7 +1647,7 @@ class binance extends binance$1["default"] {
1647
1647
  'symbolRequired': true,
1648
1648
  },
1649
1649
  'fetchOHLCV': {
1650
- 'limit': 1500,
1650
+ 'limit': 500,
1651
1651
  },
1652
1652
  },
1653
1653
  'swap': {
@@ -2963,202 +2963,200 @@ class binance extends binance$1["default"] {
2963
2963
  const responseMarginables = results[1];
2964
2964
  marginablesById = this.indexBy(responseMarginables, 'assetName');
2965
2965
  }
2966
+ return this.parseCurrenciesCustom(responseCurrencies, marginablesById);
2967
+ }
2968
+ parseCurrenciesCustom(responseCurrencies, marginablesById) {
2966
2969
  const result = {};
2967
2970
  for (let i = 0; i < responseCurrencies.length; i++) {
2968
- //
2969
- // {
2970
- // "coin": "LINK",
2971
- // "depositAllEnable": true,
2972
- // "withdrawAllEnable": true,
2973
- // "name": "ChainLink",
2974
- // "free": "0",
2975
- // "locked": "0",
2976
- // "freeze": "0",
2977
- // "withdrawing": "0",
2978
- // "ipoing": "0",
2979
- // "ipoable": "0",
2980
- // "storage": "0",
2981
- // "isLegalMoney": false,
2982
- // "trading": true,
2983
- // "networkList": [
2984
- // {
2985
- // "network": "BSC",
2986
- // "coin": "LINK",
2987
- // "withdrawIntegerMultiple": "0.00000001",
2988
- // "isDefault": false,
2989
- // "depositEnable": true,
2990
- // "withdrawEnable": true,
2991
- // "depositDesc": "",
2992
- // "withdrawDesc": "",
2993
- // "specialTips": "",
2994
- // "specialWithdrawTips": "The network you have selected is BSC. Please ensure that the withdrawal address supports the Binance Smart Chain network. You will lose your assets if the chosen platform does not support retrievals.",
2995
- // "name": "BNB Smart Chain (BEP20)",
2996
- // "resetAddressStatus": false,
2997
- // "addressRegex": "^(0x)[0-9A-Fa-f]{40}$",
2998
- // "addressRule": "",
2999
- // "memoRegex": "",
3000
- // "withdrawFee": "0.012",
3001
- // "withdrawMin": "0.024",
3002
- // "withdrawMax": "9999999999.99999999",
3003
- // "minConfirm": "15",
3004
- // "unLockConfirm": "0",
3005
- // "sameAddress": false,
3006
- // "estimatedArrivalTime": "5",
3007
- // "busy": false,
3008
- // "country": "AE,BINANCE_BAHRAIN_BSC"
3009
- // },
3010
- // {
3011
- // "network": "BNB",
3012
- // "coin": "LINK",
3013
- // "withdrawIntegerMultiple": "0.00000001",
3014
- // "isDefault": false,
3015
- // "depositEnable": true,
3016
- // "withdrawEnable": true,
3017
- // "depositDesc": "",
3018
- // "withdrawDesc": "",
3019
- // "specialTips": "Both a MEMO and an Address are required to successfully deposit your LINK BEP2 tokens to Binance.",
3020
- // "specialWithdrawTips": "",
3021
- // "name": "BNB Beacon Chain (BEP2)",
3022
- // "resetAddressStatus": false,
3023
- // "addressRegex": "^(bnb1)[0-9a-z]{38}$",
3024
- // "addressRule": "",
3025
- // "memoRegex": "^[0-9A-Za-z\\-_]{1,120}$",
3026
- // "withdrawFee": "0.003",
3027
- // "withdrawMin": "0.01",
3028
- // "withdrawMax": "10000000000",
3029
- // "minConfirm": "1",
3030
- // "unLockConfirm": "0",
3031
- // "sameAddress": true,
3032
- // "estimatedArrivalTime": "5",
3033
- // "busy": false,
3034
- // "country": "AE,BINANCE_BAHRAIN_BSC"
3035
- // },
3036
- // {
3037
- // "network": "ETH",
3038
- // "coin": "LINK",
3039
- // "withdrawIntegerMultiple": "0.00000001",
3040
- // "isDefault": true,
3041
- // "depositEnable": true,
3042
- // "withdrawEnable": true,
3043
- // "depositDesc": "",
3044
- // "withdrawDesc": "",
3045
- // "name": "Ethereum (ERC20)",
3046
- // "resetAddressStatus": false,
3047
- // "addressRegex": "^(0x)[0-9A-Fa-f]{40}$",
3048
- // "addressRule": "",
3049
- // "memoRegex": "",
3050
- // "withdrawFee": "0.55",
3051
- // "withdrawMin": "1.1",
3052
- // "withdrawMax": "10000000000",
3053
- // "minConfirm": "12",
3054
- // "unLockConfirm": "0",
3055
- // "sameAddress": false,
3056
- // "estimatedArrivalTime": "5",
3057
- // "busy": false,
3058
- // "country": "AE,BINANCE_BAHRAIN_BSC"
3059
- // }
3060
- // ]
3061
- // }
3062
- //
3063
- // some coins (e.g. ETH, BIGTIME, SONIC, etc) return extra fields under network entry
3064
- //
3065
- // "specialTips": "",
3066
- // "specialWithdrawTips": "",
3067
- // "withdrawInternalMin": "0",
3068
- // "contractAddressUrl": "https://etherscan.io/address/",
3069
- // "contractAddress": "0x64bc2ca1be492be7185faa2c8835d9b824c8a194"
3070
- //
3071
- const entry = responseCurrencies[i];
3072
- const id = this.safeString(entry, 'coin');
3073
- const name = this.safeString(entry, 'name');
3074
- const code = this.safeCurrencyCode(id);
3075
- const isFiat = this.safeBool(entry, 'isLegalMoney');
3076
- const networkList = this.safeList(entry, 'networkList', []);
3077
- const fees = {};
3078
- const networks = {};
3079
- let isETF = false;
3080
- for (let j = 0; j < networkList.length; j++) {
3081
- const networkItem = networkList[j];
3082
- const network = this.safeString(networkItem, 'network');
3083
- const networkCode = this.networkIdToCode(network, code);
3084
- isETF = (network === 'ETF'); // ETF currencies (e.g. BTCUP, ETHDOWN) have only 1 "network" entry and are deterministic to set
3085
- // const name = this.safeString (networkItem, 'name');
3086
- const withdrawFee = this.safeNumber(networkItem, 'withdrawFee');
3087
- const depositEnable = this.safeBool(networkItem, 'depositEnable');
3088
- const withdrawEnable = this.safeBool(networkItem, 'withdrawEnable');
3089
- fees[network] = withdrawFee;
3090
- this.safeBool(networkItem, 'isDefault');
3091
- // todo: default networks in "setMarkets" overload
3092
- // if (isDefault) {
3093
- // this.options['defaultNetworkCodesForCurrencies'][code] = networkCode;
3094
- // }
3095
- let withdrawPrecision = this.omitZero(this.safeString2(networkItem, 'withdrawIntegerMultiple', 'withdrawInternalMin'));
3096
- // zero values happen only on fiat or leveraged(ETF) tokens: https://t.me/binance_api_english/393075
3097
- if (withdrawPrecision === undefined && isFiat) {
3098
- withdrawPrecision = this.safeString(this.options, 'defaultFiatWithdrawPrecision');
3099
- }
3100
- networks[networkCode] = {
3101
- 'info': networkItem,
3102
- 'id': network,
3103
- 'network': networkCode,
3104
- 'active': undefined,
3105
- 'deposit': depositEnable,
3106
- 'withdraw': withdrawEnable,
3107
- 'fee': withdrawFee,
3108
- 'precision': this.parseNumber(withdrawPrecision),
3109
- 'limits': {
3110
- 'withdraw': {
3111
- 'min': this.safeNumber(networkItem, 'withdrawMin'),
3112
- 'max': this.safeNumber(networkItem, 'withdrawMax'),
3113
- },
3114
- 'deposit': {
3115
- 'min': this.safeNumber(networkItem, 'depositDust'),
3116
- 'max': undefined,
3117
- },
3118
- },
3119
- };
3120
- }
3121
- let type = undefined;
3122
- if (isETF) {
3123
- type = 'other';
3124
- }
3125
- else if (isFiat) {
3126
- type = 'fiat';
3127
- }
3128
- else {
3129
- type = 'crypto';
3130
- }
3131
- const trading = this.safeBool(entry, 'trading');
3132
- const marginEntry = this.safeDict(marginablesById, id, {});
3133
- //
3134
- // {
3135
- // assetName: "BTC",
3136
- // assetFullName: "Bitcoin",
3137
- // isBorrowable: true,
3138
- // isMortgageable: true,
3139
- // userMinBorrow: "0",
3140
- // userMinRepay: "0",
3141
- // }
3142
- //
3143
- result[code] = this.safeCurrencyStructure({
3144
- 'id': id,
3145
- 'name': name,
3146
- 'code': code,
3147
- 'type': type,
3148
- 'precision': undefined,
3149
- 'info': entry,
3150
- 'active': trading,
3151
- 'deposit': undefined,
3152
- 'withdraw': undefined,
3153
- 'networks': networks,
3154
- 'fee': undefined,
3155
- 'fees': fees,
3156
- 'limits': undefined,
3157
- 'margin': this.safeBool(marginEntry, 'isBorrowable'),
3158
- });
2971
+ const parsed = this.parseCurrency(responseCurrencies[i]);
2972
+ const code = parsed['code'];
2973
+ const marginEntry = this.safeDict(marginablesById, parsed['id']);
2974
+ parsed['margin'] = this.safeBool(marginEntry, 'isBorrowable');
2975
+ result[code] = parsed;
3159
2976
  }
3160
2977
  return result;
3161
2978
  }
2979
+ parseCurrency(rawCurrency) {
2980
+ //
2981
+ // {
2982
+ // "coin": "LINK",
2983
+ // "depositAllEnable": true,
2984
+ // "withdrawAllEnable": true,
2985
+ // "name": "ChainLink",
2986
+ // "free": "0",
2987
+ // "locked": "0",
2988
+ // "freeze": "0",
2989
+ // "withdrawing": "0",
2990
+ // "ipoing": "0",
2991
+ // "ipoable": "0",
2992
+ // "storage": "0",
2993
+ // "isLegalMoney": false,
2994
+ // "trading": true,
2995
+ // "networkList": [
2996
+ // {
2997
+ // "network": "BSC",
2998
+ // "coin": "LINK",
2999
+ // "withdrawIntegerMultiple": "0.00000001",
3000
+ // "isDefault": false,
3001
+ // "depositEnable": true,
3002
+ // "withdrawEnable": true,
3003
+ // "depositDesc": "",
3004
+ // "withdrawDesc": "",
3005
+ // "specialTips": "",
3006
+ // "specialWithdrawTips": "The network you have selected is BSC. Please ensure that the withdrawal address supports the Binance Smart Chain network. You will lose your assets if the chosen platform does not support retrievals.",
3007
+ // "name": "BNB Smart Chain (BEP20)",
3008
+ // "resetAddressStatus": false,
3009
+ // "addressRegex": "^(0x)[0-9A-Fa-f]{40}$",
3010
+ // "addressRule": "",
3011
+ // "memoRegex": "",
3012
+ // "withdrawFee": "0.012",
3013
+ // "withdrawMin": "0.024",
3014
+ // "withdrawMax": "9999999999.99999999",
3015
+ // "minConfirm": "15",
3016
+ // "unLockConfirm": "0",
3017
+ // "sameAddress": false,
3018
+ // "estimatedArrivalTime": "5",
3019
+ // "busy": false,
3020
+ // "country": "AE,BINANCE_BAHRAIN_BSC"
3021
+ // },
3022
+ // {
3023
+ // "network": "BNB",
3024
+ // "coin": "LINK",
3025
+ // "withdrawIntegerMultiple": "0.00000001",
3026
+ // "isDefault": false,
3027
+ // "depositEnable": true,
3028
+ // "withdrawEnable": true,
3029
+ // "depositDesc": "",
3030
+ // "withdrawDesc": "",
3031
+ // "specialTips": "Both a MEMO and an Address are required to successfully deposit your LINK BEP2 tokens to Binance.",
3032
+ // "specialWithdrawTips": "",
3033
+ // "name": "BNB Beacon Chain (BEP2)",
3034
+ // "resetAddressStatus": false,
3035
+ // "addressRegex": "^(bnb1)[0-9a-z]{38}$",
3036
+ // "addressRule": "",
3037
+ // "memoRegex": "^[0-9A-Za-z\\-_]{1,120}$",
3038
+ // "withdrawFee": "0.003",
3039
+ // "withdrawMin": "0.01",
3040
+ // "withdrawMax": "10000000000",
3041
+ // "minConfirm": "1",
3042
+ // "unLockConfirm": "0",
3043
+ // "sameAddress": true,
3044
+ // "estimatedArrivalTime": "5",
3045
+ // "busy": false,
3046
+ // "country": "AE,BINANCE_BAHRAIN_BSC"
3047
+ // },
3048
+ // {
3049
+ // "network": "ETH",
3050
+ // "coin": "LINK",
3051
+ // "withdrawIntegerMultiple": "0.00000001",
3052
+ // "isDefault": true,
3053
+ // "depositEnable": true,
3054
+ // "withdrawEnable": true,
3055
+ // "depositDesc": "",
3056
+ // "withdrawDesc": "",
3057
+ // "name": "Ethereum (ERC20)",
3058
+ // "resetAddressStatus": false,
3059
+ // "addressRegex": "^(0x)[0-9A-Fa-f]{40}$",
3060
+ // "addressRule": "",
3061
+ // "memoRegex": "",
3062
+ // "withdrawFee": "0.55",
3063
+ // "withdrawMin": "1.1",
3064
+ // "withdrawMax": "10000000000",
3065
+ // "minConfirm": "12",
3066
+ // "unLockConfirm": "0",
3067
+ // "sameAddress": false,
3068
+ // "estimatedArrivalTime": "5",
3069
+ // "busy": false,
3070
+ // "country": "AE,BINANCE_BAHRAIN_BSC"
3071
+ // }
3072
+ // ]
3073
+ // }
3074
+ //
3075
+ // some coins (e.g. ETH, BIGTIME, SONIC, etc) return extra fields under network entry
3076
+ //
3077
+ // "specialTips": "",
3078
+ // "specialWithdrawTips": "",
3079
+ // "withdrawInternalMin": "0",
3080
+ // "contractAddressUrl": "https://etherscan.io/address/",
3081
+ // "contractAddress": "0x64bc2ca1be492be7185faa2c8835d9b824c8a194"
3082
+ //
3083
+ const entry = rawCurrency;
3084
+ const id = this.safeString(entry, 'coin');
3085
+ const name = this.safeString(entry, 'name');
3086
+ const code = this.safeCurrencyCode(id);
3087
+ const isFiat = this.safeBool(entry, 'isLegalMoney');
3088
+ const networkList = this.safeList(entry, 'networkList', []);
3089
+ const fees = {};
3090
+ const networks = {};
3091
+ let isETF = false;
3092
+ for (let j = 0; j < networkList.length; j++) {
3093
+ const networkItem = networkList[j];
3094
+ const network = this.safeString(networkItem, 'network');
3095
+ const networkCode = this.networkIdToCode(network, code);
3096
+ isETF = (network === 'ETF'); // ETF currencies (e.g. BTCUP, ETHDOWN) have only 1 "network" entry and are deterministic to set
3097
+ // const name = this.safeString (networkItem, 'name');
3098
+ const withdrawFee = this.safeNumber(networkItem, 'withdrawFee');
3099
+ const depositEnable = this.safeBool(networkItem, 'depositEnable');
3100
+ const withdrawEnable = this.safeBool(networkItem, 'withdrawEnable');
3101
+ fees[network] = withdrawFee;
3102
+ this.safeBool(networkItem, 'isDefault');
3103
+ // todo: default networks in "setMarkets" overload
3104
+ // if (isDefault) {
3105
+ // this.options['defaultNetworkCodesForCurrencies'][code] = networkCode;
3106
+ // }
3107
+ let withdrawPrecision = this.omitZero(this.safeString2(networkItem, 'withdrawIntegerMultiple', 'withdrawInternalMin'));
3108
+ // zero values happen only on fiat or leveraged(ETF) tokens: https://t.me/binance_api_english/393075
3109
+ if (withdrawPrecision === undefined && isFiat) {
3110
+ withdrawPrecision = this.safeString(this.options, 'defaultFiatWithdrawPrecision');
3111
+ }
3112
+ networks[networkCode] = {
3113
+ 'info': networkItem,
3114
+ 'id': network,
3115
+ 'network': networkCode,
3116
+ 'active': undefined,
3117
+ 'deposit': depositEnable,
3118
+ 'withdraw': withdrawEnable,
3119
+ 'fee': withdrawFee,
3120
+ 'precision': this.parseNumber(withdrawPrecision),
3121
+ 'limits': {
3122
+ 'withdraw': {
3123
+ 'min': this.safeNumber(networkItem, 'withdrawMin'),
3124
+ 'max': this.safeNumber(networkItem, 'withdrawMax'),
3125
+ },
3126
+ 'deposit': {
3127
+ 'min': this.safeNumber(networkItem, 'depositDust'),
3128
+ 'max': undefined,
3129
+ },
3130
+ },
3131
+ };
3132
+ }
3133
+ let type = undefined;
3134
+ if (isETF) {
3135
+ type = 'other';
3136
+ }
3137
+ else if (isFiat) {
3138
+ type = 'fiat';
3139
+ }
3140
+ else {
3141
+ type = 'crypto';
3142
+ }
3143
+ const trading = this.safeBool(entry, 'trading');
3144
+ return this.safeCurrencyStructure({
3145
+ 'id': id,
3146
+ 'name': name,
3147
+ 'code': code,
3148
+ 'type': type,
3149
+ 'precision': undefined,
3150
+ 'info': entry,
3151
+ 'active': trading,
3152
+ 'deposit': undefined,
3153
+ 'withdraw': undefined,
3154
+ 'networks': networks,
3155
+ 'fee': undefined,
3156
+ 'fees': fees,
3157
+ 'limits': undefined,
3158
+ });
3159
+ }
3162
3160
  /**
3163
3161
  * @method
3164
3162
  * @name binance#fetchMarkets
@@ -4157,7 +4155,7 @@ class binance extends binance$1["default"] {
4157
4155
  //
4158
4156
  // {
4159
4157
  // "symbol": "BTCUSDT",
4160
- // "markPrice": "11793.63104562", // mark price
4158
+ // "markPrice": "11793.63104563", // mark price
4161
4159
  // "indexPrice": "11781.80495970", // index price
4162
4160
  // "estimatedSettlePrice": "11781.16138815", // Estimated Settle Price, only useful in the last hour before the settlement starts
4163
4161
  // "lastFundingRate": "0.00038246", // This is the lastest estimated funding rate
@@ -10523,7 +10521,7 @@ class binance extends binance$1["default"] {
10523
10521
  const rounderString = rounder.toString();
10524
10522
  const liquidationPriceRoundedString = Precise["default"].stringAdd(rounderString, liquidationPriceStringRaw);
10525
10523
  let truncatedLiquidationPrice = Precise["default"].stringDiv(liquidationPriceRoundedString, '1', pricePrecision);
10526
- if (truncatedLiquidationPrice[0] === '-') {
10524
+ if (truncatedLiquidationPrice !== undefined && truncatedLiquidationPrice[0] === '-') {
10527
10525
  // user cannot be liquidated
10528
10526
  // since he has more collateral than the size of the position
10529
10527
  truncatedLiquidationPrice = undefined;
@@ -880,7 +880,7 @@ class bingx extends bingx$1["default"] {
880
880
  for (let j = 0; j < networkList.length; j++) {
881
881
  const rawNetwork = networkList[j];
882
882
  const network = this.safeString(rawNetwork, 'network');
883
- const networkCode = this.networkIdToCode(network);
883
+ const networkCode = this.networkIdToCode(network, code);
884
884
  const limits = {
885
885
  'withdraw': {
886
886
  'min': this.safeNumber(rawNetwork, 'withdrawMin'),
@@ -5507,7 +5507,7 @@ class bingx extends bingx$1["default"] {
5507
5507
  'txid': this.safeString(transaction, 'txId'),
5508
5508
  'type': type,
5509
5509
  'currency': code,
5510
- 'network': this.networkIdToCode(network),
5510
+ 'network': this.networkIdToCode(network, code),
5511
5511
  'amount': this.safeNumber(transaction, 'amount'),
5512
5512
  'status': this.parseTransactionStatus(this.safeString(transaction, 'status')),
5513
5513
  'timestamp': timestamp,
@@ -6058,7 +6058,7 @@ class bingx extends bingx$1["default"] {
6058
6058
  };
6059
6059
  const network = this.safeStringUpper(params, 'network');
6060
6060
  if (network !== undefined) {
6061
- request['network'] = this.networkCodeToId(network);
6061
+ request['network'] = this.networkCodeToId(network, currency['code']);
6062
6062
  }
6063
6063
  if (tag !== undefined) {
6064
6064
  request['addressTag'] = tag;
@@ -851,74 +851,87 @@ class bitfinex extends bitfinex$1["default"] {
851
851
  indexedNetworks[networkName] = networksList;
852
852
  }
853
853
  const ids = this.safeList(response, 0, []);
854
- const result = {};
854
+ return this.parseCurrenciesCustom(ids, indexed, indexedNetworks);
855
+ }
856
+ parseCurrenciesCustom(ids, indexed, indexedNetworks) {
857
+ const allowedIds = [];
855
858
  for (let i = 0; i < ids.length; i++) {
856
859
  const id = ids[i];
857
860
  if (id.endsWith('F0')) {
858
861
  // we get a lot of F0 currencies, skip those
859
862
  continue;
860
863
  }
861
- const code = this.safeCurrencyCode(id);
862
- const label = this.safeList(indexed['label'], id, []);
863
- const name = this.safeString(label, 1);
864
- const pool = this.safeList(indexed['pool'], id, []);
865
- const rawType = this.safeString(pool, 1);
866
- const isCryptoCoin = (rawType !== undefined) || (id in indexed['explorer']); // "hacky" solution
867
- const type = isCryptoCoin ? 'crypto' : undefined;
868
- const feeValues = this.safeList(indexed['fees'], id, []);
869
- const fees = this.safeList(feeValues, 1, []);
870
- const fee = this.safeNumber(fees, 1);
871
- const undl = this.safeList(indexed['undl'], id, []);
872
- const precision = this.safeString(this.options, 'defaultCurrencyPrecision', '8');
873
- const networks = {};
874
- const netwokIds = this.safeList(indexedNetworks, id, []);
875
- for (let j = 0; j < netwokIds.length; j++) {
876
- const networkId = netwokIds[j];
877
- const network = this.networkIdToCode(networkId);
878
- const dwStatuses = this.safeList(indexed['statuses'], networkId, []);
879
- networks[network] = {
880
- 'info': networkId,
881
- 'id': networkId.toLowerCase(),
882
- 'network': networkId,
883
- 'active': undefined,
884
- 'deposit': this.safeInteger(dwStatuses, 1) === 1,
885
- 'withdraw': this.safeInteger(dwStatuses, 2) === 1,
886
- 'fee': undefined,
887
- 'precision': undefined,
888
- 'limits': {
889
- 'withdraw': {
890
- 'min': undefined,
891
- 'max': undefined,
892
- },
893
- },
894
- };
895
- }
896
- result[code] = this.safeCurrencyStructure({
897
- 'id': id,
898
- 'code': code,
899
- 'info': [id, label, pool, feeValues, undl],
900
- 'type': type,
901
- 'name': name,
902
- 'active': true,
903
- 'deposit': undefined,
904
- 'withdraw': undefined,
905
- 'fee': fee,
906
- 'precision': this.parseNumber(precision),
864
+ allowedIds.push(id);
865
+ }
866
+ const result = {};
867
+ const arr = this.toArray(allowedIds);
868
+ for (let i = 0; i < arr.length; i++) {
869
+ const parsed = this.parseCurrencyCustom(arr[i], indexed, indexedNetworks);
870
+ const code = parsed['code'];
871
+ result[code] = parsed;
872
+ }
873
+ return result;
874
+ }
875
+ parseCurrencyCustom(id, indexed, indexedNetworks) {
876
+ const code = this.safeCurrencyCode(id);
877
+ const label = this.safeList(indexed['label'], id, []);
878
+ const name = this.safeString(label, 1);
879
+ const pool = this.safeList(indexed['pool'], id, []);
880
+ const rawType = this.safeString(pool, 1);
881
+ const isCryptoCoin = (rawType !== undefined) || (id in indexed['explorer']); // "hacky" solution
882
+ const type = isCryptoCoin ? 'crypto' : undefined;
883
+ const feeValues = this.safeList(indexed['fees'], id, []);
884
+ const fees = this.safeList(feeValues, 1, []);
885
+ const fee = this.safeNumber(fees, 1);
886
+ const undl = this.safeList(indexed['undl'], id, []);
887
+ const precision = this.safeString(this.options, 'defaultCurrencyPrecision', '8');
888
+ const networks = {};
889
+ const networkIds = this.safeList(indexedNetworks, id, []);
890
+ for (let j = 0; j < networkIds.length; j++) {
891
+ const networkId = networkIds[j];
892
+ const network = this.networkIdToCode(networkId, code);
893
+ const dwStatuses = this.safeList(indexed['statuses'], networkId, []);
894
+ networks[network] = {
895
+ 'info': networkId,
896
+ 'id': networkId.toLowerCase(),
897
+ 'network': networkId,
898
+ 'active': undefined,
899
+ 'deposit': this.safeInteger(dwStatuses, 1) === 1,
900
+ 'withdraw': this.safeInteger(dwStatuses, 2) === 1,
901
+ 'fee': undefined,
902
+ 'precision': undefined,
907
903
  'limits': {
908
- 'amount': {
909
- 'min': undefined,
910
- 'max': undefined,
911
- },
912
904
  'withdraw': {
913
- 'min': fee,
905
+ 'min': undefined,
914
906
  'max': undefined,
915
907
  },
916
908
  },
917
- 'networks': networks,
918
- 'margin': this.inArray(id, indexed['marginables']),
919
- });
909
+ };
920
910
  }
921
- return result;
911
+ return this.safeCurrencyStructure({
912
+ 'id': id,
913
+ 'code': code,
914
+ 'info': [id, label, pool, feeValues, undl],
915
+ 'type': type,
916
+ 'name': name,
917
+ 'active': true,
918
+ 'deposit': undefined,
919
+ 'withdraw': undefined,
920
+ 'fee': fee,
921
+ 'precision': this.parseNumber(precision),
922
+ 'limits': {
923
+ 'amount': {
924
+ 'min': undefined,
925
+ 'max': undefined,
926
+ },
927
+ 'withdraw': {
928
+ 'min': fee,
929
+ 'max': undefined,
930
+ },
931
+ },
932
+ 'networks': networks,
933
+ 'margin': this.inArray(id, indexed['marginables']),
934
+ });
922
935
  }
923
936
  /**
924
937
  * @method
@@ -2487,14 +2500,14 @@ class bitfinex extends bitfinex$1["default"] {
2487
2500
  tag = this.safeString(data, 3);
2488
2501
  type = 'withdrawal';
2489
2502
  const networkId = this.safeString(data, 2);
2490
- network = this.networkIdToCode(networkId.toUpperCase()); // withdraw returns in lowercase
2503
+ network = this.networkIdToCode(networkId.toUpperCase(), code); // withdraw returns in lowercase
2491
2504
  }
2492
2505
  else if (transactionLength === 22) {
2493
2506
  id = this.safeString(transaction, 0);
2494
2507
  const currencyId = this.safeString(transaction, 1);
2495
2508
  code = this.safeCurrencyCode(currencyId, currency);
2496
2509
  const networkId = this.safeString(transaction, 2);
2497
- network = this.networkIdToCode(networkId);
2510
+ network = this.networkIdToCode(networkId, code);
2498
2511
  timestamp = this.safeInteger(transaction, 5);
2499
2512
  updated = this.safeInteger(transaction, 6);
2500
2513
  status = this.parseTransactionStatus(this.safeString(transaction, 9));
@@ -2896,7 +2896,7 @@ class bitget extends bitget$1["default"] {
2896
2896
  }
2897
2897
  await this.loadMarkets();
2898
2898
  const currency = this.currency(code);
2899
- const networkId = this.networkCodeToId(networkCode);
2899
+ const networkId = this.networkCodeToId(networkCode, code);
2900
2900
  const request = {
2901
2901
  'coin': currency['id'],
2902
2902
  'address': address,
@@ -3065,7 +3065,7 @@ class bitget extends bitget$1["default"] {
3065
3065
  'txid': this.safeString(transaction, 'tradeId'),
3066
3066
  'timestamp': timestamp,
3067
3067
  'datetime': this.iso8601(timestamp),
3068
- 'network': this.networkIdToCode(networkId),
3068
+ 'network': this.networkIdToCode(networkId, code),
3069
3069
  'addressFrom': this.safeString(transaction, 'fromAddress'),
3070
3070
  'address': this.safeString(transaction, 'toAddress'),
3071
3071
  'addressTo': this.safeString(transaction, 'toAddress'),