ccxt 4.2.11 → 4.2.12

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 (375) hide show
  1. package/README.md +5 -5
  2. package/build.sh +2 -2
  3. package/dist/ccxt.browser.js +640 -261
  4. package/dist/ccxt.browser.min.js +3 -3
  5. package/dist/cjs/_virtual/agent.js +7 -0
  6. package/dist/cjs/_virtual/parse-proxy-response.js +7 -0
  7. package/dist/cjs/_virtual/promisify.js +7 -0
  8. package/dist/cjs/ccxt.js +1 -1
  9. package/dist/cjs/js/ccxt.js +474 -0
  10. package/dist/cjs/js/src/abstract/ace.js +9 -0
  11. package/dist/cjs/js/src/abstract/alpaca.js +9 -0
  12. package/dist/cjs/js/src/abstract/ascendex.js +9 -0
  13. package/dist/cjs/js/src/abstract/bigone.js +9 -0
  14. package/dist/cjs/js/src/abstract/binance.js +9 -0
  15. package/dist/cjs/js/src/abstract/bingx.js +9 -0
  16. package/dist/cjs/js/src/abstract/bit2c.js +9 -0
  17. package/dist/cjs/js/src/abstract/bitbank.js +9 -0
  18. package/dist/cjs/js/src/abstract/bitbns.js +9 -0
  19. package/dist/cjs/js/src/abstract/bitfinex.js +9 -0
  20. package/dist/cjs/js/src/abstract/bitfinex2.js +9 -0
  21. package/dist/cjs/js/src/abstract/bitflyer.js +9 -0
  22. package/dist/cjs/js/src/abstract/bitforex.js +9 -0
  23. package/dist/cjs/js/src/abstract/bitget.js +9 -0
  24. package/dist/cjs/js/src/abstract/bithumb.js +9 -0
  25. package/dist/cjs/js/src/abstract/bitmart.js +9 -0
  26. package/dist/cjs/js/src/abstract/bitmex.js +9 -0
  27. package/dist/cjs/js/src/abstract/bitopro.js +9 -0
  28. package/dist/cjs/js/src/abstract/bitpanda.js +9 -0
  29. package/dist/cjs/js/src/abstract/bitrue.js +9 -0
  30. package/dist/cjs/js/src/abstract/bitso.js +9 -0
  31. package/dist/cjs/js/src/abstract/bitstamp.js +9 -0
  32. package/dist/cjs/js/src/abstract/bitteam.js +9 -0
  33. package/dist/cjs/js/src/abstract/bitvavo.js +9 -0
  34. package/dist/cjs/js/src/abstract/bl3p.js +9 -0
  35. package/dist/cjs/js/src/abstract/blockchaincom.js +9 -0
  36. package/dist/cjs/js/src/abstract/btcalpha.js +9 -0
  37. package/dist/cjs/js/src/abstract/btcbox.js +9 -0
  38. package/dist/cjs/js/src/abstract/btcmarkets.js +9 -0
  39. package/dist/cjs/js/src/abstract/btcturk.js +9 -0
  40. package/dist/cjs/js/src/abstract/bybit.js +9 -0
  41. package/dist/cjs/js/src/abstract/cex.js +9 -0
  42. package/dist/cjs/js/src/abstract/coinbase.js +9 -0
  43. package/dist/cjs/js/src/abstract/coinbasepro.js +9 -0
  44. package/dist/cjs/js/src/abstract/coincheck.js +9 -0
  45. package/dist/cjs/js/src/abstract/coinex.js +9 -0
  46. package/dist/cjs/js/src/abstract/coinlist.js +9 -0
  47. package/dist/cjs/js/src/abstract/coinmate.js +9 -0
  48. package/dist/cjs/js/src/abstract/coinone.js +9 -0
  49. package/dist/cjs/js/src/abstract/coinsph.js +9 -0
  50. package/dist/cjs/js/src/abstract/coinspot.js +9 -0
  51. package/dist/cjs/js/src/abstract/cryptocom.js +9 -0
  52. package/dist/cjs/js/src/abstract/currencycom.js +9 -0
  53. package/dist/cjs/js/src/abstract/delta.js +9 -0
  54. package/dist/cjs/js/src/abstract/deribit.js +9 -0
  55. package/dist/cjs/js/src/abstract/digifinex.js +9 -0
  56. package/dist/cjs/js/src/abstract/exmo.js +9 -0
  57. package/dist/cjs/js/src/abstract/gate.js +9 -0
  58. package/dist/cjs/js/src/abstract/gemini.js +9 -0
  59. package/dist/cjs/js/src/abstract/hitbtc.js +9 -0
  60. package/dist/cjs/js/src/abstract/hollaex.js +9 -0
  61. package/dist/cjs/js/src/abstract/htx.js +9 -0
  62. package/dist/cjs/js/src/abstract/huobijp.js +9 -0
  63. package/dist/cjs/js/src/abstract/idex.js +9 -0
  64. package/dist/cjs/js/src/abstract/independentreserve.js +9 -0
  65. package/dist/cjs/js/src/abstract/indodax.js +9 -0
  66. package/dist/cjs/js/src/abstract/kraken.js +9 -0
  67. package/dist/cjs/js/src/abstract/krakenfutures.js +9 -0
  68. package/dist/cjs/js/src/abstract/kucoin.js +9 -0
  69. package/dist/cjs/js/src/abstract/kucoinfutures.js +9 -0
  70. package/dist/cjs/js/src/abstract/kuna.js +9 -0
  71. package/dist/cjs/js/src/abstract/latoken.js +9 -0
  72. package/dist/cjs/js/src/abstract/lbank.js +9 -0
  73. package/dist/cjs/js/src/abstract/luno.js +9 -0
  74. package/dist/cjs/js/src/abstract/lykke.js +9 -0
  75. package/dist/cjs/js/src/abstract/mercado.js +9 -0
  76. package/dist/cjs/js/src/abstract/mexc.js +9 -0
  77. package/dist/cjs/js/src/abstract/ndax.js +9 -0
  78. package/dist/cjs/js/src/abstract/novadax.js +9 -0
  79. package/dist/cjs/js/src/abstract/oceanex.js +9 -0
  80. package/dist/cjs/js/src/abstract/okcoin.js +9 -0
  81. package/dist/cjs/js/src/abstract/okx.js +9 -0
  82. package/dist/cjs/js/src/abstract/p2b.js +9 -0
  83. package/dist/cjs/js/src/abstract/paymium.js +9 -0
  84. package/dist/cjs/js/src/abstract/phemex.js +9 -0
  85. package/dist/cjs/js/src/abstract/poloniex.js +9 -0
  86. package/dist/cjs/js/src/abstract/poloniexfutures.js +9 -0
  87. package/dist/cjs/js/src/abstract/probit.js +9 -0
  88. package/dist/cjs/js/src/abstract/timex.js +9 -0
  89. package/dist/cjs/js/src/abstract/tokocrypto.js +9 -0
  90. package/dist/cjs/js/src/abstract/upbit.js +9 -0
  91. package/dist/cjs/js/src/abstract/wavesexchange.js +9 -0
  92. package/dist/cjs/js/src/abstract/wazirx.js +9 -0
  93. package/dist/cjs/js/src/abstract/whitebit.js +9 -0
  94. package/dist/cjs/js/src/abstract/woo.js +9 -0
  95. package/dist/cjs/js/src/abstract/yobit.js +9 -0
  96. package/dist/cjs/js/src/abstract/zaif.js +9 -0
  97. package/dist/cjs/js/src/abstract/zonda.js +9 -0
  98. package/dist/cjs/js/src/ace.js +1058 -0
  99. package/dist/cjs/js/src/alpaca.js +1125 -0
  100. package/dist/cjs/js/src/ascendex.js +3360 -0
  101. package/dist/cjs/js/src/base/Exchange.js +5110 -0
  102. package/dist/cjs/js/src/base/Precise.js +263 -0
  103. package/dist/cjs/js/src/base/errors.js +299 -0
  104. package/dist/cjs/js/src/base/functions/crypto.js +78 -0
  105. package/dist/cjs/js/src/base/functions/encode.js +44 -0
  106. package/dist/cjs/js/src/base/functions/generic.js +193 -0
  107. package/dist/cjs/js/src/base/functions/misc.js +96 -0
  108. package/dist/cjs/js/src/base/functions/number.js +297 -0
  109. package/dist/cjs/js/src/base/functions/platform.js +28 -0
  110. package/dist/cjs/js/src/base/functions/rsa.js +34 -0
  111. package/dist/cjs/js/src/base/functions/string.js +48 -0
  112. package/dist/cjs/js/src/base/functions/throttle.js +66 -0
  113. package/dist/cjs/js/src/base/functions/time.js +187 -0
  114. package/dist/cjs/js/src/base/functions/totp.js +24 -0
  115. package/dist/cjs/js/src/base/functions/type.js +162 -0
  116. package/dist/cjs/js/src/base/functions.js +157 -0
  117. package/dist/cjs/js/src/base/ws/Cache.js +254 -0
  118. package/dist/cjs/js/src/base/ws/Client.js +299 -0
  119. package/dist/cjs/js/src/base/ws/Future.js +34 -0
  120. package/dist/cjs/js/src/base/ws/OrderBook.js +107 -0
  121. package/dist/cjs/js/src/base/ws/OrderBookSide.js +281 -0
  122. package/dist/cjs/js/src/base/ws/WsClient.js +69 -0
  123. package/dist/cjs/js/src/bequant.js +33 -0
  124. package/dist/cjs/js/src/bigone.js +2142 -0
  125. package/dist/cjs/js/src/binance.js +9729 -0
  126. package/dist/cjs/js/src/binancecoinm.js +45 -0
  127. package/dist/cjs/js/src/binanceus.js +84 -0
  128. package/dist/cjs/js/src/binanceusdm.js +58 -0
  129. package/dist/cjs/js/src/bingx.js +3737 -0
  130. package/dist/cjs/js/src/bit2c.js +916 -0
  131. package/dist/cjs/js/src/bitbank.js +1000 -0
  132. package/dist/cjs/js/src/bitbay.js +17 -0
  133. package/dist/cjs/js/src/bitbns.js +1220 -0
  134. package/dist/cjs/js/src/bitcoincom.js +17 -0
  135. package/dist/cjs/js/src/bitfinex.js +1670 -0
  136. package/dist/cjs/js/src/bitfinex2.js +2990 -0
  137. package/dist/cjs/js/src/bitflyer.js +1045 -0
  138. package/dist/cjs/js/src/bitforex.js +852 -0
  139. package/dist/cjs/js/src/bitget.js +8284 -0
  140. package/dist/cjs/js/src/bithumb.js +1090 -0
  141. package/dist/cjs/js/src/bitmart.js +4454 -0
  142. package/dist/cjs/js/src/bitmex.js +2884 -0
  143. package/dist/cjs/js/src/bitopro.js +1724 -0
  144. package/dist/cjs/js/src/bitpanda.js +2002 -0
  145. package/dist/cjs/js/src/bitrue.js +3253 -0
  146. package/dist/cjs/js/src/bitso.js +1753 -0
  147. package/dist/cjs/js/src/bitstamp.js +2188 -0
  148. package/dist/cjs/js/src/bitteam.js +2309 -0
  149. package/dist/cjs/js/src/bitvavo.js +1968 -0
  150. package/dist/cjs/js/src/bl3p.js +447 -0
  151. package/dist/cjs/js/src/blockchaincom.js +1160 -0
  152. package/dist/cjs/js/src/btcalpha.js +929 -0
  153. package/dist/cjs/js/src/btcbox.js +565 -0
  154. package/dist/cjs/js/src/btcmarkets.js +1237 -0
  155. package/dist/cjs/js/src/btcturk.js +929 -0
  156. package/dist/cjs/js/src/bybit.js +7646 -0
  157. package/dist/cjs/js/src/cex.js +1693 -0
  158. package/dist/cjs/js/src/coinbase.js +3274 -0
  159. package/dist/cjs/js/src/coinbasepro.js +1866 -0
  160. package/dist/cjs/js/src/coincheck.js +843 -0
  161. package/dist/cjs/js/src/coinex.js +5414 -0
  162. package/dist/cjs/js/src/coinlist.js +2329 -0
  163. package/dist/cjs/js/src/coinmate.js +989 -0
  164. package/dist/cjs/js/src/coinone.js +1185 -0
  165. package/dist/cjs/js/src/coinsph.js +1933 -0
  166. package/dist/cjs/js/src/coinspot.js +548 -0
  167. package/dist/cjs/js/src/cryptocom.js +3007 -0
  168. package/dist/cjs/js/src/currencycom.js +2015 -0
  169. package/dist/cjs/js/src/delta.js +3256 -0
  170. package/dist/cjs/js/src/deribit.js +3306 -0
  171. package/dist/cjs/js/src/digifinex.js +4307 -0
  172. package/dist/cjs/js/src/exmo.js +2645 -0
  173. package/dist/cjs/js/src/fmfwio.js +34 -0
  174. package/dist/cjs/js/src/gate.js +7054 -0
  175. package/dist/cjs/js/src/gateio.js +16 -0
  176. package/dist/cjs/js/src/gemini.js +1801 -0
  177. package/dist/cjs/js/src/hitbtc.js +3660 -0
  178. package/dist/cjs/js/src/hitbtc3.js +19 -0
  179. package/dist/cjs/js/src/hollaex.js +1882 -0
  180. package/dist/cjs/js/src/htx.js +9024 -0
  181. package/dist/cjs/js/src/huobi.js +16 -0
  182. package/dist/cjs/js/src/huobijp.js +1918 -0
  183. package/dist/cjs/js/src/idex.js +1770 -0
  184. package/dist/cjs/js/src/independentreserve.js +759 -0
  185. package/dist/cjs/js/src/indodax.js +1069 -0
  186. package/dist/cjs/js/src/kraken.js +2861 -0
  187. package/dist/cjs/js/src/krakenfutures.js +2407 -0
  188. package/dist/cjs/js/src/kucoin.js +4489 -0
  189. package/dist/cjs/js/src/kucoinfutures.js +2475 -0
  190. package/dist/cjs/js/src/kuna.js +1949 -0
  191. package/dist/cjs/js/src/latoken.js +1729 -0
  192. package/dist/cjs/js/src/lbank.js +2825 -0
  193. package/dist/cjs/js/src/luno.js +1044 -0
  194. package/dist/cjs/js/src/lykke.js +1303 -0
  195. package/dist/cjs/js/src/mercado.js +897 -0
  196. package/dist/cjs/js/src/mexc.js +5407 -0
  197. package/dist/cjs/js/src/ndax.js +2450 -0
  198. package/dist/cjs/js/src/novadax.js +1556 -0
  199. package/dist/cjs/js/src/oceanex.js +964 -0
  200. package/dist/cjs/js/src/okcoin.js +3115 -0
  201. package/dist/cjs/js/src/okx.js +7329 -0
  202. package/dist/cjs/js/src/p2b.js +1243 -0
  203. package/dist/cjs/js/src/paymium.js +597 -0
  204. package/dist/cjs/js/src/phemex.js +4715 -0
  205. package/dist/cjs/js/src/poloniex.js +2356 -0
  206. package/dist/cjs/js/src/poloniexfutures.js +1794 -0
  207. package/dist/cjs/js/src/pro/alpaca.js +714 -0
  208. package/dist/cjs/js/src/pro/ascendex.js +957 -0
  209. package/dist/cjs/js/src/pro/bequant.js +33 -0
  210. package/dist/cjs/js/src/pro/binance.js +2796 -0
  211. package/dist/cjs/js/src/pro/binancecoinm.js +23 -0
  212. package/dist/cjs/js/src/pro/binanceus.js +51 -0
  213. package/dist/cjs/js/src/pro/binanceusdm.js +32 -0
  214. package/dist/cjs/js/src/pro/bingx.js +944 -0
  215. package/dist/cjs/js/src/pro/bitcoincom.js +29 -0
  216. package/dist/cjs/js/src/pro/bitfinex.js +672 -0
  217. package/dist/cjs/js/src/pro/bitfinex2.js +1159 -0
  218. package/dist/cjs/js/src/pro/bitget.js +1733 -0
  219. package/dist/cjs/js/src/pro/bitmart.js +1486 -0
  220. package/dist/cjs/js/src/pro/bitmex.js +1576 -0
  221. package/dist/cjs/js/src/pro/bitopro.js +327 -0
  222. package/dist/cjs/js/src/pro/bitpanda.js +1341 -0
  223. package/dist/cjs/js/src/pro/bitrue.js +462 -0
  224. package/dist/cjs/js/src/pro/bitstamp.js +547 -0
  225. package/dist/cjs/js/src/pro/bitvavo.js +704 -0
  226. package/dist/cjs/js/src/pro/blockchaincom.js +794 -0
  227. package/dist/cjs/js/src/pro/bybit.js +1843 -0
  228. package/dist/cjs/js/src/pro/cex.js +1510 -0
  229. package/dist/cjs/js/src/pro/coinbase.js +561 -0
  230. package/dist/cjs/js/src/pro/coinbasepro.js +968 -0
  231. package/dist/cjs/js/src/pro/coinex.js +1095 -0
  232. package/dist/cjs/js/src/pro/cryptocom.js +1020 -0
  233. package/dist/cjs/js/src/pro/currencycom.js +563 -0
  234. package/dist/cjs/js/src/pro/deribit.js +825 -0
  235. package/dist/cjs/js/src/pro/exmo.js +658 -0
  236. package/dist/cjs/js/src/pro/gate.js +1316 -0
  237. package/dist/cjs/js/src/pro/gateio.js +16 -0
  238. package/dist/cjs/js/src/pro/gemini.js +649 -0
  239. package/dist/cjs/js/src/pro/hitbtc.js +1293 -0
  240. package/dist/cjs/js/src/pro/hollaex.js +597 -0
  241. package/dist/cjs/js/src/pro/htx.js +2383 -0
  242. package/dist/cjs/js/src/pro/huobi.js +16 -0
  243. package/dist/cjs/js/src/pro/huobijp.js +606 -0
  244. package/dist/cjs/js/src/pro/idex.js +714 -0
  245. package/dist/cjs/js/src/pro/independentreserve.js +280 -0
  246. package/dist/cjs/js/src/pro/kraken.js +1364 -0
  247. package/dist/cjs/js/src/pro/krakenfutures.js +1500 -0
  248. package/dist/cjs/js/src/pro/kucoin.js +1052 -0
  249. package/dist/cjs/js/src/pro/kucoinfutures.js +981 -0
  250. package/dist/cjs/js/src/pro/luno.js +322 -0
  251. package/dist/cjs/js/src/pro/mexc.js +1170 -0
  252. package/dist/cjs/js/src/pro/ndax.js +545 -0
  253. package/dist/cjs/js/src/pro/okcoin.js +760 -0
  254. package/dist/cjs/js/src/pro/okx.js +1558 -0
  255. package/dist/cjs/js/src/pro/phemex.js +1511 -0
  256. package/dist/cjs/js/src/pro/poloniex.js +1253 -0
  257. package/dist/cjs/js/src/pro/poloniexfutures.js +1014 -0
  258. package/dist/cjs/js/src/pro/probit.js +586 -0
  259. package/dist/cjs/js/src/pro/upbit.js +234 -0
  260. package/dist/cjs/js/src/pro/wazirx.js +776 -0
  261. package/dist/cjs/js/src/pro/whitebit.js +927 -0
  262. package/dist/cjs/js/src/pro/woo.js +769 -0
  263. package/dist/cjs/js/src/probit.js +1865 -0
  264. package/dist/cjs/js/src/static_dependencies/fflake/browser.js +401 -0
  265. package/dist/cjs/js/src/static_dependencies/jsencrypt/JSEncrypt.js +195 -0
  266. package/dist/cjs/js/src/static_dependencies/jsencrypt/JSEncryptRSAKey.js +308 -0
  267. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/asn1js/asn1.js +554 -0
  268. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/asn1js/base64.js +94 -0
  269. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/asn1js/hex.js +70 -0
  270. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/asn1js/int10.js +91 -0
  271. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsbn/base64.js +16 -0
  272. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.js +1760 -0
  273. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsbn/prng4.js +52 -0
  274. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsbn/rng.js +81 -0
  275. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsbn/rsa.js +376 -0
  276. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsbn/util.js +70 -0
  277. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsrsasign/asn1-1.0.js +1580 -0
  278. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsrsasign/yahoo.js +74 -0
  279. package/dist/cjs/js/src/static_dependencies/noble-curves/_shortw_utils.js +24 -0
  280. package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/curve.js +158 -0
  281. package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/edwards.js +429 -0
  282. package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/hash-to-curve.js +176 -0
  283. package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/modular.js +324 -0
  284. package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/montgomery.js +163 -0
  285. package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/utils.js +245 -0
  286. package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/weierstrass.js +1018 -0
  287. package/dist/cjs/js/src/static_dependencies/noble-curves/ed25519.js +383 -0
  288. package/dist/cjs/js/src/static_dependencies/noble-curves/secp256k1.js +258 -0
  289. package/dist/cjs/js/src/static_dependencies/noble-hashes/_assert.js +53 -0
  290. package/dist/cjs/js/src/static_dependencies/noble-hashes/_sha2.js +120 -0
  291. package/dist/cjs/js/src/static_dependencies/noble-hashes/_u64.js +69 -0
  292. package/dist/cjs/js/src/static_dependencies/noble-hashes/crypto.js +7 -0
  293. package/dist/cjs/js/src/static_dependencies/noble-hashes/hmac.js +83 -0
  294. package/dist/cjs/js/src/static_dependencies/noble-hashes/md5.js +240 -0
  295. package/dist/cjs/js/src/static_dependencies/noble-hashes/sha1.js +91 -0
  296. package/dist/cjs/js/src/static_dependencies/noble-hashes/sha256.js +130 -0
  297. package/dist/cjs/js/src/static_dependencies/noble-hashes/sha3.js +214 -0
  298. package/dist/cjs/js/src/static_dependencies/noble-hashes/sha512.js +239 -0
  299. package/dist/cjs/js/src/static_dependencies/noble-hashes/utils.js +93 -0
  300. package/dist/cjs/js/src/static_dependencies/node-fetch/body.js +354 -0
  301. package/dist/cjs/js/src/static_dependencies/node-fetch/errors/abort-error.js +16 -0
  302. package/dist/cjs/js/src/static_dependencies/node-fetch/errors/base.js +20 -0
  303. package/dist/cjs/js/src/static_dependencies/node-fetch/errors/fetch-error.js +30 -0
  304. package/dist/cjs/js/src/static_dependencies/node-fetch/headers.js +239 -0
  305. package/dist/cjs/js/src/static_dependencies/node-fetch/index.js +372 -0
  306. package/dist/cjs/js/src/static_dependencies/node-fetch/request.js +273 -0
  307. package/dist/cjs/js/src/static_dependencies/node-fetch/response.js +139 -0
  308. package/dist/cjs/js/src/static_dependencies/node-fetch/utils/get-search.js +14 -0
  309. package/dist/cjs/js/src/static_dependencies/node-fetch/utils/is-redirect.js +16 -0
  310. package/dist/cjs/js/src/static_dependencies/node-fetch/utils/is.js +81 -0
  311. package/dist/cjs/js/src/static_dependencies/node-fetch/utils/referrer.js +292 -0
  312. package/dist/cjs/js/src/static_dependencies/proxies/agent-base/index.js +103 -0
  313. package/dist/cjs/js/src/static_dependencies/proxies/http-proxy-agent/index.js +140 -0
  314. package/dist/cjs/js/src/static_dependencies/proxies/https-proxy-agent/index.js +175 -0
  315. package/dist/cjs/js/src/static_dependencies/proxies/https-proxy-agent/parse-proxy-response.js +95 -0
  316. package/dist/cjs/js/src/static_dependencies/qs/index.cjs.js +7 -0
  317. package/dist/cjs/js/src/static_dependencies/scure-base/index.js +383 -0
  318. package/dist/cjs/js/src/timex.js +1562 -0
  319. package/dist/cjs/js/src/tokocrypto.js +2542 -0
  320. package/dist/cjs/js/src/upbit.js +1844 -0
  321. package/dist/cjs/js/src/wavesexchange.js +2607 -0
  322. package/dist/cjs/js/src/wazirx.js +953 -0
  323. package/dist/cjs/js/src/whitebit.js +2309 -0
  324. package/dist/cjs/js/src/woo.js +2715 -0
  325. package/dist/cjs/js/src/yobit.js +1314 -0
  326. package/dist/cjs/js/src/zaif.js +736 -0
  327. package/dist/cjs/js/src/zonda.js +1883 -0
  328. package/js/ccxt.d.ts +1 -1
  329. package/js/ccxt.js +1 -1
  330. package/js/src/abstract/bigone.d.ts +18 -0
  331. package/js/src/abstract/binance.d.ts +2 -0
  332. package/js/src/abstract/binancecoinm.d.ts +2 -0
  333. package/js/src/abstract/binanceus.d.ts +2 -0
  334. package/js/src/abstract/binanceusdm.d.ts +2 -0
  335. package/js/src/abstract/bybit.d.ts +1 -0
  336. package/js/src/abstract/gate.d.ts +11 -0
  337. package/js/src/abstract/gateio.d.ts +11 -0
  338. package/js/src/alpaca.js +18 -18
  339. package/js/src/base/Exchange.d.ts +5 -1
  340. package/js/src/base/Exchange.js +101 -12
  341. package/js/src/bigone.d.ts +1 -2
  342. package/js/src/bigone.js +340 -145
  343. package/js/src/binance.js +15 -8
  344. package/js/src/bingx.js +9 -2
  345. package/js/src/bitfinex.d.ts +2 -2
  346. package/js/src/bitfinex.js +2 -3
  347. package/js/src/bitget.js +21 -8
  348. package/js/src/bitmart.d.ts +2 -2
  349. package/js/src/bitmart.js +3 -3
  350. package/js/src/bitmex.js +1 -0
  351. package/js/src/bybit.js +2 -0
  352. package/js/src/coinlist.js +2 -3
  353. package/js/src/coinsph.js +2 -3
  354. package/js/src/deribit.js +1 -0
  355. package/js/src/gate.d.ts +4 -4
  356. package/js/src/gate.js +22 -3
  357. package/js/src/hitbtc.d.ts +4 -4
  358. package/js/src/hitbtc.js +2 -3
  359. package/js/src/htx.js +4 -7
  360. package/js/src/huobijp.js +2 -3
  361. package/js/src/kraken.js +1 -0
  362. package/js/src/mexc.js +2 -1
  363. package/js/src/okx.js +13 -3
  364. package/js/src/pro/binance.d.ts +2 -23
  365. package/js/src/pro/binance.js +58 -22
  366. package/js/src/pro/coinbase.d.ts +2 -2
  367. package/js/src/pro/coinbase.js +4 -1
  368. package/js/src/pro/coinbasepro.d.ts +2 -2
  369. package/js/src/pro/hitbtc.d.ts +2 -2
  370. package/js/src/pro/poloniex.d.ts +2 -2
  371. package/js/src/upbit.d.ts +3 -101
  372. package/js/src/upbit.js +12 -12
  373. package/js/src/woo.js +2 -0
  374. package/package.json +1 -1
  375. package/skip-tests.json +5 -0
@@ -0,0 +1,2825 @@
1
+ 'use strict';
2
+
3
+ var lbank$1 = require('./abstract/lbank.js');
4
+ var errors = require('./base/errors.js');
5
+ var number = require('./base/functions/number.js');
6
+ var Precise = require('./base/Precise.js');
7
+ var md5 = require('./static_dependencies/noble-hashes/md5.js');
8
+ var sha256 = require('./static_dependencies/noble-hashes/sha256.js');
9
+ var rsa = require('./base/functions/rsa.js');
10
+
11
+ // ---------------------------------------------------------------------------
12
+ // ---------------------------------------------------------------------------
13
+ /**
14
+ * @class lbank2
15
+ * @augments Exchange
16
+ */
17
+ class lbank extends lbank$1 {
18
+ describe() {
19
+ return this.deepExtend(super.describe(), {
20
+ 'id': 'lbank',
21
+ 'name': 'LBank',
22
+ 'countries': ['CN'],
23
+ 'version': 'v2',
24
+ // 50 per second for making and cancelling orders 1000ms / 50 = 20
25
+ // 20 per second for all other requests, cost = 50 / 20 = 2.5
26
+ 'rateLimit': 20,
27
+ 'has': {
28
+ 'CORS': false,
29
+ 'spot': true,
30
+ 'margin': false,
31
+ 'swap': undefined,
32
+ 'future': false,
33
+ 'option': false,
34
+ 'addMargin': false,
35
+ 'cancelAllOrders': true,
36
+ 'cancelOrder': true,
37
+ 'createMarketBuyOrderWithCost': true,
38
+ 'createMarketOrderWithCost': false,
39
+ 'createMarketSellOrderWithCost': false,
40
+ 'createOrder': true,
41
+ 'createReduceOnlyOrder': false,
42
+ 'createStopLimitOrder': false,
43
+ 'createStopMarketOrder': false,
44
+ 'createStopOrder': false,
45
+ 'fetchBalance': true,
46
+ 'fetchBorrowRateHistories': false,
47
+ 'fetchBorrowRateHistory': false,
48
+ 'fetchClosedOrders': false,
49
+ 'fetchCrossBorrowRate': false,
50
+ 'fetchCrossBorrowRates': false,
51
+ 'fetchDepositWithdrawFee': 'emulated',
52
+ 'fetchDepositWithdrawFees': true,
53
+ 'fetchFundingHistory': false,
54
+ 'fetchFundingRate': false,
55
+ 'fetchFundingRateHistory': false,
56
+ 'fetchFundingRates': false,
57
+ 'fetchIndexOHLCV': false,
58
+ 'fetchIsolatedBorrowRate': false,
59
+ 'fetchIsolatedBorrowRates': false,
60
+ 'fetchIsolatedPositions': false,
61
+ 'fetchLeverage': false,
62
+ 'fetchLeverageTiers': false,
63
+ 'fetchMarginMode': false,
64
+ 'fetchMarkets': true,
65
+ 'fetchMarkOHLCV': false,
66
+ 'fetchMyTrades': true,
67
+ 'fetchOHLCV': true,
68
+ 'fetchOpenOrders': true,
69
+ 'fetchOrder': true,
70
+ 'fetchOrderBook': true,
71
+ 'fetchOrders': true,
72
+ 'fetchPosition': false,
73
+ 'fetchPositionMode': false,
74
+ 'fetchPositions': false,
75
+ 'fetchPositionsRisk': false,
76
+ 'fetchPremiumIndexOHLCV': false,
77
+ 'fetchTicker': true,
78
+ 'fetchTickers': true,
79
+ 'fetchTime': true,
80
+ 'fetchTrades': true,
81
+ 'fetchTradingFees': true,
82
+ 'fetchTransactionFees': true,
83
+ 'reduceMargin': false,
84
+ 'setLeverage': false,
85
+ 'setMarginMode': false,
86
+ 'setPositionMode': false,
87
+ 'withdraw': true,
88
+ },
89
+ 'timeframes': {
90
+ '1m': 'minute1',
91
+ '5m': 'minute5',
92
+ '15m': 'minute15',
93
+ '30m': 'minute30',
94
+ '1h': 'hour1',
95
+ '2h': 'hour2',
96
+ '4h': 'hour4',
97
+ '6h': 'hour6',
98
+ '8h': 'hour8',
99
+ '12h': 'hour12',
100
+ '1d': 'day1',
101
+ '1w': 'week1',
102
+ },
103
+ 'urls': {
104
+ 'logo': 'https://user-images.githubusercontent.com/1294454/38063602-9605e28a-3302-11e8-81be-64b1e53c4cfb.jpg',
105
+ 'api': {
106
+ 'rest': 'https://api.lbank.info',
107
+ 'contract': 'https://lbkperp.lbank.com',
108
+ },
109
+ 'api2': 'https://api.lbkex.com',
110
+ 'www': 'https://www.lbank.com',
111
+ 'doc': 'https://www.lbank.com/en-US/docs/index.html',
112
+ 'fees': 'https://support.lbank.site/hc/en-gb/articles/900000535703-Trading-Fees-From-14-00-on-April-7-2020-UTC-8-',
113
+ 'referral': 'https://www.lbank.com/login/?icode=7QCY',
114
+ },
115
+ 'api': {
116
+ 'spot': {
117
+ 'public': {
118
+ 'get': {
119
+ 'currencyPairs': 2.5,
120
+ 'accuracy': 2.5,
121
+ 'usdToCny': 2.5,
122
+ 'withdrawConfigs': 2.5,
123
+ 'timestamp': 2.5,
124
+ 'ticker/24hr': 2.5,
125
+ 'ticker': 2.5,
126
+ 'depth': 2.5,
127
+ 'incrDepth': 2.5,
128
+ 'trades': 2.5,
129
+ 'kline': 2.5,
130
+ // new quote endpoints
131
+ 'supplement/system_ping': 2.5,
132
+ 'supplement/incrDepth': 2.5,
133
+ 'supplement/trades': 2.5,
134
+ 'supplement/ticker/price': 2.5,
135
+ 'supplement/ticker/bookTicker': 2.5,
136
+ },
137
+ 'post': {
138
+ 'supplement/system_status': 2.5,
139
+ },
140
+ },
141
+ 'private': {
142
+ 'post': {
143
+ // account
144
+ 'user_info': 2.5,
145
+ 'subscribe/get_key': 2.5,
146
+ 'subscribe/refresh_key': 2.5,
147
+ 'subscribe/destroy_key': 2.5,
148
+ 'get_deposit_address': 2.5,
149
+ 'deposit_history': 2.5,
150
+ // order
151
+ 'create_order': 1,
152
+ 'batch_create_order': 1,
153
+ 'cancel_order': 1,
154
+ 'cancel_clientOrders': 1,
155
+ 'orders_info': 2.5,
156
+ 'orders_info_history': 2.5,
157
+ 'order_transaction_detail': 2.5,
158
+ 'transaction_history': 2.5,
159
+ 'orders_info_no_deal': 2.5,
160
+ // withdraw
161
+ 'withdraw': 2.5,
162
+ 'withdrawCancel': 2.5,
163
+ 'withdraws': 2.5,
164
+ 'supplement/user_info': 2.5,
165
+ 'supplement/withdraw': 2.5,
166
+ 'supplement/deposit_history': 2.5,
167
+ 'supplement/withdraws': 2.5,
168
+ 'supplement/get_deposit_address': 2.5,
169
+ 'supplement/asset_detail': 2.5,
170
+ 'supplement/customer_trade_fee': 2.5,
171
+ 'supplement/api_Restrictions': 2.5,
172
+ // new quote endpoints
173
+ 'supplement/system_ping': 2.5,
174
+ // new order endpoints
175
+ 'supplement/create_order_test': 1,
176
+ 'supplement/create_order': 1,
177
+ 'supplement/cancel_order': 1,
178
+ 'supplement/cancel_order_by_symbol': 1,
179
+ 'supplement/orders_info': 2.5,
180
+ 'supplement/orders_info_no_deal': 2.5,
181
+ 'supplement/orders_info_history': 2.5,
182
+ 'supplement/user_info_account': 2.5,
183
+ 'supplement/transaction_history': 2.5,
184
+ },
185
+ },
186
+ },
187
+ 'contract': {
188
+ 'public': {
189
+ 'get': {
190
+ 'cfd/openApi/v1/pub/getTime': 2.5,
191
+ 'cfd/openApi/v1/pub/instrument': 2.5,
192
+ 'cfd/openApi/v1/pub/marketData': 2.5,
193
+ 'cfd/openApi/v1/pub/marketOrder': 2.5,
194
+ },
195
+ },
196
+ },
197
+ },
198
+ 'fees': {
199
+ 'trading': {
200
+ 'maker': this.parseNumber('0.001'),
201
+ 'taker': this.parseNumber('0.001'),
202
+ },
203
+ 'funding': {
204
+ 'withdraw': {},
205
+ },
206
+ },
207
+ 'commonCurrencies': {
208
+ 'VET_ERC20': 'VEN',
209
+ 'PNT': 'Penta',
210
+ },
211
+ 'precisionMode': number.TICK_SIZE,
212
+ 'options': {
213
+ 'cacheSecretAsPem': true,
214
+ 'createMarketBuyOrderRequiresPrice': true,
215
+ 'fetchTrades': {
216
+ 'method': 'spotPublicGetTrades', // or 'spotPublicGetTradesSupplement'
217
+ },
218
+ 'fetchTransactionFees': {
219
+ 'method': 'fetchPrivateTransactionFees', // or 'fetchPublicTransactionFees'
220
+ },
221
+ 'fetchDepositWithdrawFees': {
222
+ 'method': 'fetchPrivateDepositWithdrawFees', // or 'fetchPublicDepositWithdrawFees'
223
+ },
224
+ 'fetchDepositAddress': {
225
+ 'method': 'fetchDepositAddressDefault', // or fetchDepositAddressSupplement
226
+ },
227
+ 'createOrder': {
228
+ 'method': 'spotPrivatePostSupplementCreateOrder', // or spotPrivatePostCreateOrder
229
+ },
230
+ 'fetchOrder': {
231
+ 'method': 'fetchOrderSupplement', // or fetchOrderDefault
232
+ },
233
+ 'fetchBalance': {
234
+ 'method': 'spotPrivatePostSupplementUserInfo', // or spotPrivatePostSupplementUserInfoAccount or spotPrivatePostUserInfo
235
+ },
236
+ 'networks': {
237
+ 'ERC20': 'erc20',
238
+ 'ETH': 'erc20',
239
+ 'TRC20': 'trc20',
240
+ 'TRX': 'trc20',
241
+ 'OMNI': 'omni',
242
+ 'ASA': 'asa',
243
+ 'BEP20': 'bep20(bsc)',
244
+ 'BSC': 'bep20(bsc)',
245
+ 'HT': 'heco',
246
+ 'BNB': 'bep2',
247
+ 'BTC': 'btc',
248
+ 'DOGE': 'dogecoin',
249
+ 'MATIC': 'matic',
250
+ 'POLYGON': 'matic',
251
+ 'OEC': 'oec',
252
+ 'BTCTRON': 'btctron',
253
+ 'XRP': 'xrp',
254
+ // other unusual chains with number of listed currencies supported
255
+ // 'avax c-chain': 1,
256
+ // klay: 12,
257
+ // bta: 1,
258
+ // fantom: 1,
259
+ // celo: 1,
260
+ // sol: 2,
261
+ // zenith: 1,
262
+ // ftm: 5,
263
+ // bep20: 1, (single token with mis-named chain) SSS
264
+ // bitci: 1,
265
+ // sgb: 1,
266
+ // moonbeam: 1,
267
+ // ekta: 1,
268
+ // etl: 1,
269
+ // arbitrum: 1,
270
+ // tpc: 1,
271
+ // ptx: 1
272
+ // }
273
+ },
274
+ 'inverse-networks': {
275
+ 'erc20': 'ERC20',
276
+ 'trc20': 'TRC20',
277
+ 'omni': 'OMNI',
278
+ 'asa': 'ASA',
279
+ 'bep20(bsc)': 'BSC',
280
+ 'bep20': 'BSC',
281
+ 'heco': 'HT',
282
+ 'bep2': 'BNB',
283
+ 'btc': 'BTC',
284
+ 'dogecoin': 'DOGE',
285
+ 'matic': 'MATIC',
286
+ 'oec': 'OEC',
287
+ 'btctron': 'BTCTRON',
288
+ 'xrp': 'XRP',
289
+ },
290
+ 'defaultNetworks': {
291
+ 'USDT': 'TRC20',
292
+ },
293
+ },
294
+ });
295
+ }
296
+ async fetchTime(params = {}) {
297
+ /**
298
+ * @method
299
+ * @name lbank2#fetchTime
300
+ * @description fetches the current integer timestamp in milliseconds from the exchange server
301
+ * @see https://www.lbank.com/en-US/docs/index.html#get-timestamp
302
+ * @see https://www.lbank.com/en-US/docs/contract.html#get-the-current-time
303
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
304
+ * @returns {int} the current integer timestamp in milliseconds from the exchange server
305
+ */
306
+ let type = undefined;
307
+ [type, params] = this.handleMarketTypeAndParams('fetchTime', undefined, params);
308
+ let response = undefined;
309
+ if (type === 'swap') {
310
+ response = await this.contractPublicGetCfdOpenApiV1PubGetTime(params);
311
+ }
312
+ else {
313
+ response = await this.spotPublicGetTimestamp(params);
314
+ }
315
+ //
316
+ // spot
317
+ //
318
+ // {
319
+ // "result": "true",
320
+ // "data": 1691789627950,
321
+ // "error_code": 0,
322
+ // "ts": 1691789627950
323
+ // }
324
+ //
325
+ // swap
326
+ //
327
+ // {
328
+ // "data": 1691789627950,
329
+ // "error_code": 0,
330
+ // "msg": "Success",
331
+ // "result": "true",
332
+ // "success": true
333
+ // }
334
+ //
335
+ return this.safeInteger(response, 'data');
336
+ }
337
+ async fetchMarkets(params = {}) {
338
+ /**
339
+ * @method
340
+ * @name lbank2#fetchMarkets
341
+ * @description retrieves data on all markets for lbank2
342
+ * @see https://www.lbank.com/en-US/docs/index.html#trading-pairs
343
+ * @see https://www.lbank.com/en-US/docs/contract.html#query-contract-information-list
344
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
345
+ * @returns {object[]} an array of objects representing market data
346
+ */
347
+ const marketsPromises = [
348
+ this.fetchSpotMarkets(params),
349
+ this.fetchSwapMarkets(params),
350
+ ];
351
+ const resolvedMarkets = await Promise.all(marketsPromises);
352
+ return this.arrayConcat(resolvedMarkets[0], resolvedMarkets[1]);
353
+ }
354
+ async fetchSpotMarkets(params = {}) {
355
+ const response = await this.spotPublicGetAccuracy(params);
356
+ //
357
+ // {
358
+ // "result": "true",
359
+ // "data": [
360
+ // {
361
+ // "symbol": "btc_usdt",
362
+ // "quantityAccuracy": "4",
363
+ // "minTranQua": "0.0001",
364
+ // "priceAccuracy": "2"
365
+ // },
366
+ // ],
367
+ // "error_code": 0,
368
+ // "ts": 1691560288484
369
+ // }
370
+ //
371
+ const data = this.safeValue(response, 'data', []);
372
+ const result = [];
373
+ for (let i = 0; i < data.length; i++) {
374
+ const market = data[i];
375
+ const marketId = this.safeString(market, 'symbol');
376
+ const parts = marketId.split('_');
377
+ const baseId = parts[0];
378
+ const quoteId = parts[1];
379
+ const base = this.safeCurrencyCode(baseId);
380
+ const quote = this.safeCurrencyCode(quoteId);
381
+ const symbol = base + '/' + quote;
382
+ result.push({
383
+ 'id': marketId,
384
+ 'symbol': symbol,
385
+ 'base': base,
386
+ 'quote': quote,
387
+ 'baseId': baseId,
388
+ 'quoteId': quoteId,
389
+ 'settle': undefined,
390
+ 'settleId': undefined,
391
+ 'type': 'spot',
392
+ 'spot': true,
393
+ 'margin': false,
394
+ 'swap': false,
395
+ 'future': false,
396
+ 'option': false,
397
+ 'active': true,
398
+ 'contract': false,
399
+ 'linear': undefined,
400
+ 'inverse': undefined,
401
+ 'contractSize': undefined,
402
+ 'expiry': undefined,
403
+ 'expiryDatetime': undefined,
404
+ 'strike': undefined,
405
+ 'optionType': undefined,
406
+ 'precision': {
407
+ 'amount': this.parseNumber(this.parsePrecision(this.safeString(market, 'quantityAccuracy'))),
408
+ 'price': this.parseNumber(this.parsePrecision(this.safeString(market, 'priceAccuracy'))),
409
+ },
410
+ 'limits': {
411
+ 'leverage': {
412
+ 'min': undefined,
413
+ 'max': undefined,
414
+ },
415
+ 'amount': {
416
+ 'min': this.safeNumber(market, 'minTranQua'),
417
+ 'max': undefined,
418
+ },
419
+ 'price': {
420
+ 'min': undefined,
421
+ 'max': undefined,
422
+ },
423
+ 'cost': {
424
+ 'min': undefined,
425
+ 'max': undefined,
426
+ },
427
+ },
428
+ 'created': undefined,
429
+ 'info': market,
430
+ });
431
+ }
432
+ return result;
433
+ }
434
+ async fetchSwapMarkets(params = {}) {
435
+ const request = {
436
+ 'productGroup': 'SwapU',
437
+ };
438
+ const response = await this.contractPublicGetCfdOpenApiV1PubInstrument(this.extend(request, params));
439
+ //
440
+ // {
441
+ // "data": [
442
+ // {
443
+ // "priceLimitUpperValue": 0.2,
444
+ // "symbol": "BTCUSDT",
445
+ // "volumeTick": 0.0001,
446
+ // "indexPrice": "29707.70200000",
447
+ // "minOrderVolume": "0.0001",
448
+ // "priceTick": 0.1,
449
+ // "maxOrderVolume": "30.0",
450
+ // "baseCurrency": "BTC",
451
+ // "volumeMultiple": 1.0,
452
+ // "exchangeID": "Exchange",
453
+ // "priceCurrency": "USDT",
454
+ // "priceLimitLowerValue": 0.2,
455
+ // "clearCurrency": "USDT",
456
+ // "symbolName": "BTCUSDT",
457
+ // "defaultLeverage": 20.0,
458
+ // "minOrderCost": "5.0"
459
+ // },
460
+ // ],
461
+ // "error_code": 0,
462
+ // "msg": "Success",
463
+ // "result": "true",
464
+ // "success": true
465
+ // }
466
+ //
467
+ const data = this.safeValue(response, 'data', []);
468
+ const result = [];
469
+ for (let i = 0; i < data.length; i++) {
470
+ const market = data[i];
471
+ const marketId = this.safeString(market, 'symbol');
472
+ const baseId = this.safeString(market, 'baseCurrency');
473
+ const settleId = this.safeString(market, 'clearCurrency');
474
+ const quoteId = settleId;
475
+ const base = this.safeCurrencyCode(baseId);
476
+ const quote = this.safeCurrencyCode(quoteId);
477
+ const settle = this.safeCurrencyCode(settleId);
478
+ const symbol = base + '/' + quote + ':' + settle;
479
+ result.push({
480
+ 'id': marketId,
481
+ 'symbol': symbol,
482
+ 'base': base,
483
+ 'quote': quote,
484
+ 'settle': settle,
485
+ 'baseId': baseId,
486
+ 'quoteId': quoteId,
487
+ 'settleId': settleId,
488
+ 'type': 'swap',
489
+ 'spot': false,
490
+ 'margin': false,
491
+ 'swap': true,
492
+ 'future': false,
493
+ 'option': false,
494
+ 'active': true,
495
+ 'contract': true,
496
+ 'linear': true,
497
+ 'inverse': undefined,
498
+ 'contractSize': this.safeNumber(market, 'volumeMultiple'),
499
+ 'expiry': undefined,
500
+ 'expiryDatetime': undefined,
501
+ 'strike': undefined,
502
+ 'optionType': undefined,
503
+ 'precision': {
504
+ 'amount': this.safeNumber(market, 'volumeTick'),
505
+ 'price': this.safeNumber(market, 'priceTick'),
506
+ },
507
+ 'limits': {
508
+ 'leverage': {
509
+ 'min': undefined,
510
+ 'max': undefined,
511
+ },
512
+ 'amount': {
513
+ 'min': this.safeNumber(market, 'minOrderVolume'),
514
+ 'max': this.safeNumber(market, 'maxOrderVolume'),
515
+ },
516
+ 'price': {
517
+ 'min': this.safeNumber(market, 'priceLimitLowerValue'),
518
+ 'max': this.safeNumber(market, 'priceLimitUpperValue'),
519
+ },
520
+ 'cost': {
521
+ 'min': this.safeNumber(market, 'minOrderCost'),
522
+ 'max': undefined,
523
+ },
524
+ },
525
+ 'created': undefined,
526
+ 'info': market,
527
+ });
528
+ }
529
+ return result;
530
+ }
531
+ parseTicker(ticker, market = undefined) {
532
+ //
533
+ // spot: fetchTicker, fetchTickers
534
+ //
535
+ // {
536
+ // "symbol": "btc_usdt",
537
+ // "ticker": {
538
+ // "high": "29695.57",
539
+ // "vol": "6890.2789",
540
+ // "low": "29110",
541
+ // "change": "0.58",
542
+ // "turnover": "202769821.06",
543
+ // "latest": "29405.98"
544
+ // },
545
+ // "timestamp": :1692064274908
546
+ // }
547
+ //
548
+ // swap: fetchTickers
549
+ //
550
+ // {
551
+ // "prePositionFeeRate": "0.000053",
552
+ // "volume": "2435.459",
553
+ // "symbol": "BTCUSDT",
554
+ // "highestPrice": "29446.5",
555
+ // "lowestPrice": "29362.9",
556
+ // "openPrice": "29419.5",
557
+ // "markedPrice": "29385.1",
558
+ // "turnover": "36345526.2438402",
559
+ // "lastPrice": "29387.0"
560
+ // }
561
+ //
562
+ const timestamp = this.safeInteger(ticker, 'timestamp');
563
+ const marketId = this.safeString(ticker, 'symbol');
564
+ const symbol = this.safeSymbol(marketId, market);
565
+ const tickerData = this.safeValue(ticker, 'ticker', {});
566
+ market = this.safeMarket(marketId, market);
567
+ const data = (market['contract']) ? ticker : tickerData;
568
+ return this.safeTicker({
569
+ 'symbol': symbol,
570
+ 'timestamp': timestamp,
571
+ 'datetime': this.iso8601(timestamp),
572
+ 'high': this.safeString2(data, 'high', 'highestPrice'),
573
+ 'low': this.safeString2(data, 'low', 'lowestPrice'),
574
+ 'bid': undefined,
575
+ 'bidVolume': undefined,
576
+ 'ask': undefined,
577
+ 'askVolume': undefined,
578
+ 'vwap': undefined,
579
+ 'open': this.safeString(data, 'openPrice'),
580
+ 'close': undefined,
581
+ 'last': this.safeString2(data, 'latest', 'lastPrice'),
582
+ 'previousClose': undefined,
583
+ 'change': undefined,
584
+ 'percentage': this.safeString(data, 'change'),
585
+ 'average': undefined,
586
+ 'baseVolume': this.safeString2(data, 'vol', 'volume'),
587
+ 'quoteVolume': this.safeString(data, 'turnover'),
588
+ 'info': ticker,
589
+ }, market);
590
+ }
591
+ async fetchTicker(symbol, params = {}) {
592
+ /**
593
+ * @method
594
+ * @name lbank2#fetchTicker
595
+ * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
596
+ * @see https://www.lbank.com/en-US/docs/index.html#query-current-market-data-new
597
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
598
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
599
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
600
+ */
601
+ await this.loadMarkets();
602
+ const market = this.market(symbol);
603
+ if (market['swap']) {
604
+ const responseForSwap = await this.fetchTickers([market['symbol']], params);
605
+ return this.safeValue(responseForSwap, market['symbol']);
606
+ }
607
+ const request = {
608
+ 'symbol': market['id'],
609
+ };
610
+ const response = await this.spotPublicGetTicker24hr(this.extend(request, params));
611
+ //
612
+ // {
613
+ // "result": "true",
614
+ // "data": [
615
+ // {
616
+ // "symbol": "btc_usdt",
617
+ // "ticker": {
618
+ // "high": "29695.57",
619
+ // "vol": "6890.2789",
620
+ // "low": "29110",
621
+ // "change": "0.58",
622
+ // "turnover": "202769821.06",
623
+ // "latest": "29405.98"
624
+ // },
625
+ // "timestamp": :1692064274908
626
+ // }
627
+ // ],
628
+ // "error_code": 0,
629
+ // "ts": :1692064276872
630
+ // }
631
+ //
632
+ const data = this.safeValue(response, 'data', []);
633
+ const first = this.safeValue(data, 0, {});
634
+ return this.parseTicker(first, market);
635
+ }
636
+ async fetchTickers(symbols = undefined, params = {}) {
637
+ /**
638
+ * @method
639
+ * @name lbank2#fetchTickers
640
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
641
+ * @see https://www.lbank.com/en-US/docs/index.html#query-current-market-data-new
642
+ * @see https://www.lbank.com/en-US/docs/contract.html#query-contract-market-list
643
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
644
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
645
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
646
+ */
647
+ await this.loadMarkets();
648
+ let market = undefined;
649
+ if (symbols !== undefined) {
650
+ symbols = this.marketSymbols(symbols);
651
+ const symbolsLength = symbols.length;
652
+ if (symbolsLength > 0) {
653
+ market = this.market(symbols[0]);
654
+ }
655
+ }
656
+ const request = {};
657
+ let type = undefined;
658
+ [type, params] = this.handleMarketTypeAndParams('fetchTickers', market, params);
659
+ let response = undefined;
660
+ if (type === 'swap') {
661
+ request['productGroup'] = 'SwapU';
662
+ response = await this.contractPublicGetCfdOpenApiV1PubMarketData(this.extend(request, params));
663
+ }
664
+ else {
665
+ request['symbol'] = 'all';
666
+ response = await this.spotPublicGetTicker24hr(this.extend(request, params));
667
+ }
668
+ //
669
+ // spot
670
+ //
671
+ // {
672
+ // "result": "true",
673
+ // "data": [
674
+ // {
675
+ // "symbol": "btc_usdt",
676
+ // "ticker": {
677
+ // "high": "29695.57",
678
+ // "vol": "6890.2789",
679
+ // "low": "29110",
680
+ // "change": "0.58",
681
+ // "turnover": "202769821.06",
682
+ // "latest": "29405.98"
683
+ // },
684
+ // "timestamp": :1692064274908
685
+ // }
686
+ // ],
687
+ // "error_code": 0,
688
+ // "ts": :1692064276872
689
+ // }
690
+ //
691
+ // swap
692
+ //
693
+ // {
694
+ // "data": [
695
+ // {
696
+ // "prePositionFeeRate": "0.000053",
697
+ // "volume": "2435.459",
698
+ // "symbol": "BTCUSDT",
699
+ // "highestPrice": "29446.5",
700
+ // "lowestPrice": "29362.9",
701
+ // "openPrice": "29419.5",
702
+ // "markedPrice": "29385.1",
703
+ // "turnover": "36345526.2438402",
704
+ // "lastPrice": "29387.0"
705
+ // },
706
+ // ],
707
+ // "error_code": 0,
708
+ // "msg": "Success",
709
+ // "result": "true",
710
+ // "success": true
711
+ // }
712
+ //
713
+ const data = this.safeValue(response, 'data', []);
714
+ return this.parseTickers(data, symbols);
715
+ }
716
+ async fetchOrderBook(symbol, limit = undefined, params = {}) {
717
+ /**
718
+ * @method
719
+ * @name lbank2#fetchOrderBook
720
+ * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
721
+ * @see https://www.lbank.com/en-US/docs/index.html#query-market-depth
722
+ * @see https://www.lbank.com/en-US/docs/contract.html#get-handicap
723
+ * @param {string} symbol unified symbol of the market to fetch the order book for
724
+ * @param {int} [limit] the maximum amount of order book entries to return
725
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
726
+ * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
727
+ */
728
+ await this.loadMarkets();
729
+ const market = this.market(symbol);
730
+ if (limit === undefined) {
731
+ limit = 60;
732
+ }
733
+ const request = {
734
+ 'symbol': market['id'],
735
+ };
736
+ let type = undefined;
737
+ [type, params] = this.handleMarketTypeAndParams('fetchOrderBook', market, params);
738
+ let response = undefined;
739
+ if (type === 'swap') {
740
+ request['depth'] = limit;
741
+ response = await this.contractPublicGetCfdOpenApiV1PubMarketOrder(this.extend(request, params));
742
+ }
743
+ else {
744
+ request['size'] = limit;
745
+ response = await this.spotPublicGetDepth(this.extend(request, params));
746
+ }
747
+ //
748
+ // spot
749
+ //
750
+ // {
751
+ // "result": "true",
752
+ // "data": {
753
+ // "asks": [
754
+ // ["29243.37", "2.8783"],
755
+ // ["29243.39", "2.2842"],
756
+ // ["29243.4", "0.0337"]
757
+ // ],
758
+ // "bids": [
759
+ // ["29243.36", "1.5258"],
760
+ // ["29243.34", "0.8218"],
761
+ // ["29243.28", "1.285"]
762
+ // ],
763
+ // "timestamp": :1692157328820
764
+ // },
765
+ // "error_code": 0,
766
+ // "ts": :1692157328820
767
+ // }
768
+ //
769
+ // swap
770
+ //
771
+ // {
772
+ // "data": {
773
+ // "symbol": "BTCUSDT",
774
+ // "asks": [
775
+ // {
776
+ // "volume": "14.6535",
777
+ // "price": "29234.2",
778
+ // "orders": "1"
779
+ // },
780
+ // ],
781
+ // "bids": [
782
+ // {
783
+ // "volume": "13.4899",
784
+ // "price": "29234.1",
785
+ // "orders": "4"
786
+ // },
787
+ // ]
788
+ // },
789
+ // "error_code": 0,
790
+ // "msg": "Success",
791
+ // "result": "true",
792
+ // "success": true
793
+ // }
794
+ //
795
+ const orderbook = this.safeValue(response, 'data', {});
796
+ const timestamp = this.milliseconds();
797
+ if (market['swap']) {
798
+ return this.parseOrderBook(orderbook, market['symbol'], timestamp, 'bids', 'asks', 'price', 'volume');
799
+ }
800
+ return this.parseOrderBook(orderbook, market['symbol'], timestamp);
801
+ }
802
+ parseTrade(trade, market = undefined) {
803
+ //
804
+ // fetchTrades (old) spotPublicGetTrades
805
+ //
806
+ // {
807
+ // "date_ms":1647021989789,
808
+ // "amount":0.0028,
809
+ // "price":38804.2,
810
+ // "type":"buy",
811
+ // "tid":"52d5616ee35c43019edddebe59b3e094"
812
+ // }
813
+ //
814
+ //
815
+ // fetchTrades (new) spotPublicGetTradesSupplement
816
+ //
817
+ // {
818
+ // "quoteQty":1675.048485,
819
+ // "price":0.127545,
820
+ // "qty":13133,
821
+ // "id":"3589541dc22e4357b227283650f714e2",
822
+ // "time":1648058297110,
823
+ // "isBuyerMaker":false
824
+ // }
825
+ //
826
+ // fetchMyTrades (private)
827
+ //
828
+ // {
829
+ // "orderUuid":"38b4e7a4-14f6-45fd-aba1-1a37024124a0",
830
+ // "tradeFeeRate":0.0010000000,
831
+ // "dealTime":1648500944496,
832
+ // "dealQuantity":30.00000000000000000000,
833
+ // "tradeFee":0.00453300000000000000,
834
+ // "txUuid":"11f3850cc6214ea3b495adad3a032794",
835
+ // "dealPrice":0.15111300000000000000,
836
+ // "dealVolumePrice":4.53339000000000000000,
837
+ // "tradeType":"sell_market"
838
+ // }
839
+ //
840
+ let timestamp = this.safeInteger2(trade, 'date_ms', 'time');
841
+ if (timestamp === undefined) {
842
+ timestamp = this.safeInteger(trade, 'dealTime');
843
+ }
844
+ let amountString = this.safeString2(trade, 'amount', 'qty');
845
+ if (amountString === undefined) {
846
+ amountString = this.safeString(trade, 'dealQuantity');
847
+ }
848
+ let priceString = this.safeString(trade, 'price');
849
+ if (priceString === undefined) {
850
+ priceString = this.safeString(trade, 'dealPrice');
851
+ }
852
+ let costString = this.safeString(trade, 'quoteQty');
853
+ if (costString === undefined) {
854
+ costString = this.safeString(trade, 'dealVolumePrice');
855
+ }
856
+ let side = this.safeString2(trade, 'tradeType', 'type');
857
+ let type = undefined;
858
+ let takerOrMaker = undefined;
859
+ if (side !== undefined) {
860
+ const parts = side.split('_');
861
+ side = this.safeString(parts, 0);
862
+ const typePart = this.safeString(parts, 1);
863
+ type = 'limit';
864
+ takerOrMaker = 'taker';
865
+ if (typePart !== undefined) {
866
+ if (typePart === 'market') {
867
+ type = 'market';
868
+ }
869
+ else if (typePart === 'maker') {
870
+ takerOrMaker = 'maker';
871
+ }
872
+ }
873
+ }
874
+ let id = this.safeString2(trade, 'tid', 'id');
875
+ if (id === undefined) {
876
+ id = this.safeString(trade, 'txUuid');
877
+ }
878
+ const order = this.safeString(trade, 'orderUuid');
879
+ const symbol = this.safeSymbol(undefined, market);
880
+ let fee = undefined;
881
+ const feeCost = this.safeString(trade, 'tradeFee');
882
+ if (feeCost !== undefined) {
883
+ fee = {
884
+ 'cost': feeCost,
885
+ 'currency': (side === 'buy') ? market['base'] : market['quote'],
886
+ 'rate': this.safeString(trade, 'tradeFeeRate'),
887
+ };
888
+ }
889
+ return this.safeTrade({
890
+ 'timestamp': timestamp,
891
+ 'datetime': this.iso8601(timestamp),
892
+ 'symbol': symbol,
893
+ 'id': id,
894
+ 'order': order,
895
+ 'type': type,
896
+ 'takerOrMaker': takerOrMaker,
897
+ 'side': side,
898
+ 'price': priceString,
899
+ 'amount': amountString,
900
+ 'cost': costString,
901
+ 'fee': fee,
902
+ 'info': trade,
903
+ }, market);
904
+ }
905
+ async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
906
+ /**
907
+ * @method
908
+ * @name lbank2#fetchTrades
909
+ * @description get the list of most recent trades for a particular symbol
910
+ * @see https://www.lbank.com/en-US/docs/index.html#query-historical-transactions
911
+ * @see https://www.lbank.com/en-US/docs/index.html#recent-transactions-list
912
+ * @param {string} symbol unified symbol of the market to fetch trades for
913
+ * @param {int} [since] timestamp in ms of the earliest trade to fetch
914
+ * @param {int} [limit] the maximum amount of trades to fetch
915
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
916
+ * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
917
+ */
918
+ await this.loadMarkets();
919
+ const market = this.market(symbol);
920
+ const request = {
921
+ 'symbol': market['id'],
922
+ };
923
+ if (since !== undefined) {
924
+ request['time'] = since;
925
+ }
926
+ if (limit !== undefined) {
927
+ request['size'] = Math.min(limit, 600);
928
+ }
929
+ else {
930
+ request['size'] = 600; // max
931
+ }
932
+ let method = this.safeString(params, 'method');
933
+ params = this.omit(params, 'method');
934
+ if (method === undefined) {
935
+ const options = this.safeValue(this.options, 'fetchTrades', {});
936
+ method = this.safeString(options, 'method', 'spotPublicGetTrades');
937
+ }
938
+ const response = await this[method](this.extend(request, params));
939
+ //
940
+ // {
941
+ // "result":"true",
942
+ // "data": [
943
+ // {
944
+ // "date_ms":1647021989789,
945
+ // "amount":0.0028,
946
+ // "price":38804.2,
947
+ // "type":"buy",
948
+ // "tid":"52d5616ee35c43019edddebe59b3e094"
949
+ // }
950
+ // ],
951
+ // "error_code":0,
952
+ // "ts":1647021999308
953
+ // }
954
+ //
955
+ const trades = this.safeValue(response, 'data', []);
956
+ return this.parseTrades(trades, market, since, limit);
957
+ }
958
+ parseOHLCV(ohlcv, market = undefined) {
959
+ //
960
+ // [
961
+ // 1482311500, // timestamp
962
+ // 5423.23, // open
963
+ // 5472.80, // high
964
+ // 5516.09, // low
965
+ // 5462, // close
966
+ // 234.3250 // volume
967
+ // ],
968
+ //
969
+ return [
970
+ this.safeTimestamp(ohlcv, 0),
971
+ this.safeNumber(ohlcv, 1),
972
+ this.safeNumber(ohlcv, 2),
973
+ this.safeNumber(ohlcv, 3),
974
+ this.safeNumber(ohlcv, 4),
975
+ this.safeNumber(ohlcv, 5), // volume
976
+ ];
977
+ }
978
+ async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
979
+ /**
980
+ * @method
981
+ * @name lbank2#fetchOHLCV
982
+ * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
983
+ * @see https://www.lbank.com/en-US/docs/index.html#query-k-bar-data
984
+ * @param {string} symbol unified symbol of the market to fetch OHLCV data for
985
+ * @param {string} timeframe the length of time each candle represents
986
+ * @param {int} [since] timestamp in ms of the earliest candle to fetch
987
+ * @param {int} [limit] the maximum amount of candles to fetch
988
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
989
+ * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
990
+ */
991
+ // endpoint doesnt work
992
+ await this.loadMarkets();
993
+ const market = this.market(symbol);
994
+ if (limit === undefined) {
995
+ limit = 100;
996
+ }
997
+ if (since === undefined) {
998
+ const duration = this.parseTimeframe(timeframe);
999
+ since = this.milliseconds() - duration * 1000 * limit;
1000
+ }
1001
+ const request = {
1002
+ 'symbol': market['id'],
1003
+ 'type': this.safeString(this.timeframes, timeframe, timeframe),
1004
+ 'time': this.parseToInt(since / 1000),
1005
+ 'size': limit, // max 2000
1006
+ };
1007
+ const response = await this.spotPublicGetKline(this.extend(request, params));
1008
+ const ohlcvs = this.safeValue(response, 'data', []);
1009
+ //
1010
+ //
1011
+ // [
1012
+ // [
1013
+ // 1482311500,
1014
+ // 5423.23,
1015
+ // 5472.80,
1016
+ // 5516.09,
1017
+ // 5462,
1018
+ // 234.3250
1019
+ // ],
1020
+ // [
1021
+ // 1482311400,
1022
+ // 5432.52,
1023
+ // 5459.87,
1024
+ // 5414.30,
1025
+ // 5428.23,
1026
+ // 213.7329
1027
+ // ]
1028
+ // ]
1029
+ //
1030
+ return this.parseOHLCVs(ohlcvs, market, timeframe, since, limit);
1031
+ }
1032
+ parseBalance(response) {
1033
+ //
1034
+ // spotPrivatePostUserInfo
1035
+ //
1036
+ // {
1037
+ // "toBtc": {
1038
+ // "egc:": "0",
1039
+ // "iog": "0",
1040
+ // "ksm": "0",
1041
+ // },
1042
+ // "freeze": {
1043
+ // "egc": "0",
1044
+ // "iog": "0",
1045
+ // "ksm": "0" ,
1046
+ // },
1047
+ // "asset": {
1048
+ // "egc": "0",
1049
+ // "iog": "0",
1050
+ // "ksm": "0",
1051
+ // },
1052
+ // "free": {
1053
+ // "egc": "0",
1054
+ // "iog": "0",
1055
+ // "ksm": "0",
1056
+ // }
1057
+ // }
1058
+ //
1059
+ // spotPrivatePostSupplementUserInfoAccount
1060
+ //
1061
+ // {
1062
+ // "balances":[
1063
+ // {
1064
+ // "asset":"lbk",
1065
+ // "free":"0",
1066
+ // "locked":"0"
1067
+ // }, ...
1068
+ // ]
1069
+ // }
1070
+ //
1071
+ // spotPrivatePostSupplementUserInfo
1072
+ //
1073
+ // [
1074
+ // {
1075
+ // "usableAmt":"31.45130723",
1076
+ // "assetAmt":"31.45130723",
1077
+ // "networkList":[
1078
+ // {
1079
+ // "isDefault":true,
1080
+ // "withdrawFeeRate":"",
1081
+ // "name":"bep20(bsc)",
1082
+ // "withdrawMin":30,
1083
+ // "minLimit":0.0001,
1084
+ // "minDeposit":0.0001,
1085
+ // "feeAssetCode":"doge",
1086
+ // "withdrawFee":"30",
1087
+ // "type":1,
1088
+ // "coin":"doge",
1089
+ // "network":"bsc"
1090
+ // },
1091
+ // {
1092
+ // "isDefault":false,
1093
+ // "withdrawFeeRate":"",
1094
+ // "name":"dogecoin",
1095
+ // "withdrawMin":10,
1096
+ // "minLimit":0.0001,
1097
+ // "minDeposit":10,
1098
+ // "feeAssetCode":"doge",
1099
+ // "withdrawFee":"10",
1100
+ // "type":1,
1101
+ // "coin":"doge",
1102
+ // "network":"dogecoin"
1103
+ // }
1104
+ // ],
1105
+ // "freezeAmt":"0",
1106
+ // "coin":"doge"
1107
+ // }, ...
1108
+ // ]
1109
+ //
1110
+ const timestamp = this.safeInteger(response, 'ts');
1111
+ const result = {
1112
+ 'info': response,
1113
+ 'timestamp': timestamp,
1114
+ 'datetime': this.iso8601(timestamp),
1115
+ };
1116
+ const data = this.safeValue(response, 'data');
1117
+ // from spotPrivatePostUserInfo
1118
+ const toBtc = this.safeValue(data, 'toBtc');
1119
+ if (toBtc !== undefined) {
1120
+ const used = this.safeValue(data, 'freeze', {});
1121
+ const free = this.safeValue(data, 'free', {});
1122
+ const currencies = Object.keys(free);
1123
+ for (let i = 0; i < currencies.length; i++) {
1124
+ const currencyId = currencies[i];
1125
+ const code = this.safeCurrencyCode(currencyId);
1126
+ const account = this.account();
1127
+ account['used'] = this.safeString(used, currencyId);
1128
+ account['free'] = this.safeString(free, currencyId);
1129
+ result[code] = account;
1130
+ }
1131
+ return this.safeBalance(result);
1132
+ }
1133
+ // from spotPrivatePostSupplementUserInfoAccount
1134
+ const balances = this.safeValue(data, 'balances');
1135
+ if (balances !== undefined) {
1136
+ for (let i = 0; i < balances.length; i++) {
1137
+ const item = balances[i];
1138
+ const currencyId = this.safeString(item, 'asset');
1139
+ const codeInner = this.safeCurrencyCode(currencyId);
1140
+ const account = this.account();
1141
+ account['free'] = this.safeString(item, 'free');
1142
+ account['used'] = this.safeString(item, 'locked');
1143
+ result[codeInner] = account;
1144
+ }
1145
+ return this.safeBalance(result);
1146
+ }
1147
+ // from spotPrivatePostSupplementUserInfo
1148
+ const isArray = Array.isArray(data);
1149
+ if (isArray === true) {
1150
+ for (let i = 0; i < data.length; i++) {
1151
+ const item = data[i];
1152
+ const currencyId = this.safeString(item, 'coin');
1153
+ const codeInner = this.safeCurrencyCode(currencyId);
1154
+ const account = this.account();
1155
+ account['free'] = this.safeString(item, 'usableAmt');
1156
+ account['used'] = this.safeString(item, 'freezeAmt');
1157
+ result[codeInner] = account;
1158
+ }
1159
+ return this.safeBalance(result);
1160
+ }
1161
+ return undefined;
1162
+ }
1163
+ async fetchBalance(params = {}) {
1164
+ /**
1165
+ * @method
1166
+ * @name lbank2#fetchBalance
1167
+ * @description query for balance and get the amount of funds available for trading or funds locked in orders
1168
+ * @see https://www.lbank.com/en-US/docs/index.html#asset-information
1169
+ * @see https://www.lbank.com/en-US/docs/index.html#account-information
1170
+ * @see https://www.lbank.com/en-US/docs/index.html#get-all-coins-information
1171
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1172
+ * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
1173
+ */
1174
+ await this.loadMarkets();
1175
+ let method = this.safeString(params, 'method');
1176
+ if (method === undefined) {
1177
+ const options = this.safeValue(this.options, 'fetchBalance', {});
1178
+ method = this.safeString(options, 'method', 'spotPrivatePostSupplementUserInfo');
1179
+ }
1180
+ const response = await this[method]();
1181
+ //
1182
+ // {
1183
+ // "result": "true",
1184
+ // "data": [
1185
+ // {
1186
+ // "usableAmt": "14.36",
1187
+ // "assetAmt": "14.36",
1188
+ // "networkList": [
1189
+ // {
1190
+ // "isDefault": false,
1191
+ // "withdrawFeeRate": "",
1192
+ // "name": "erc20",
1193
+ // "withdrawMin": 30,
1194
+ // "minLimit": 0.0001,
1195
+ // "minDeposit": 20,
1196
+ // "feeAssetCode": "usdt",
1197
+ // "withdrawFee": "30",
1198
+ // "type": 1,
1199
+ // "coin": "usdt",
1200
+ // "network": "eth"
1201
+ // },
1202
+ // ...
1203
+ // ],
1204
+ // "freezeAmt": "0",
1205
+ // "coin": "ada"
1206
+ // }
1207
+ // ],
1208
+ // "code": 0
1209
+ // }
1210
+ //
1211
+ return this.parseBalance(response);
1212
+ }
1213
+ parseTradingFee(fee, market = undefined) {
1214
+ //
1215
+ // {
1216
+ // "symbol":"skt_usdt",
1217
+ // "makerCommission":"0.10",
1218
+ // "takerCommission":"0.10"
1219
+ // }
1220
+ //
1221
+ const marketId = this.safeString(fee, 'symbol');
1222
+ const symbol = this.safeSymbol(marketId);
1223
+ return {
1224
+ 'info': fee,
1225
+ 'symbol': symbol,
1226
+ 'maker': this.safeNumber(fee, 'makerCommission'),
1227
+ 'taker': this.safeNumber(fee, 'takerCommission'),
1228
+ };
1229
+ }
1230
+ async fetchTradingFee(symbol, params = {}) {
1231
+ /**
1232
+ * @method
1233
+ * @name lbank2#fetchTradingFee
1234
+ * @description fetch the trading fees for a market
1235
+ * @see https://www.lbank.com/en-US/docs/index.html#transaction-fee-rate-query
1236
+ * @param {string} symbol unified market symbol
1237
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1238
+ * @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
1239
+ */
1240
+ const market = this.market(symbol);
1241
+ const result = await this.fetchTradingFees(this.extend(params, { 'category': market['id'] }));
1242
+ return result;
1243
+ }
1244
+ async fetchTradingFees(params = {}) {
1245
+ /**
1246
+ * @method
1247
+ * @name lbank2#fetchTradingFees
1248
+ * @description fetch the trading fees for multiple markets
1249
+ * @see https://www.lbank.com/en-US/docs/index.html#transaction-fee-rate-query
1250
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1251
+ * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
1252
+ */
1253
+ await this.loadMarkets();
1254
+ const request = {};
1255
+ const response = await this.spotPrivatePostSupplementCustomerTradeFee(this.extend(request, params));
1256
+ const fees = this.safeValue(response, 'data', []);
1257
+ const result = {};
1258
+ for (let i = 0; i < fees.length; i++) {
1259
+ const fee = this.parseTradingFee(fees[i]);
1260
+ const symbol = fee['symbol'];
1261
+ result[symbol] = fee;
1262
+ }
1263
+ return result;
1264
+ }
1265
+ async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
1266
+ /**
1267
+ * @method
1268
+ * @name lbank#createMarketBuyOrderWithCost
1269
+ * @description create a market buy order by providing the symbol and cost
1270
+ * @see https://www.lbank.com/en-US/docs/index.html#place-order
1271
+ * @see https://www.lbank.com/en-US/docs/index.html#place-an-order
1272
+ * @param {string} symbol unified symbol of the market to create an order in
1273
+ * @param {float} cost how much you want to trade in units of the quote currency
1274
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1275
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1276
+ */
1277
+ await this.loadMarkets();
1278
+ const market = this.market(symbol);
1279
+ if (!market['spot']) {
1280
+ throw new errors.NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot orders only');
1281
+ }
1282
+ params['createMarketBuyOrderRequiresPrice'] = false;
1283
+ return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
1284
+ }
1285
+ async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
1286
+ /**
1287
+ * @method
1288
+ * @name lbank2#createOrder
1289
+ * @description create a trade order
1290
+ * @see https://www.lbank.com/en-US/docs/index.html#place-order
1291
+ * @see https://www.lbank.com/en-US/docs/index.html#place-an-order
1292
+ * @param {string} symbol unified symbol of the market to create an order in
1293
+ * @param {string} type 'market' or 'limit'
1294
+ * @param {string} side 'buy' or 'sell'
1295
+ * @param {float} amount how much of currency you want to trade in units of base currency
1296
+ * @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
1297
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1298
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1299
+ */
1300
+ await this.loadMarkets();
1301
+ const market = this.market(symbol);
1302
+ const clientOrderId = this.safeString2(params, 'custom_id', 'clientOrderId');
1303
+ const postOnly = this.safeValue(params, 'postOnly', false);
1304
+ const timeInForce = this.safeStringUpper(params, 'timeInForce');
1305
+ params = this.omit(params, ['custom_id', 'clientOrderId', 'timeInForce', 'postOnly']);
1306
+ const request = {
1307
+ 'symbol': market['id'],
1308
+ };
1309
+ const ioc = (timeInForce === 'IOC');
1310
+ const fok = (timeInForce === 'FOK');
1311
+ const maker = (postOnly || (timeInForce === 'PO'));
1312
+ if ((type === 'market') && (ioc || fok || maker)) {
1313
+ throw new errors.InvalidOrder(this.id + ' createOrder () does not allow market FOK, IOC, or postOnly orders. Only limit IOC, FOK, and postOnly orders are allowed');
1314
+ }
1315
+ if (type === 'limit') {
1316
+ request['type'] = side;
1317
+ request['price'] = this.priceToPrecision(symbol, price);
1318
+ request['amount'] = this.amountToPrecision(symbol, amount);
1319
+ if (ioc) {
1320
+ request['type'] = side + '_' + 'ioc';
1321
+ }
1322
+ else if (fok) {
1323
+ request['type'] = side + '_' + 'fok';
1324
+ }
1325
+ else if (maker) {
1326
+ request['type'] = side + '_' + 'maker';
1327
+ }
1328
+ }
1329
+ else if (type === 'market') {
1330
+ if (side === 'sell') {
1331
+ request['type'] = side + '_' + 'market';
1332
+ request['amount'] = this.amountToPrecision(symbol, amount);
1333
+ }
1334
+ else if (side === 'buy') {
1335
+ request['type'] = side + '_' + 'market';
1336
+ let quoteAmount = undefined;
1337
+ let createMarketBuyOrderRequiresPrice = true;
1338
+ [createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
1339
+ const cost = this.safeNumber(params, 'cost');
1340
+ params = this.omit(params, 'cost');
1341
+ if (cost !== undefined) {
1342
+ quoteAmount = this.costToPrecision(symbol, cost);
1343
+ }
1344
+ else if (createMarketBuyOrderRequiresPrice) {
1345
+ if (price === undefined) {
1346
+ throw new errors.InvalidOrder(this.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend in the amount argument');
1347
+ }
1348
+ else {
1349
+ const amountString = this.numberToString(amount);
1350
+ const priceString = this.numberToString(price);
1351
+ const costRequest = Precise["default"].stringMul(amountString, priceString);
1352
+ quoteAmount = this.costToPrecision(symbol, costRequest);
1353
+ }
1354
+ }
1355
+ else {
1356
+ quoteAmount = this.costToPrecision(symbol, amount);
1357
+ }
1358
+ // market buys require filling the price param instead of the amount param, for market buys the price is treated as the cost by lbank
1359
+ request['price'] = quoteAmount;
1360
+ }
1361
+ }
1362
+ if (clientOrderId !== undefined) {
1363
+ request['custom_id'] = clientOrderId;
1364
+ }
1365
+ let method = undefined;
1366
+ method = this.safeString(params, 'method');
1367
+ params = this.omit(params, 'method');
1368
+ if (method === undefined) {
1369
+ const options = this.safeValue(this.options, 'createOrder', {});
1370
+ method = this.safeString(options, 'method', 'spotPrivatePostSupplementCreateOrder');
1371
+ }
1372
+ const response = await this[method](this.extend(request, params));
1373
+ //
1374
+ // {
1375
+ // "result":true,
1376
+ // "data":{
1377
+ // "symbol":"doge_usdt",
1378
+ // "order_id":"0cf8a3de-4597-4296-af45-be7abaa06b07"
1379
+ // },
1380
+ // "error_code":0,
1381
+ // "ts":1648162321043
1382
+ // }
1383
+ //
1384
+ const result = this.safeValue(response, 'data', {});
1385
+ return this.safeOrder({
1386
+ 'id': this.safeString(result, 'order_id'),
1387
+ 'info': result,
1388
+ }, market);
1389
+ }
1390
+ parseOrderStatus(status) {
1391
+ const statuses = {
1392
+ '-1': 'canceled',
1393
+ '0': 'open',
1394
+ '1': 'open',
1395
+ '2': 'closed',
1396
+ '3': 'canceled',
1397
+ '4': 'closed', // disposal processing
1398
+ };
1399
+ return this.safeString(statuses, status, status);
1400
+ }
1401
+ parseOrder(order, market = undefined) {
1402
+ //
1403
+ // fetchOrderSupplement (private)
1404
+ //
1405
+ // {
1406
+ // "cummulativeQuoteQty":0,
1407
+ // "symbol":"doge_usdt",
1408
+ // "executedQty":0,
1409
+ // "orderId":"53d2d53e-70fb-4398-b722-f48571a5f61e",
1410
+ // "origQty":1E+2,
1411
+ // "price":0.05,
1412
+ // "clientOrderId":null,
1413
+ // "origQuoteOrderQty":5,
1414
+ // "updateTime":1648163406000,
1415
+ // "time":1648163139387,
1416
+ // "type":"buy_maker",
1417
+ // "status":-1
1418
+ // }
1419
+ //
1420
+ //
1421
+ // fetchOrderDefault (private)
1422
+ //
1423
+ // {
1424
+ // "symbol":"shib_usdt",
1425
+ // "amount":1,
1426
+ // "create_time":1649367863356,
1427
+ // "price":0.0000246103,
1428
+ // "avg_price":0.00002466180000000104,
1429
+ // "type":"buy_market",
1430
+ // "order_id":"abe8b92d-86d9-4d6d-b71e-d14f5fb53ddf",
1431
+ // "custom_id": "007", // field only present if user creates it at order time
1432
+ // "deal_amount":40548.54065802,
1433
+ // "status":2
1434
+ // }
1435
+ //
1436
+ // fetchOpenOrders (private)
1437
+ //
1438
+ // {
1439
+ // "cummulativeQuoteQty":0,
1440
+ // "symbol":"doge_usdt",
1441
+ // "executedQty":0,
1442
+ // "orderId":"73878edf-008d-4e4c-8041-df1f1b2cd8bb",
1443
+ // "origQty":100,
1444
+ // "price":0.05,
1445
+ // "origQuoteOrderQty":5,
1446
+ // "updateTime":1648501762000,
1447
+ // "time":1648501762353,
1448
+ // "type":"buy",
1449
+ // "status":0
1450
+ // }
1451
+ //
1452
+ // fetchOrders (private)
1453
+ //
1454
+ // {
1455
+ // "cummulativeQuoteQty":0,
1456
+ // "symbol":"doge_usdt",
1457
+ // "executedQty":0,
1458
+ // "orderId":"2cadc7cc-b5f6-486b-a5b4-d6ac49a9c186",
1459
+ // "origQty":100,
1460
+ // "price":0.05,
1461
+ // "origQuoteOrderQty":5,
1462
+ // "updateTime":1648501384000,
1463
+ // "time":1648501363889,
1464
+ // "type":"buy",
1465
+ // "status":-1
1466
+ // }
1467
+ //
1468
+ const id = this.safeString2(order, 'orderId', 'order_id');
1469
+ const clientOrderId = this.safeString2(order, 'clientOrderId', 'custom_id');
1470
+ const timestamp = this.safeInteger2(order, 'time', 'create_time');
1471
+ const rawStatus = this.safeString(order, 'status');
1472
+ const marketId = this.safeString(order, 'symbol');
1473
+ market = this.safeMarket(marketId, market);
1474
+ let timeInForce = undefined;
1475
+ let postOnly = false;
1476
+ let type = 'limit';
1477
+ const rawType = this.safeString(order, 'type'); // buy, sell, buy_market, sell_market, buy_maker,sell_maker,buy_ioc,sell_ioc, buy_fok, sell_fok
1478
+ const parts = rawType.split('_');
1479
+ const side = this.safeString(parts, 0);
1480
+ const typePart = this.safeString(parts, 1); // market, maker, ioc, fok or undefined (limit)
1481
+ if (typePart === 'market') {
1482
+ type = 'market';
1483
+ }
1484
+ if (typePart === 'maker') {
1485
+ postOnly = true;
1486
+ timeInForce = 'PO';
1487
+ }
1488
+ if (typePart === 'ioc') {
1489
+ timeInForce = 'IOC';
1490
+ }
1491
+ if (typePart === 'fok') {
1492
+ timeInForce = 'FOK';
1493
+ }
1494
+ const price = this.safeString(order, 'price');
1495
+ const costString = this.safeString(order, 'cummulativeQuoteQty');
1496
+ let amountString = undefined;
1497
+ if (rawType !== 'buy_market') {
1498
+ amountString = this.safeString2(order, 'origQty', 'amount');
1499
+ }
1500
+ const filledString = this.safeString2(order, 'executedQty', 'deal_amount');
1501
+ return this.safeOrder({
1502
+ 'id': id,
1503
+ 'clientOrderId': clientOrderId,
1504
+ 'datetime': this.iso8601(timestamp),
1505
+ 'timestamp': timestamp,
1506
+ 'lastTradeTimestamp': undefined,
1507
+ 'status': this.parseOrderStatus(rawStatus),
1508
+ 'symbol': market['symbol'],
1509
+ 'type': type,
1510
+ 'timeInForce': timeInForce,
1511
+ 'postOnly': postOnly,
1512
+ 'side': side,
1513
+ 'price': price,
1514
+ 'stopPrice': undefined,
1515
+ 'triggerPrice': undefined,
1516
+ 'cost': costString,
1517
+ 'amount': amountString,
1518
+ 'filled': filledString,
1519
+ 'remaining': undefined,
1520
+ 'trades': undefined,
1521
+ 'fee': undefined,
1522
+ 'info': order,
1523
+ 'average': undefined,
1524
+ }, market);
1525
+ }
1526
+ async fetchOrder(id, symbol = undefined, params = {}) {
1527
+ /**
1528
+ * @method
1529
+ * @name lbank2#fetchOrder
1530
+ * @description fetches information on an order made by the user
1531
+ * @see https://www.lbank.com/en-US/docs/index.html#query-order
1532
+ * @see https://www.lbank.com/en-US/docs/index.html#query-order-new
1533
+ * @param {string} symbol unified symbol of the market the order was made in
1534
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1535
+ * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1536
+ */
1537
+ await this.loadMarkets();
1538
+ let method = this.safeString(params, 'method');
1539
+ if (method === undefined) {
1540
+ const options = this.safeValue(this.options, 'fetchOrder', {});
1541
+ method = this.safeString(options, 'method', 'fetchOrderSupplement');
1542
+ }
1543
+ if (method === 'fetchOrderSupplement') {
1544
+ return await this.fetchOrderSupplement(id, symbol, params);
1545
+ }
1546
+ return await this.fetchOrderDefault(id, symbol, params);
1547
+ }
1548
+ async fetchOrderSupplement(id, symbol = undefined, params = {}) {
1549
+ if (symbol === undefined) {
1550
+ throw new errors.ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
1551
+ }
1552
+ await this.loadMarkets();
1553
+ const market = this.market(symbol);
1554
+ const request = {
1555
+ 'symbol': market['id'],
1556
+ 'orderId': id,
1557
+ };
1558
+ const response = await this.spotPrivatePostSupplementOrdersInfo(this.extend(request, params));
1559
+ //
1560
+ // {
1561
+ // "result":true,
1562
+ // "data":{
1563
+ // "cummulativeQuoteQty":0,
1564
+ // "symbol":"doge_usdt",
1565
+ // "executedQty":0,
1566
+ // "orderId":"53d2d53e-70fb-4398-b722-f48571a5f61e",
1567
+ // "origQty":1E+2,
1568
+ // "price":0.05,
1569
+ // "clientOrderId":null,
1570
+ // "origQuoteOrderQty":5,
1571
+ // "updateTime":1648163406000,
1572
+ // "time":1648163139387,
1573
+ // "type":"buy_maker",
1574
+ // "status":-1
1575
+ // },
1576
+ // "error_code":0,
1577
+ // "ts":1648164471827
1578
+ // }
1579
+ //
1580
+ const result = this.safeValue(response, 'data', {});
1581
+ return this.parseOrder(result);
1582
+ }
1583
+ async fetchOrderDefault(id, symbol = undefined, params = {}) {
1584
+ // Id can be a list of ids delimited by a comma
1585
+ if (symbol === undefined) {
1586
+ throw new errors.ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
1587
+ }
1588
+ await this.loadMarkets();
1589
+ const market = this.market(symbol);
1590
+ const request = {
1591
+ 'symbol': market['id'],
1592
+ 'order_id': id,
1593
+ };
1594
+ const response = await this.spotPrivatePostOrdersInfo(this.extend(request, params));
1595
+ //
1596
+ // {
1597
+ // "result":true,
1598
+ // "data":[
1599
+ // {
1600
+ // "symbol":"doge_usdt",
1601
+ // "amount":18,
1602
+ // "create_time":1647455223186,
1603
+ // "price":0,
1604
+ // "avg_price":0.113344,
1605
+ // "type":"sell_market",
1606
+ // "order_id":"d4ca1ddd-40d9-42c1-9717-5de435865bec",
1607
+ // "deal_amount":18,
1608
+ // "status":2
1609
+ // }
1610
+ // ],
1611
+ // "error_code":0,
1612
+ // "ts":1647455270776
1613
+ // }
1614
+ //
1615
+ const result = this.safeValue(response, 'data', []);
1616
+ const numOrders = result.length;
1617
+ if (numOrders === 1) {
1618
+ return this.parseOrder(result[0]);
1619
+ }
1620
+ else {
1621
+ // const parsedOrders = [];
1622
+ // for (let i = 0; i < numOrders; i++) {
1623
+ // const parsedOrder = this.parseOrder (result[i]);
1624
+ // parsedOrders.push (parsedOrder);
1625
+ // }
1626
+ // return parsedOrders;
1627
+ throw new errors.BadRequest(this.id + ' fetchOrder() can only fetch one order at a time');
1628
+ }
1629
+ }
1630
+ async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1631
+ /**
1632
+ * @method
1633
+ * @name lbank2#fetchMyTrades
1634
+ * @description fetch all trades made by the user
1635
+ * @see https://www.lbank.com/en-US/docs/index.html#past-transaction-details
1636
+ * @param {string} symbol unified market symbol
1637
+ * @param {int} [since] the earliest time in ms to fetch trades for
1638
+ * @param {int} [limit] the maximum number of trade structures to retrieve
1639
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1640
+ * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
1641
+ */
1642
+ if (symbol === undefined) {
1643
+ throw new errors.ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument');
1644
+ }
1645
+ await this.loadMarkets();
1646
+ const market = this.market(symbol);
1647
+ since = this.safeValue(params, 'start_date', since);
1648
+ params = this.omit(params, 'start_date');
1649
+ const request = {
1650
+ 'symbol': market['id'],
1651
+ // 'start_date' Start time yyyy-mm-dd, the maximum is today, the default is yesterday
1652
+ // 'end_date' Finish time yyyy-mm-dd, the maximum is today, the default is today
1653
+ // 'The start': and end date of the query window is up to 2 days
1654
+ // 'from' Initial transaction number inquiring
1655
+ // 'direct' inquire direction,The default is the 'next' which is the positive sequence of dealing time,the 'prev' is inverted order of dealing time
1656
+ // 'size' Query the number of defaults to 100
1657
+ };
1658
+ if (limit !== undefined) {
1659
+ request['size'] = limit;
1660
+ }
1661
+ if (since !== undefined) {
1662
+ request['start_date'] = this.ymd(since, '-'); // max query 2 days ago
1663
+ request['end_date'] = this.ymd(since + 86400000, '-'); // will cover 2 days
1664
+ }
1665
+ const response = await this.spotPrivatePostTransactionHistory(this.extend(request, params));
1666
+ //
1667
+ // {
1668
+ // "result":true,
1669
+ // "data":[
1670
+ // {
1671
+ // "orderUuid":"38b4e7a4-14f6-45fd-aba1-1a37024124a0",
1672
+ // "tradeFeeRate":0.0010000000,
1673
+ // "dealTime":1648500944496,
1674
+ // "dealQuantity":30.00000000000000000000,
1675
+ // "tradeFee":0.00453300000000000000,
1676
+ // "txUuid":"11f3850cc6214ea3b495adad3a032794",
1677
+ // "dealPrice":0.15111300000000000000,
1678
+ // "dealVolumePrice":4.53339000000000000000,
1679
+ // "tradeType":"sell_market"
1680
+ // }
1681
+ // ],
1682
+ // "error_code":0,
1683
+ // "ts":1648509742164
1684
+ // }
1685
+ //
1686
+ const trades = this.safeValue(response, 'data', []);
1687
+ return this.parseTrades(trades, market, since, limit);
1688
+ }
1689
+ async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1690
+ /**
1691
+ * @method
1692
+ * @name lbank2#fetchOrders
1693
+ * @description fetches information on multiple orders made by the user
1694
+ * @see https://www.lbank.com/en-US/docs/index.html#query-all-orders
1695
+ * @param {string} symbol unified market symbol of the market orders were made in
1696
+ * @param {int} [since] the earliest time in ms to fetch orders for
1697
+ * @param {int} [limit] the maximum number of order structures to retrieve
1698
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1699
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1700
+ */
1701
+ // default query is for canceled and completely filled orders
1702
+ // does not return open orders unless specified explicitly
1703
+ if (symbol === undefined) {
1704
+ throw new errors.ArgumentsRequired(this.id + ' fetchOrders() requires a symbol argument');
1705
+ }
1706
+ await this.loadMarkets();
1707
+ const market = this.market(symbol);
1708
+ if (limit === undefined) {
1709
+ limit = 100;
1710
+ }
1711
+ const request = {
1712
+ 'symbol': market['id'],
1713
+ 'current_page': 1,
1714
+ 'page_length': limit,
1715
+ // 'status' -1: Cancelled, 0: Unfilled, 1: Partially filled, 2: Completely filled, 3: Partially filled and cancelled, 4: Cancellation is being processed
1716
+ };
1717
+ const response = await this.spotPrivatePostSupplementOrdersInfoHistory(this.extend(request, params));
1718
+ //
1719
+ // {
1720
+ // "result":true,
1721
+ // "data":{
1722
+ // "total":1,
1723
+ // "page_length":100,
1724
+ // "orders":[
1725
+ // {
1726
+ // "cummulativeQuoteQty":0,
1727
+ // "symbol":"doge_usdt",
1728
+ // "executedQty":0,
1729
+ // "orderId":"2cadc7cc-b5f6-486b-a5b4-d6ac49a9c186",
1730
+ // "origQty":100,
1731
+ // "price":0.05,
1732
+ // "origQuoteOrderQty":5,
1733
+ // "updateTime":1648501384000,
1734
+ // "time":1648501363889,
1735
+ // "type":"buy",
1736
+ // "status":-1
1737
+ // }, ...
1738
+ // ],
1739
+ // "current_page":1
1740
+ // },
1741
+ // "error_code":0,
1742
+ // "ts":1648505706348
1743
+ // }
1744
+ //
1745
+ const result = this.safeValue(response, 'data', {});
1746
+ const orders = this.safeValue(result, 'orders', []);
1747
+ return this.parseOrders(orders, market, since, limit);
1748
+ }
1749
+ async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1750
+ /**
1751
+ * @method
1752
+ * @name lbank2#fetchOpenOrders
1753
+ * @description fetch all unfilled currently open orders
1754
+ * @see https://www.lbank.com/en-US/docs/index.html#current-pending-order
1755
+ * @param {string} symbol unified market symbol
1756
+ * @param {int} [since] the earliest time in ms to fetch open orders for
1757
+ * @param {int} [limit] the maximum number of open order structures to retrieve
1758
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1759
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1760
+ */
1761
+ if (symbol === undefined) {
1762
+ throw new errors.ArgumentsRequired(this.id + ' fetchOpenOrders() requires a symbol argument');
1763
+ }
1764
+ await this.loadMarkets();
1765
+ const market = this.market(symbol);
1766
+ if (limit === undefined) {
1767
+ limit = 100;
1768
+ }
1769
+ const request = {
1770
+ 'symbol': market['id'],
1771
+ 'current_page': 1,
1772
+ 'page_length': limit,
1773
+ };
1774
+ const response = await this.spotPrivatePostSupplementOrdersInfoNoDeal(this.extend(request, params));
1775
+ //
1776
+ // {
1777
+ // "result":true,
1778
+ // "data":{
1779
+ // "total":1,
1780
+ // "page_length":100,
1781
+ // "orders":[
1782
+ // {
1783
+ // "cummulativeQuoteQty":0,
1784
+ // "symbol":"doge_usdt",
1785
+ // "executedQty":0,
1786
+ // "orderId":"73878edf-008d-4e4c-8041-df1f1b2cd8bb",
1787
+ // "origQty":100,
1788
+ // "price":0.05,
1789
+ // "origQuoteOrderQty":5,
1790
+ // "updateTime":1648501762000,
1791
+ // "time":1648501762353,
1792
+ // "type":"buy",
1793
+ // "status":0
1794
+ // }, ...
1795
+ // ],
1796
+ // "current_page":1
1797
+ // },
1798
+ // "error_code":0,
1799
+ // "ts":1648506110196
1800
+ // }
1801
+ //
1802
+ const result = this.safeValue(response, 'data', {});
1803
+ const orders = this.safeValue(result, 'orders', []);
1804
+ return this.parseOrders(orders, market, since, limit);
1805
+ }
1806
+ async cancelOrder(id, symbol = undefined, params = {}) {
1807
+ /**
1808
+ * @method
1809
+ * @name lbank2#cancelOrder
1810
+ * @description cancels an open order
1811
+ * @see https://www.lbank.com/en-US/docs/index.html#cancel-order-new
1812
+ * @param {string} id order id
1813
+ * @param {string} symbol unified symbol of the market the order was made in
1814
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1815
+ * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1816
+ */
1817
+ if (symbol === undefined) {
1818
+ throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
1819
+ }
1820
+ await this.loadMarkets();
1821
+ const clientOrderId = this.safeString2(params, 'origClientOrderId', 'clientOrderId');
1822
+ params = this.omit(params, ['origClientOrderId', 'clientOrderId']);
1823
+ const market = this.market(symbol);
1824
+ const request = {
1825
+ 'symbol': market['id'],
1826
+ 'orderId': id,
1827
+ };
1828
+ if (clientOrderId !== undefined) {
1829
+ request['origClientOrderId'] = clientOrderId;
1830
+ }
1831
+ const response = await this.spotPrivatePostSupplementCancelOrder(this.extend(request, params));
1832
+ //
1833
+ // {
1834
+ // "result":true,
1835
+ // "data":{
1836
+ // "executedQty":0.0,
1837
+ // "price":0.05,
1838
+ // "origQty":100.0,
1839
+ // "tradeType":"buy",
1840
+ // "status":0
1841
+ // },
1842
+ // "error_code":0,
1843
+ // "ts":1648501286196
1844
+ // }
1845
+ const result = this.safeValue(response, 'data', {});
1846
+ return result;
1847
+ }
1848
+ async cancelAllOrders(symbol = undefined, params = {}) {
1849
+ /**
1850
+ * @method
1851
+ * @name lbank2#cancelAllOrders
1852
+ * @description cancel all open orders in a market
1853
+ * @see https://www.lbank.com/en-US/docs/index.html#cancel-all-pending-orders-for-a-single-trading-pair
1854
+ * @param {string} symbol unified market symbol of the market to cancel orders in
1855
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1856
+ * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1857
+ */
1858
+ if (symbol === undefined) {
1859
+ throw new errors.ArgumentsRequired(this.id + ' cancelAllOrders() requires a symbol argument');
1860
+ }
1861
+ await this.loadMarkets();
1862
+ const market = this.market(symbol);
1863
+ const request = {
1864
+ 'symbol': market['id'],
1865
+ };
1866
+ const response = await this.spotPrivatePostSupplementCancelOrderBySymbol(this.extend(request, params));
1867
+ //
1868
+ // {
1869
+ // "result":"true",
1870
+ // "data":[
1871
+ // {
1872
+ // "executedQty":0.00000000000000000000,
1873
+ // "orderId":"293ef71b-3e67-4962-af93-aa06990a045f",
1874
+ // "price":0.05000000000000000000,
1875
+ // "origQty":100.00000000000000000000,
1876
+ // "tradeType":"buy",
1877
+ // "status":0
1878
+ // },
1879
+ // ],
1880
+ // "error_code":0,
1881
+ // "ts":1648506641469
1882
+ // }
1883
+ //
1884
+ const result = this.safeValue(response, 'data', []);
1885
+ return result;
1886
+ }
1887
+ getNetworkCodeForCurrency(currencyCode, params) {
1888
+ const defaultNetworks = this.safeValue(this.options, 'defaultNetworks');
1889
+ const defaultNetwork = this.safeStringUpper(defaultNetworks, currencyCode);
1890
+ const networks = this.safeValue(this.options, 'networks', {});
1891
+ let network = this.safeStringUpper(params, 'network', defaultNetwork); // this line allows the user to specify either ERC20 or ETH
1892
+ network = this.safeString(networks, network, network); // handle ERC20>ETH alias
1893
+ return network;
1894
+ }
1895
+ async fetchDepositAddress(code, params = {}) {
1896
+ /**
1897
+ * @method
1898
+ * @name lbank2#fetchDepositAddress
1899
+ * @description fetch the deposit address for a currency associated with this account
1900
+ * @see https://www.lbank.com/en-US/docs/index.html#get-deposit-address
1901
+ * @see https://www.lbank.com/en-US/docs/index.html#the-user-obtains-the-deposit-address
1902
+ * @param {string} code unified currency code
1903
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1904
+ * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
1905
+ */
1906
+ await this.loadMarkets();
1907
+ let method = this.safeString(params, 'method');
1908
+ params = this.omit(params, 'method');
1909
+ if (method === undefined) {
1910
+ const options = this.safeValue(this.options, 'fetchDepositAddress', {});
1911
+ method = this.safeString(options, 'method', 'fetchDepositAddressDefault');
1912
+ }
1913
+ return await this[method](code, params);
1914
+ }
1915
+ async fetchDepositAddressDefault(code, params = {}) {
1916
+ await this.loadMarkets();
1917
+ const currency = this.currency(code);
1918
+ const request = {
1919
+ 'assetCode': currency['id'],
1920
+ };
1921
+ const network = this.getNetworkCodeForCurrency(code, params);
1922
+ if (network !== undefined) {
1923
+ request['netWork'] = network; // ... yes, really lol
1924
+ params = this.omit(params, 'network');
1925
+ }
1926
+ const response = await this.spotPrivatePostGetDepositAddress(this.extend(request, params));
1927
+ //
1928
+ // {
1929
+ // "result":true,
1930
+ // "data":{
1931
+ // "assetCode":"usdt",
1932
+ // "address":"0xc85689d37ca650bf2f2161364cdedee21eb6ca53",
1933
+ // "memo":null,
1934
+ // "netWork":"bep20(bsc)"
1935
+ // },
1936
+ // "error_code":0,
1937
+ // "ts":1648075865103
1938
+ // }
1939
+ //
1940
+ const result = this.safeValue(response, 'data');
1941
+ const address = this.safeString(result, 'address');
1942
+ const tag = this.safeString(result, 'memo');
1943
+ const networkId = this.safeString(result, 'netWork');
1944
+ const inverseNetworks = this.safeValue(this.options, 'inverse-networks', {});
1945
+ const networkCode = this.safeStringUpper(inverseNetworks, networkId, networkId);
1946
+ return {
1947
+ 'currency': code,
1948
+ 'address': address,
1949
+ 'tag': tag,
1950
+ 'network': networkCode,
1951
+ 'info': response,
1952
+ };
1953
+ }
1954
+ async fetchDepositAddressSupplement(code, params = {}) {
1955
+ // returns the address for whatever the default network is...
1956
+ await this.loadMarkets();
1957
+ const currency = this.currency(code);
1958
+ const request = {
1959
+ 'coin': currency['id'],
1960
+ };
1961
+ const networks = this.safeValue(this.options, 'networks');
1962
+ let network = this.safeStringUpper(params, 'network');
1963
+ network = this.safeString(networks, network, network);
1964
+ if (network !== undefined) {
1965
+ request['networkName'] = network;
1966
+ params = this.omit(params, 'network');
1967
+ }
1968
+ const response = await this.spotPrivatePostSupplementGetDepositAddress(this.extend(request, params));
1969
+ //
1970
+ // {
1971
+ // "result":true,
1972
+ // "data":{
1973
+ // "address":"TDxtabCC8iQwaxUUrPcE4WL2jArGAfvQ5A",
1974
+ // "memo":null,
1975
+ // "coin":"usdt"
1976
+ // },
1977
+ // "error_code":0,
1978
+ // "ts":1648073818880
1979
+ // }
1980
+ //
1981
+ const result = this.safeValue(response, 'data');
1982
+ const address = this.safeString(result, 'address');
1983
+ const tag = this.safeString(result, 'memo');
1984
+ const inverseNetworks = this.safeValue(this.options, 'inverse-networks', {});
1985
+ const networkCode = this.safeStringUpper(inverseNetworks, network, network);
1986
+ return {
1987
+ 'currency': code,
1988
+ 'address': address,
1989
+ 'tag': tag,
1990
+ 'network': networkCode,
1991
+ 'info': response,
1992
+ };
1993
+ }
1994
+ async withdraw(code, amount, address, tag = undefined, params = {}) {
1995
+ /**
1996
+ * @method
1997
+ * @name lbank2#withdraw
1998
+ * @description make a withdrawal
1999
+ * @see https://www.lbank.com/en-US/docs/index.html#withdrawal
2000
+ * @param {string} code unified currency code
2001
+ * @param {float} amount the amount to withdraw
2002
+ * @param {string} address the address to withdraw to
2003
+ * @param {string} tag
2004
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2005
+ * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
2006
+ */
2007
+ [tag, params] = this.handleWithdrawTagAndParams(tag, params);
2008
+ this.checkAddress(address);
2009
+ await this.loadMarkets();
2010
+ const fee = this.safeString(params, 'fee');
2011
+ params = this.omit(params, 'fee');
2012
+ // The relevant coin network fee can be found by calling fetchDepositWithdrawFees (), note: if no network param is supplied then the default network will be used, this can also be found in fetchDepositWithdrawFees ().
2013
+ this.checkRequiredArgument('withdraw', fee, 'fee');
2014
+ const currency = this.currency(code);
2015
+ const request = {
2016
+ 'address': address,
2017
+ 'coin': currency['id'],
2018
+ 'amount': amount,
2019
+ 'fee': fee, // the correct coin-network fee must be supplied, which can be found by calling fetchDepositWithdrawFees (private)
2020
+ // 'networkName': defaults to the defaultNetwork of the coin which can be found in the /supplement/user_info endpoint
2021
+ // 'memo': memo: memo word of bts and dct
2022
+ // 'mark': Withdrawal Notes
2023
+ // 'name': Remarks of the address. After filling in this parameter, it will be added to the withdrawal address book of the currency.
2024
+ // 'withdrawOrderId': withdrawOrderId
2025
+ // 'type': type=1 is for intra-site transfer
2026
+ };
2027
+ if (tag !== undefined) {
2028
+ request['memo'] = tag;
2029
+ }
2030
+ const network = this.safeStringUpper2(params, 'network', 'networkName');
2031
+ params = this.omit(params, ['network', 'networkName']);
2032
+ const networks = this.safeValue(this.options, 'networks');
2033
+ const networkId = this.safeString(networks, network, network);
2034
+ if (networkId !== undefined) {
2035
+ request['networkName'] = networkId;
2036
+ }
2037
+ const response = await this.spotPrivatePostSupplementWithdraw(this.extend(request, params));
2038
+ //
2039
+ // {
2040
+ // "result":true,
2041
+ // "data": {
2042
+ // "fee":10.00000000000000000000,
2043
+ // "withdrawId":1900376
2044
+ // },
2045
+ // "error_code":0,
2046
+ // "ts":1648992501414
2047
+ // }
2048
+ //
2049
+ const result = this.safeValue(response, 'data', {});
2050
+ return {
2051
+ 'info': result,
2052
+ 'id': this.safeString(result, 'withdrawId'),
2053
+ };
2054
+ }
2055
+ parseTransactionStatus(status, type) {
2056
+ const statuses = {
2057
+ 'deposit': {
2058
+ '1': 'pending',
2059
+ '2': 'ok',
2060
+ '3': 'failed',
2061
+ '4': 'canceled',
2062
+ '5': 'transfer',
2063
+ },
2064
+ 'withdrawal': {
2065
+ '1': 'pending',
2066
+ '2': 'canceled',
2067
+ '3': 'failed',
2068
+ '4': 'ok',
2069
+ },
2070
+ };
2071
+ return this.safeString(this.safeValue(statuses, type, {}), status, status);
2072
+ }
2073
+ parseTransaction(transaction, currency = undefined) {
2074
+ //
2075
+ // fetchDeposits (private)
2076
+ //
2077
+ // {
2078
+ // "insertTime":1649012310000,
2079
+ // "amount":9.00000000000000000000,
2080
+ // "address":"TYASr5UV6HEcXatwdFQfmLVUqQQQMUxHLS",
2081
+ // "networkName":"trc20",
2082
+ // "txId":"081e4e9351dd0274922168da5f2d14ea6c495b1c3b440244f4a6dd9fe196bf2b",
2083
+ // "coin":"usdt",
2084
+ // "status":"2"
2085
+ // }
2086
+ //
2087
+ //
2088
+ // fetchWithdrawals (private)
2089
+ //
2090
+ // {
2091
+ // "amount":2.00000000000000000000,
2092
+ // "address":"TBjrW5JHDyPZjFc5nrRMhRWUDaJmhGhmD6",
2093
+ // "fee":1.00000000000000000000,
2094
+ // "networkName":"trc20",
2095
+ // "coid":"usdt",
2096
+ // "transferType":"数字资产提现",
2097
+ // "txId":"47eeee2763ad49b8817524dacfa7d092fb58f8b0ab7e5d25473314df1a793c3d",
2098
+ // "id":1902194,
2099
+ // "applyTime":1649014002000,
2100
+ // "status":"4"
2101
+ // }
2102
+ //
2103
+ const id = this.safeString(transaction, 'id');
2104
+ let type = undefined;
2105
+ if (id === undefined) {
2106
+ type = 'deposit';
2107
+ }
2108
+ else {
2109
+ type = 'withdrawal';
2110
+ }
2111
+ const txid = this.safeString(transaction, 'txId');
2112
+ const timestamp = this.safeInteger2(transaction, 'insertTime', 'applyTime');
2113
+ const networks = this.safeValue(this.options, 'inverse-networks', {});
2114
+ const networkId = this.safeString(transaction, 'networkName');
2115
+ const network = this.safeString(networks, networkId, networkId);
2116
+ const address = this.safeString(transaction, 'address');
2117
+ let addressFrom = undefined;
2118
+ let addressTo = undefined;
2119
+ if (type === 'deposit') {
2120
+ addressFrom = address;
2121
+ }
2122
+ else {
2123
+ addressTo = address;
2124
+ }
2125
+ const amount = this.safeNumber(transaction, 'amount');
2126
+ const currencyId = this.safeString2(transaction, 'coin', 'coid');
2127
+ const code = this.safeCurrencyCode(currencyId, currency);
2128
+ const status = this.parseTransactionStatus(this.safeString(transaction, 'status'), type);
2129
+ let fee = undefined;
2130
+ const feeCost = this.safeNumber(transaction, 'fee');
2131
+ if (feeCost !== undefined) {
2132
+ fee = {
2133
+ 'cost': feeCost,
2134
+ 'currency': code,
2135
+ };
2136
+ }
2137
+ return {
2138
+ 'info': transaction,
2139
+ 'id': id,
2140
+ 'txid': txid,
2141
+ 'timestamp': timestamp,
2142
+ 'datetime': this.iso8601(timestamp),
2143
+ 'network': network,
2144
+ 'address': address,
2145
+ 'addressTo': addressTo,
2146
+ 'addressFrom': addressFrom,
2147
+ 'tag': undefined,
2148
+ 'tagTo': undefined,
2149
+ 'tagFrom': undefined,
2150
+ 'type': type,
2151
+ 'amount': amount,
2152
+ 'currency': code,
2153
+ 'status': status,
2154
+ 'updated': undefined,
2155
+ 'comment': undefined,
2156
+ 'internal': (status === 'transfer'),
2157
+ 'fee': fee,
2158
+ };
2159
+ }
2160
+ async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
2161
+ /**
2162
+ * @method
2163
+ * @name lbank2#fetchDeposits
2164
+ * @description fetch all deposits made to an account
2165
+ * @see https://www.lbank.com/en-US/docs/index.html#get-recharge-history
2166
+ * @param {string} code unified currency code
2167
+ * @param {int} [since] the earliest time in ms to fetch deposits for
2168
+ * @param {int} [limit] the maximum number of deposits structures to retrieve
2169
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2170
+ * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
2171
+ */
2172
+ await this.loadMarkets();
2173
+ const request = {
2174
+ // 'status': Recharge status: ("1","Applying"),("2","Recharge successful"),("3","Recharge failed"),("4","Already Cancel"), ("5", "Transfer")
2175
+ // 'endTime': end time, timestamp in milliseconds, default now
2176
+ };
2177
+ let currency = undefined;
2178
+ if (code !== undefined) {
2179
+ currency = this.currency(code);
2180
+ request['coin'] = currency['id'];
2181
+ }
2182
+ if (since !== undefined) {
2183
+ request['startTime'] = since;
2184
+ }
2185
+ const response = await this.spotPrivatePostSupplementDepositHistory(this.extend(request, params));
2186
+ //
2187
+ // {
2188
+ // "result":true,
2189
+ // "data": {
2190
+ // "total":1,
2191
+ // "depositOrders": [
2192
+ // {
2193
+ // "insertTime":1649012310000,
2194
+ // "amount":9.00000000000000000000,
2195
+ // "address":"TYASr5UV6HEcXatwdFQfmLVUqQQQMUxHLS",
2196
+ // "networkName":"trc20",
2197
+ // "txId":"081e4e9351dd0274922168da5f2d14ea6c495b1c3b440244f4a6dd9fe196bf2b",
2198
+ // "coin":"usdt",
2199
+ // "status":"2"
2200
+ // },
2201
+ // ],
2202
+ // "page_length":20,
2203
+ // "current_page":1
2204
+ // },
2205
+ // "error_code":0,
2206
+ // "ts":1649719721758
2207
+ // }
2208
+ //
2209
+ const data = this.safeValue(response, 'data', {});
2210
+ const deposits = this.safeValue(data, 'depositOrders', []);
2211
+ return this.parseTransactions(deposits, currency, since, limit);
2212
+ }
2213
+ async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
2214
+ /**
2215
+ * @method
2216
+ * @name lbank2#fetchWithdrawals
2217
+ * @description fetch all withdrawals made from an account
2218
+ * @see https://www.lbank.com/en-US/docs/index.html#get-withdrawal-history
2219
+ * @param {string} code unified currency code
2220
+ * @param {int} [since] the earliest time in ms to fetch withdrawals for
2221
+ * @param {int} [limit] the maximum number of withdrawals structures to retrieve
2222
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2223
+ * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
2224
+ */
2225
+ await this.loadMarkets();
2226
+ const request = {
2227
+ // 'status': Recharge status: ("1","Applying"),("2","Recharge successful"),("3","Recharge failed"),("4","Already Cancel"), ("5", "Transfer")
2228
+ // 'endTime': end time, timestamp in milliseconds, default now
2229
+ // 'withdrawOrderId': Custom withdrawal id
2230
+ };
2231
+ let currency = undefined;
2232
+ if (code !== undefined) {
2233
+ currency = this.currency(code);
2234
+ request['coin'] = currency['id'];
2235
+ }
2236
+ if (since !== undefined) {
2237
+ request['startTime'] = since;
2238
+ }
2239
+ const response = await this.spotPrivatePostSupplementWithdraws(this.extend(request, params));
2240
+ //
2241
+ // {
2242
+ // "result":true,
2243
+ // "data": {
2244
+ // "total":1,
2245
+ // "withdraws": [
2246
+ // {
2247
+ // "amount":2.00000000000000000000,
2248
+ // "address":"TBjrW5JHDyPZjFc5nrRMhRWUDaJmhGhmD6",
2249
+ // "fee":1.00000000000000000000,
2250
+ // "networkName":"trc20",
2251
+ // "coid":"usdt",
2252
+ // "transferType":"数字资产提现",
2253
+ // "txId":"47eeee2763ad49b8817524dacfa7d092fb58f8b0ab7e5d25473314df1a793c3d",
2254
+ // "id":1902194,
2255
+ // "applyTime":1649014002000,
2256
+ // "status":"4"
2257
+ // },
2258
+ // ],
2259
+ // "page_length":20,
2260
+ // "current_page":1
2261
+ // },
2262
+ // "error_code":0,
2263
+ // "ts":1649720362362
2264
+ // }
2265
+ //
2266
+ const data = this.safeValue(response, 'data', {});
2267
+ const withdraws = this.safeValue(data, 'withdraws', []);
2268
+ return this.parseTransactions(withdraws, currency, since, limit);
2269
+ }
2270
+ async fetchTransactionFees(codes = undefined, params = {}) {
2271
+ /**
2272
+ * @method
2273
+ * @name lbank2#fetchTransactionFees
2274
+ * @deprecated
2275
+ * @description please use fetchDepositWithdrawFees instead
2276
+ * @param {string[]|undefined} codes not used by lbank2 fetchTransactionFees ()
2277
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2278
+ * @returns {object} a list of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
2279
+ */
2280
+ // private only returns information for currencies with non-zero balance
2281
+ await this.loadMarkets();
2282
+ const isAuthorized = this.checkRequiredCredentials(false);
2283
+ let result = undefined;
2284
+ if (isAuthorized === true) {
2285
+ let method = this.safeString(params, 'method');
2286
+ params = this.omit(params, 'method');
2287
+ if (method === undefined) {
2288
+ const options = this.safeValue(this.options, 'fetchTransactionFees', {});
2289
+ method = this.safeString(options, 'method', 'fetchPrivateTransactionFees');
2290
+ }
2291
+ result = await this[method](params);
2292
+ }
2293
+ else {
2294
+ result = await this.fetchPublicTransactionFees(params);
2295
+ }
2296
+ return result;
2297
+ }
2298
+ async fetchPrivateTransactionFees(params = {}) {
2299
+ // complete response
2300
+ // incl. for coins which undefined in public method
2301
+ await this.loadMarkets();
2302
+ const response = await this.spotPrivatePostSupplementUserInfo();
2303
+ //
2304
+ // {
2305
+ // "result": "true",
2306
+ // "data": [
2307
+ // {
2308
+ // "usableAmt": "14.36",
2309
+ // "assetAmt": "14.36",
2310
+ // "networkList": [
2311
+ // {
2312
+ // "isDefault": false,
2313
+ // "withdrawFeeRate": "",
2314
+ // "name": "erc20",
2315
+ // "withdrawMin": 30,
2316
+ // "minLimit": 0.0001,
2317
+ // "minDeposit": 20,
2318
+ // "feeAssetCode": "usdt",
2319
+ // "withdrawFee": "30",
2320
+ // "type": 1,
2321
+ // "coin": "usdt",
2322
+ // "network": "eth"
2323
+ // },
2324
+ // ...
2325
+ // ],
2326
+ // "freezeAmt": "0",
2327
+ // "coin": "ada"
2328
+ // }
2329
+ // ],
2330
+ // "code": 0
2331
+ // }
2332
+ //
2333
+ const result = this.safeValue(response, 'data', []);
2334
+ const withdrawFees = {};
2335
+ for (let i = 0; i < result.length; i++) {
2336
+ const entry = result[i];
2337
+ const currencyId = this.safeString(entry, 'coin');
2338
+ const code = this.safeCurrencyCode(currencyId);
2339
+ const networkList = this.safeValue(entry, 'networkList', []);
2340
+ withdrawFees[code] = {};
2341
+ for (let j = 0; j < networkList.length; j++) {
2342
+ const networkEntry = networkList[j];
2343
+ const networkId = this.safeString(networkEntry, 'name');
2344
+ const networkCode = this.safeString(this.options['inverse-networks'], networkId, networkId);
2345
+ const fee = this.safeNumber(networkEntry, 'withdrawFee');
2346
+ if (fee !== undefined) {
2347
+ withdrawFees[code][networkCode] = fee;
2348
+ }
2349
+ }
2350
+ }
2351
+ return {
2352
+ 'withdraw': withdrawFees,
2353
+ 'deposit': {},
2354
+ 'info': response,
2355
+ };
2356
+ }
2357
+ async fetchPublicTransactionFees(params = {}) {
2358
+ // extremely incomplete response
2359
+ // vast majority fees undefined
2360
+ await this.loadMarkets();
2361
+ const code = this.safeString2(params, 'coin', 'assetCode');
2362
+ params = this.omit(params, ['coin', 'assetCode']);
2363
+ const request = {};
2364
+ if (code !== undefined) {
2365
+ const currency = this.currency(code);
2366
+ request['assetCode'] = currency['id'];
2367
+ }
2368
+ const response = await this.spotPublicGetWithdrawConfigs(this.extend(request, params));
2369
+ //
2370
+ // {
2371
+ // "result": "true",
2372
+ // "data": [
2373
+ // {
2374
+ // "amountScale": "4",
2375
+ // "chain": "heco",
2376
+ // "assetCode": "lbk",
2377
+ // "min": "200",
2378
+ // "transferAmtScale": "4",
2379
+ // "canWithDraw": true,
2380
+ // "fee": "100",
2381
+ // "minTransfer": "0.0001",
2382
+ // "type": "1"
2383
+ // },
2384
+ // ...
2385
+ // ],
2386
+ // "error_code": "0",
2387
+ // "ts": "1663364435973"
2388
+ // }
2389
+ //
2390
+ const result = this.safeValue(response, 'data', []);
2391
+ const withdrawFees = {};
2392
+ for (let i = 0; i < result.length; i++) {
2393
+ const item = result[i];
2394
+ const canWithdraw = this.safeValue(item, 'canWithDraw');
2395
+ if (canWithdraw === 'true') {
2396
+ const currencyId = this.safeString(item, 'assetCode');
2397
+ const codeInner = this.safeCurrencyCode(currencyId);
2398
+ const chain = this.safeString(item, 'chain');
2399
+ let network = this.safeString(this.options['inverse-networks'], chain, chain);
2400
+ if (network === undefined) {
2401
+ network = codeInner;
2402
+ }
2403
+ const fee = this.safeString(item, 'fee');
2404
+ if (withdrawFees[codeInner] === undefined) {
2405
+ withdrawFees[codeInner] = {};
2406
+ }
2407
+ withdrawFees[codeInner][network] = this.parseNumber(fee);
2408
+ }
2409
+ }
2410
+ return {
2411
+ 'withdraw': withdrawFees,
2412
+ 'deposit': {},
2413
+ 'info': response,
2414
+ };
2415
+ }
2416
+ async fetchDepositWithdrawFees(codes = undefined, params = {}) {
2417
+ /**
2418
+ * @method
2419
+ * @name lbank2#fetchDepositWithdrawFees
2420
+ * @description when using private endpoint, only returns information for currencies with non-zero balance, use public method by specifying this.options['fetchDepositWithdrawFees']['method'] = 'fetchPublicDepositWithdrawFees'
2421
+ * @see https://www.lbank.com/en-US/docs/index.html#get-all-coins-information
2422
+ * @see https://www.lbank.com/en-US/docs/index.html#withdrawal-configurations
2423
+ * @param {string[]|undefined} codes array of unified currency codes
2424
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2425
+ * @returns {object} a list of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
2426
+ */
2427
+ await this.loadMarkets();
2428
+ const isAuthorized = this.checkRequiredCredentials(false);
2429
+ let method = undefined;
2430
+ if (isAuthorized === true) {
2431
+ method = this.safeString(params, 'method');
2432
+ params = this.omit(params, 'method');
2433
+ if (method === undefined) {
2434
+ const options = this.safeValue(this.options, 'fetchDepositWithdrawFees', {});
2435
+ method = this.safeString(options, 'method', 'fetchPrivateDepositWithdrawFees');
2436
+ }
2437
+ }
2438
+ else {
2439
+ method = 'fetchPublicDepositWithdrawFees';
2440
+ }
2441
+ return await this[method](codes, params);
2442
+ }
2443
+ async fetchPrivateDepositWithdrawFees(codes = undefined, params = {}) {
2444
+ // complete response
2445
+ // incl. for coins which undefined in public method
2446
+ await this.loadMarkets();
2447
+ const response = await this.spotPrivatePostSupplementUserInfo(params);
2448
+ //
2449
+ // {
2450
+ // "result": "true",
2451
+ // "data": [
2452
+ // {
2453
+ // "usableAmt": "14.36",
2454
+ // "assetAmt": "14.36",
2455
+ // "networkList": [
2456
+ // {
2457
+ // "isDefault": false,
2458
+ // "withdrawFeeRate": "",
2459
+ // "name": "erc20",
2460
+ // "withdrawMin": 30,
2461
+ // "minLimit": 0.0001,
2462
+ // "minDeposit": 20,
2463
+ // "feeAssetCode": "usdt",
2464
+ // "withdrawFee": "30",
2465
+ // "type": 1,
2466
+ // "coin": "usdt",
2467
+ // "network": "eth"
2468
+ // },
2469
+ // ...
2470
+ // ],
2471
+ // "freezeAmt": "0",
2472
+ // "coin": "ada"
2473
+ // }
2474
+ // ],
2475
+ // "code": 0
2476
+ // }
2477
+ //
2478
+ const data = this.safeValue(response, 'data', []);
2479
+ return this.parseDepositWithdrawFees(data, codes, 'coin');
2480
+ }
2481
+ async fetchPublicDepositWithdrawFees(codes = undefined, params = {}) {
2482
+ // extremely incomplete response
2483
+ // vast majority fees undefined
2484
+ await this.loadMarkets();
2485
+ const request = {};
2486
+ const response = await this.spotPublicGetWithdrawConfigs(this.extend(request, params));
2487
+ //
2488
+ // {
2489
+ // "result": "true",
2490
+ // "data": [
2491
+ // {
2492
+ // "amountScale": "4",
2493
+ // "chain": "heco",
2494
+ // "assetCode": "lbk",
2495
+ // "min": "200",
2496
+ // "transferAmtScale": "4",
2497
+ // "canWithDraw": true,
2498
+ // "fee": "100",
2499
+ // "minTransfer": "0.0001",
2500
+ // "type": "1"
2501
+ // },
2502
+ // ...
2503
+ // ],
2504
+ // "error_code": "0",
2505
+ // "ts": "1663364435973"
2506
+ // }
2507
+ //
2508
+ const data = this.safeValue(response, 'data', []);
2509
+ return this.parsePublicDepositWithdrawFees(data, codes);
2510
+ }
2511
+ parsePublicDepositWithdrawFees(response, codes = undefined) {
2512
+ //
2513
+ // [
2514
+ // {
2515
+ // "amountScale": "4",
2516
+ // "chain": "heco",
2517
+ // "assetCode": "lbk",
2518
+ // "min": "200",
2519
+ // "transferAmtScale": "4",
2520
+ // "canWithDraw": true,
2521
+ // "fee": "100",
2522
+ // "minTransfer": "0.0001",
2523
+ // "type": "1"
2524
+ // },
2525
+ // ...
2526
+ // ]
2527
+ //
2528
+ const result = {};
2529
+ for (let i = 0; i < response.length; i++) {
2530
+ const fee = response[i];
2531
+ const canWithdraw = this.safeValue(fee, 'canWithDraw');
2532
+ if (canWithdraw === true) {
2533
+ const currencyId = this.safeString(fee, 'assetCode');
2534
+ const code = this.safeCurrencyCode(currencyId);
2535
+ if (codes === undefined || this.inArray(code, codes)) {
2536
+ const withdrawFee = this.safeNumber(fee, 'fee');
2537
+ if (withdrawFee !== undefined) {
2538
+ const resultValue = this.safeValue(result, code);
2539
+ if (resultValue === undefined) {
2540
+ result[code] = this.depositWithdrawFee([fee]);
2541
+ }
2542
+ else {
2543
+ result[code]['info'].push(fee);
2544
+ }
2545
+ const chain = this.safeString(fee, 'chain');
2546
+ const networkCode = this.safeString(this.options['inverse-networks'], chain, chain);
2547
+ if (networkCode !== undefined) {
2548
+ result[code]['networks'][networkCode] = {
2549
+ 'withdraw': {
2550
+ 'fee': withdrawFee,
2551
+ 'percentage': undefined,
2552
+ },
2553
+ 'deposit': {
2554
+ 'fee': undefined,
2555
+ 'percentage': undefined,
2556
+ },
2557
+ };
2558
+ }
2559
+ else {
2560
+ result[code]['withdraw'] = {
2561
+ 'fee': withdrawFee,
2562
+ 'percentage': undefined,
2563
+ };
2564
+ }
2565
+ }
2566
+ }
2567
+ }
2568
+ }
2569
+ return result;
2570
+ }
2571
+ parseDepositWithdrawFee(fee, currency = undefined) {
2572
+ //
2573
+ // * only used for fetchPrivateDepositWithdrawFees
2574
+ //
2575
+ // {
2576
+ // "usableAmt": "14.36",
2577
+ // "assetAmt": "14.36",
2578
+ // "networkList": [
2579
+ // {
2580
+ // "isDefault": false,
2581
+ // "withdrawFeeRate": "",
2582
+ // "name": "erc20",
2583
+ // "withdrawMin": 30,
2584
+ // "minLimit": 0.0001,
2585
+ // "minDeposit": 20,
2586
+ // "feeAssetCode": "usdt",
2587
+ // "withdrawFee": "30",
2588
+ // "type": 1,
2589
+ // "coin": "usdt",
2590
+ // "network": "eth"
2591
+ // },
2592
+ // ...
2593
+ // ],
2594
+ // "freezeAmt": "0",
2595
+ // "coin": "ada"
2596
+ // }
2597
+ //
2598
+ const result = this.depositWithdrawFee(fee);
2599
+ const networkList = this.safeValue(fee, 'networkList', []);
2600
+ for (let j = 0; j < networkList.length; j++) {
2601
+ const networkEntry = networkList[j];
2602
+ const networkId = this.safeString(networkEntry, 'name');
2603
+ const networkCode = this.safeStringUpper(this.options['inverse-networks'], networkId, networkId);
2604
+ const withdrawFee = this.safeNumber(networkEntry, 'withdrawFee');
2605
+ const isDefault = this.safeValue(networkEntry, 'isDefault');
2606
+ if (withdrawFee !== undefined) {
2607
+ if (isDefault) {
2608
+ result['withdraw'] = {
2609
+ 'fee': withdrawFee,
2610
+ 'percentage': undefined,
2611
+ };
2612
+ }
2613
+ result['networks'][networkCode] = {
2614
+ 'withdraw': {
2615
+ 'fee': withdrawFee,
2616
+ 'percentage': undefined,
2617
+ },
2618
+ 'deposit': {
2619
+ 'fee': undefined,
2620
+ 'percentage': undefined,
2621
+ },
2622
+ };
2623
+ }
2624
+ }
2625
+ return result;
2626
+ }
2627
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
2628
+ let query = this.omit(params, this.extractParams(path));
2629
+ let url = this.urls['api']['rest'] + '/' + this.version + '/' + this.implodeParams(path, params);
2630
+ // Every spot endpoint ends with ".do"
2631
+ if (api[0] === 'spot') {
2632
+ url += '.do';
2633
+ }
2634
+ else {
2635
+ url = this.urls['api']['contract'] + '/' + this.implodeParams(path, params);
2636
+ }
2637
+ if (api[1] === 'public') {
2638
+ if (Object.keys(query).length) {
2639
+ url += '?' + this.urlencode(this.keysort(query));
2640
+ }
2641
+ }
2642
+ else {
2643
+ this.checkRequiredCredentials();
2644
+ const timestamp = this.milliseconds().toString();
2645
+ const echostr = this.uuid22() + this.uuid16();
2646
+ query = this.extend({
2647
+ 'api_key': this.apiKey,
2648
+ }, query);
2649
+ let signatureMethod = undefined;
2650
+ if (this.secret.length > 32) {
2651
+ signatureMethod = 'RSA';
2652
+ }
2653
+ else {
2654
+ signatureMethod = 'HmacSHA256';
2655
+ }
2656
+ const auth = this.rawencode(this.keysort(this.extend({
2657
+ 'echostr': echostr,
2658
+ 'signature_method': signatureMethod,
2659
+ 'timestamp': timestamp,
2660
+ }, query)));
2661
+ const encoded = this.encode(auth);
2662
+ const hash = this.hash(encoded, md5.md5);
2663
+ const uppercaseHash = hash.toUpperCase();
2664
+ let sign = undefined;
2665
+ if (signatureMethod === 'RSA') {
2666
+ const cacheSecretAsPem = this.safeValue(this.options, 'cacheSecretAsPem', true);
2667
+ let pem = undefined;
2668
+ if (cacheSecretAsPem) {
2669
+ pem = this.safeValue(this.options, 'pem');
2670
+ if (pem === undefined) {
2671
+ pem = this.convertSecretToPem(this.encode(this.secret));
2672
+ this.options['pem'] = pem;
2673
+ }
2674
+ }
2675
+ else {
2676
+ pem = this.convertSecretToPem(this.encode(this.secret));
2677
+ }
2678
+ sign = rsa.rsa(uppercaseHash, pem, sha256.sha256);
2679
+ }
2680
+ else if (signatureMethod === 'HmacSHA256') {
2681
+ sign = this.hmac(this.encode(uppercaseHash), this.encode(this.secret), sha256.sha256);
2682
+ }
2683
+ query['sign'] = sign;
2684
+ body = this.urlencode(this.keysort(query));
2685
+ headers = {
2686
+ 'Content-Type': 'application/x-www-form-urlencoded',
2687
+ 'timestamp': timestamp,
2688
+ 'signature_method': signatureMethod,
2689
+ 'echostr': echostr,
2690
+ };
2691
+ }
2692
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
2693
+ }
2694
+ convertSecretToPem(secret) {
2695
+ const lineLength = 64;
2696
+ const secretLength = secret.length - 0;
2697
+ let numLines = this.parseToInt(secretLength / lineLength);
2698
+ numLines = this.sum(numLines, 1);
2699
+ let pem = "-----BEGIN PRIVATE KEY-----\n"; // eslint-disable-line
2700
+ for (let i = 0; i < numLines; i++) {
2701
+ const start = i * lineLength;
2702
+ const end = this.sum(start, lineLength);
2703
+ pem += this.secret.slice(start, end) + "\n"; // eslint-disable-line
2704
+ }
2705
+ return pem + '-----END PRIVATE KEY-----';
2706
+ }
2707
+ handleErrors(httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody) {
2708
+ if (response === undefined) {
2709
+ return undefined;
2710
+ }
2711
+ const success = this.safeValue(response, 'result');
2712
+ if (success === 'false' || !success) {
2713
+ const errorCode = this.safeString(response, 'error_code');
2714
+ const message = this.safeString({
2715
+ '10000': 'Internal error',
2716
+ '10001': 'The required parameters can not be empty',
2717
+ '10002': 'Validation failed',
2718
+ '10003': 'Invalid parameter',
2719
+ '10004': 'Request too frequent',
2720
+ '10005': 'Secret key does not exist',
2721
+ '10006': 'User does not exist',
2722
+ '10007': 'Invalid signature',
2723
+ '10008': 'Invalid Trading Pair',
2724
+ '10009': 'Price and/or Amount are required for limit order',
2725
+ '10010': 'Price and/or Amount must be less than minimum requirement',
2726
+ // '10011': 'Market orders can not be missing the amount of the order',
2727
+ // '10012': 'market sell orders can not be missing orders',
2728
+ '10013': 'The amount is too small',
2729
+ '10014': 'Insufficient amount of money in the account',
2730
+ '10015': 'Invalid order type',
2731
+ '10016': 'Insufficient account balance',
2732
+ '10017': 'Server Error',
2733
+ '10018': 'Page size should be between 1 and 50',
2734
+ '10019': 'Cancel NO more than 3 orders in one request',
2735
+ '10020': 'Volume < 0.001',
2736
+ '10021': 'Price < 0.01',
2737
+ '10022': 'Invalid authorization',
2738
+ '10023': 'Market Order is not supported yet',
2739
+ '10024': 'User cannot trade on this pair',
2740
+ '10025': 'Order has been filled',
2741
+ '10026': 'Order has been cancelld',
2742
+ '10027': 'Order is cancelling',
2743
+ '10028': 'Wrong query time',
2744
+ '10029': 'from is not in the query time',
2745
+ '10030': 'from do not match the transaction type of inqury',
2746
+ '10031': 'echostr length must be valid and length must be from 30 to 40',
2747
+ '10033': 'Failed to create order',
2748
+ '10036': 'customID duplicated',
2749
+ '10100': 'Has no privilege to withdraw',
2750
+ '10101': 'Invalid fee rate to withdraw',
2751
+ '10102': 'Too little to withdraw',
2752
+ '10103': 'Exceed daily limitation of withdraw',
2753
+ '10104': 'Cancel was rejected',
2754
+ '10105': 'Request has been cancelled',
2755
+ '10106': 'None trade time',
2756
+ '10107': 'Start price exception',
2757
+ '10108': 'can not create order',
2758
+ '10109': 'wallet address is not mapping',
2759
+ '10110': 'transfer fee is not mapping',
2760
+ '10111': 'mount > 0',
2761
+ '10112': 'fee is too lower',
2762
+ '10113': 'transfer fee is 0',
2763
+ '10600': 'intercepted by replay attacks filter, check timestamp',
2764
+ '10601': 'Interface closed unavailable',
2765
+ '10701': 'invalid asset code',
2766
+ '10702': 'not allowed deposit',
2767
+ }, errorCode, this.json(response));
2768
+ const ErrorClass = this.safeValue({
2769
+ '10001': errors.BadRequest,
2770
+ '10002': errors.AuthenticationError,
2771
+ '10003': errors.BadRequest,
2772
+ '10004': errors.RateLimitExceeded,
2773
+ '10005': errors.AuthenticationError,
2774
+ '10006': errors.AuthenticationError,
2775
+ '10007': errors.AuthenticationError,
2776
+ '10008': errors.BadSymbol,
2777
+ '10009': errors.InvalidOrder,
2778
+ '10010': errors.InvalidOrder,
2779
+ '10013': errors.InvalidOrder,
2780
+ '10014': errors.InsufficientFunds,
2781
+ '10015': errors.InvalidOrder,
2782
+ '10016': errors.InsufficientFunds,
2783
+ '10017': errors.ExchangeError,
2784
+ '10018': errors.BadRequest,
2785
+ '10019': errors.BadRequest,
2786
+ '10020': errors.BadRequest,
2787
+ '10021': errors.InvalidOrder,
2788
+ '10022': errors.PermissionDenied,
2789
+ '10023': errors.InvalidOrder,
2790
+ '10024': errors.PermissionDenied,
2791
+ '10025': errors.InvalidOrder,
2792
+ '10026': errors.InvalidOrder,
2793
+ '10027': errors.InvalidOrder,
2794
+ '10028': errors.BadRequest,
2795
+ '10029': errors.BadRequest,
2796
+ '10030': errors.BadRequest,
2797
+ '10031': errors.InvalidNonce,
2798
+ '10033': errors.ExchangeError,
2799
+ '10036': errors.DuplicateOrderId,
2800
+ '10100': errors.PermissionDenied,
2801
+ '10101': errors.BadRequest,
2802
+ '10102': errors.InsufficientFunds,
2803
+ '10103': errors.ExchangeError,
2804
+ '10104': errors.ExchangeError,
2805
+ '10105': errors.ExchangeError,
2806
+ '10106': errors.BadRequest,
2807
+ '10107': errors.BadRequest,
2808
+ '10108': errors.ExchangeError,
2809
+ '10109': errors.InvalidAddress,
2810
+ '10110': errors.ExchangeError,
2811
+ '10111': errors.BadRequest,
2812
+ '10112': errors.BadRequest,
2813
+ '10113': errors.BadRequest,
2814
+ '10600': errors.BadRequest,
2815
+ '10601': errors.ExchangeError,
2816
+ '10701': errors.BadSymbol,
2817
+ '10702': errors.PermissionDenied, // 'not allowed deposit',
2818
+ }, errorCode, errors.ExchangeError);
2819
+ throw new ErrorClass(message);
2820
+ }
2821
+ return undefined;
2822
+ }
2823
+ }
2824
+
2825
+ module.exports = lbank;