ccxt 4.2.11 → 4.2.13

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 (392) hide show
  1. package/README.md +5 -5
  2. package/build.sh +2 -2
  3. package/dist/ccxt.browser.js +1347 -490
  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 +2209 -0
  125. package/dist/cjs/js/src/binance.js +9736 -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 +3807 -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 +8291 -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 +3424 -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 +7072 -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 +9049 -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 +761 -0
  185. package/dist/cjs/js/src/indodax.js +1069 -0
  186. package/dist/cjs/js/src/kraken.js +2857 -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 +2851 -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 +7330 -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 +4722 -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 +1608 -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 +1867 -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 +2765 -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/bingx.d.ts +2 -0
  336. package/js/src/abstract/bybit.d.ts +1 -0
  337. package/js/src/abstract/gate.d.ts +11 -0
  338. package/js/src/abstract/gateio.d.ts +11 -0
  339. package/js/src/abstract/okx.d.ts +1 -0
  340. package/js/src/alpaca.js +18 -18
  341. package/js/src/base/Exchange.d.ts +5 -1
  342. package/js/src/base/Exchange.js +101 -12
  343. package/js/src/bigone.d.ts +3 -2
  344. package/js/src/bigone.js +429 -167
  345. package/js/src/binance.js +48 -34
  346. package/js/src/bingx.js +115 -38
  347. package/js/src/bitfinex.d.ts +2 -2
  348. package/js/src/bitfinex.js +2 -3
  349. package/js/src/bitget.js +33 -13
  350. package/js/src/bitmart.d.ts +2 -2
  351. package/js/src/bitmart.js +5 -5
  352. package/js/src/bitmex.js +1 -0
  353. package/js/src/bybit.js +2 -0
  354. package/js/src/coinbase.d.ts +26 -3
  355. package/js/src/coinbase.js +176 -26
  356. package/js/src/coinlist.js +3 -4
  357. package/js/src/coinone.js +1 -1
  358. package/js/src/coinsph.js +2 -3
  359. package/js/src/deribit.js +1 -0
  360. package/js/src/gate.d.ts +4 -4
  361. package/js/src/gate.js +96 -59
  362. package/js/src/gemini.js +1 -1
  363. package/js/src/hitbtc.d.ts +4 -4
  364. package/js/src/hitbtc.js +2 -3
  365. package/js/src/htx.d.ts +1 -0
  366. package/js/src/htx.js +29 -7
  367. package/js/src/huobijp.js +2 -3
  368. package/js/src/independentreserve.js +7 -5
  369. package/js/src/kraken.js +3 -6
  370. package/js/src/lbank.js +59 -33
  371. package/js/src/mexc.js +2 -1
  372. package/js/src/oceanex.js +1 -1
  373. package/js/src/okx.js +14 -3
  374. package/js/src/phemex.js +9 -2
  375. package/js/src/pro/binance.d.ts +2 -23
  376. package/js/src/pro/binance.js +58 -22
  377. package/js/src/pro/coinbase.d.ts +2 -2
  378. package/js/src/pro/coinbase.js +4 -1
  379. package/js/src/pro/coinbasepro.d.ts +2 -2
  380. package/js/src/pro/hitbtc.d.ts +2 -2
  381. package/js/src/pro/kraken.js +1 -1
  382. package/js/src/pro/okx.d.ts +1 -0
  383. package/js/src/pro/okx.js +52 -2
  384. package/js/src/pro/poloniex.d.ts +2 -2
  385. package/js/src/probit.js +4 -2
  386. package/js/src/upbit.d.ts +3 -101
  387. package/js/src/upbit.js +12 -12
  388. package/js/src/wavesexchange.js +1 -1
  389. package/js/src/woo.d.ts +2 -0
  390. package/js/src/woo.js +52 -0
  391. package/package.json +1 -1
  392. package/skip-tests.json +5 -0
@@ -2522,7 +2522,7 @@ class alpaca extends _abstract_alpaca_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
2522
2522
  'market': 'https://data.sandbox.{hostname}',
2523
2523
  },
2524
2524
  'doc': 'https://alpaca.markets/docs/',
2525
- 'fees': 'https://alpaca.markets/support/what-are-the-fees-associated-with-crypto-trading/',
2525
+ 'fees': 'https://docs.alpaca.markets/docs/crypto-fees',
2526
2526
  },
2527
2527
  'has': {
2528
2528
  'CORS': false,
@@ -2693,28 +2693,28 @@ class alpaca extends _abstract_alpaca_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
2693
2693
  'trading': {
2694
2694
  'tierBased': true,
2695
2695
  'percentage': true,
2696
- 'maker': this.parseNumber('0.003'),
2697
- 'taker': this.parseNumber('0.003'),
2696
+ 'maker': this.parseNumber('0.0015'),
2697
+ 'taker': this.parseNumber('0.0025'),
2698
2698
  'tiers': {
2699
2699
  'taker': [
2700
- [this.parseNumber('0'), this.parseNumber('0.003')],
2701
- [this.parseNumber('500000'), this.parseNumber('0.0028')],
2702
- [this.parseNumber('1000000'), this.parseNumber('0.0025')],
2703
- [this.parseNumber('5000000'), this.parseNumber('0.002')],
2704
- [this.parseNumber('10000000'), this.parseNumber('0.0018')],
2705
- [this.parseNumber('25000000'), this.parseNumber('0.0015')],
2706
- [this.parseNumber('50000000'), this.parseNumber('0.00125')],
2700
+ [this.parseNumber('0'), this.parseNumber('0.0025')],
2701
+ [this.parseNumber('100000'), this.parseNumber('0.0022')],
2702
+ [this.parseNumber('500000'), this.parseNumber('0.0020')],
2703
+ [this.parseNumber('1000000'), this.parseNumber('0.0018')],
2704
+ [this.parseNumber('10000000'), this.parseNumber('0.0015')],
2705
+ [this.parseNumber('25000000'), this.parseNumber('0.0013')],
2706
+ [this.parseNumber('50000000'), this.parseNumber('0.0012')],
2707
2707
  [this.parseNumber('100000000'), this.parseNumber('0.001')],
2708
2708
  ],
2709
2709
  'maker': [
2710
- [this.parseNumber('0'), this.parseNumber('0.003')],
2711
- [this.parseNumber('500000'), this.parseNumber('0.0028')],
2712
- [this.parseNumber('1000000'), this.parseNumber('0.0025')],
2713
- [this.parseNumber('5000000'), this.parseNumber('0.002')],
2714
- [this.parseNumber('10000000'), this.parseNumber('0.0018')],
2715
- [this.parseNumber('25000000'), this.parseNumber('0.0015')],
2716
- [this.parseNumber('50000000'), this.parseNumber('0.00125')],
2717
- [this.parseNumber('100000000'), this.parseNumber('0.001')],
2710
+ [this.parseNumber('0'), this.parseNumber('0.0015')],
2711
+ [this.parseNumber('100000'), this.parseNumber('0.0012')],
2712
+ [this.parseNumber('500000'), this.parseNumber('0.001')],
2713
+ [this.parseNumber('1000000'), this.parseNumber('0.0008')],
2714
+ [this.parseNumber('10000000'), this.parseNumber('0.0005')],
2715
+ [this.parseNumber('25000000'), this.parseNumber('0.0002')],
2716
+ [this.parseNumber('50000000'), this.parseNumber('0.0002')],
2717
+ [this.parseNumber('100000000'), this.parseNumber('0.00')],
2718
2718
  ],
2719
2719
  },
2720
2720
  },
@@ -7357,6 +7357,8 @@ class Exchange {
7357
7357
  'createStopOrder': undefined,
7358
7358
  'createStopLimitOrder': undefined,
7359
7359
  'createStopMarketOrder': undefined,
7360
+ 'createTrailingAmountOrder': undefined,
7361
+ 'createTrailingPercentOrder': undefined,
7360
7362
  'createOrderWs': undefined,
7361
7363
  'editOrderWs': undefined,
7362
7364
  'fetchOpenOrdersWs': undefined,
@@ -7649,10 +7651,28 @@ class Exchange {
7649
7651
  console.log(...args);
7650
7652
  }
7651
7653
  async loadProxyModules() {
7654
+ if (this.proxyModulesLoaded) {
7655
+ return;
7656
+ }
7652
7657
  this.proxyModulesLoaded = true;
7653
- // todo: possible sync alternatives: https://stackoverflow.com/questions/51069002/convert-import-to-synchronous
7654
- this.httpProxyAgentModule = await import(/* webpackIgnore: true */ '../static_dependencies/proxies/http-proxy-agent/index.js');
7655
- this.httpsProxyAgentModule = await import(/* webpackIgnore: true */ '../static_dependencies/proxies/https-proxy-agent/index.js');
7658
+ // we have to handle it with below nested way, because of dynamic
7659
+ // import issues (https://github.com/ccxt/ccxt/pull/20687)
7660
+ try {
7661
+ // todo: possible sync alternatives: https://stackoverflow.com/questions/51069002/convert-import-to-synchronous
7662
+ this.httpProxyAgentModule = await import(/* webpackIgnore: true */ '../static_dependencies/proxies/http-proxy-agent/index.js');
7663
+ this.httpsProxyAgentModule = await import(/* webpackIgnore: true */ '../static_dependencies/proxies/https-proxy-agent/index.js');
7664
+ }
7665
+ catch (e) {
7666
+ // if several users are using those frameworks which cause exceptions,
7667
+ // let them to be able to load modules still, by installing them
7668
+ try {
7669
+ // @ts-ignore
7670
+ this.httpProxyAgentModule = await import(/* webpackIgnore: true */ 'http-proxy-agent');
7671
+ // @ts-ignore
7672
+ this.httpProxyAgentModule = await import(/* webpackIgnore: true */ 'https-proxy-agent');
7673
+ }
7674
+ catch { }
7675
+ }
7656
7676
  if (this.socksProxyAgentModuleChecked === false) {
7657
7677
  this.socksProxyAgentModuleChecked = true;
7658
7678
  try {
@@ -7744,11 +7764,10 @@ class Exchange {
7744
7764
  // proxy agents
7745
7765
  const [httpProxy, httpsProxy, socksProxy] = this.checkProxySettings(url, method, headers, body);
7746
7766
  this.checkConflictingProxies(httpProxy || httpsProxy || socksProxy, proxyUrl);
7767
+ // skip proxies on the browser
7747
7768
  if (isNode) {
7748
- // skip this on the browser
7749
- if (!this.proxyModulesLoaded) {
7750
- await this.loadProxyModules(); // this is needed in JS, independently whether proxy properties were set or not, we have to load them because of necessity in WS, which would happen beyond 'fetch' method (WS/etc)
7751
- }
7769
+ // this is needed in JS, independently whether proxy properties were set or not, we have to load them because of necessity in WS, which would happen beyond 'fetch' method (WS/etc)
7770
+ await this.loadProxyModules();
7752
7771
  }
7753
7772
  const chosenAgent = this.setProxyAgents(httpProxy, httpsProxy, socksProxy);
7754
7773
  // user-agent
@@ -7770,13 +7789,29 @@ class Exchange {
7770
7789
  // end of proxies & headers
7771
7790
  if (this.fetchImplementation === undefined) {
7772
7791
  if (isNode) {
7773
- const module = await import(/* webpackIgnore: true */ '../static_dependencies/node-fetch/index.js');
7774
7792
  if (this.agent === undefined) {
7775
7793
  this.agent = this.httpsAgent;
7776
7794
  }
7777
- this.AbortError = module.AbortError;
7778
- this.fetchImplementation = module.default;
7779
- this.FetchError = module.FetchError;
7795
+ try {
7796
+ const module = await import(/* webpackIgnore: true */ '../static_dependencies/node-fetch/index.js');
7797
+ this.AbortError = module.AbortError;
7798
+ this.fetchImplementation = module.default;
7799
+ this.FetchError = module.FetchError;
7800
+ }
7801
+ catch (e) {
7802
+ // some users having issues with dynamic imports (https://github.com/ccxt/ccxt/pull/20687)
7803
+ // so let them to fallback to node's native fetch
7804
+ if (typeof fetch === 'function') {
7805
+ this.fetchImplementation = fetch;
7806
+ // as it's browser-compatible implementation ( https://nodejs.org/dist/latest-v20.x/docs/api/globals.html#fetch )
7807
+ // it throws same error types
7808
+ this.AbortError = DOMException;
7809
+ this.FetchError = TypeError;
7810
+ }
7811
+ else {
7812
+ throw new Error('Seems, "fetch" function is not available in your node-js version, please use latest node-js version');
7813
+ }
7814
+ }
7780
7815
  }
7781
7816
  else {
7782
7817
  this.fetchImplementation = self.fetch;
@@ -10731,6 +10766,60 @@ class Exchange {
10731
10766
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
10732
10767
  throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' createOrder() is not supported yet');
10733
10768
  }
10769
+ async createTrailingAmountOrder(symbol, type, side, amount, price = undefined, trailingAmount = undefined, trailingTriggerPrice = undefined, params = {}) {
10770
+ /**
10771
+ * @method
10772
+ * @name createTrailingAmountOrder
10773
+ * @description create a trailing order by providing the symbol, type, side, amount, price and trailingAmount
10774
+ * @param {string} symbol unified symbol of the market to create an order in
10775
+ * @param {string} type 'market' or 'limit'
10776
+ * @param {string} side 'buy' or 'sell'
10777
+ * @param {float} amount how much you want to trade in units of the base currency, or number of contracts
10778
+ * @param {float} [price] the price for the order to be filled at, in units of the quote currency, ignored in market orders
10779
+ * @param {float} trailingAmount the quote amount to trail away from the current market price
10780
+ * @param {float} [trailingTriggerPrice] the price to activate a trailing order, default uses the price argument
10781
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
10782
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
10783
+ */
10784
+ if (trailingAmount === undefined) {
10785
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.ArgumentsRequired(this.id + ' createTrailingAmountOrder() requires a trailingAmount argument');
10786
+ }
10787
+ params['trailingAmount'] = trailingAmount;
10788
+ if (trailingTriggerPrice !== undefined) {
10789
+ params['trailingTriggerPrice'] = trailingTriggerPrice;
10790
+ }
10791
+ if (this.has['createTrailingAmountOrder']) {
10792
+ return await this.createOrder(symbol, type, side, amount, price, params);
10793
+ }
10794
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' createTrailingAmountOrder() is not supported yet');
10795
+ }
10796
+ async createTrailingPercentOrder(symbol, type, side, amount, price = undefined, trailingPercent = undefined, trailingTriggerPrice = undefined, params = {}) {
10797
+ /**
10798
+ * @method
10799
+ * @name createTrailingPercentOrder
10800
+ * @description create a trailing order by providing the symbol, type, side, amount, price and trailingPercent
10801
+ * @param {string} symbol unified symbol of the market to create an order in
10802
+ * @param {string} type 'market' or 'limit'
10803
+ * @param {string} side 'buy' or 'sell'
10804
+ * @param {float} amount how much you want to trade in units of the base currency, or number of contracts
10805
+ * @param {float} [price] the price for the order to be filled at, in units of the quote currency, ignored in market orders
10806
+ * @param {float} trailingPercent the percent to trail away from the current market price
10807
+ * @param {float} [trailingTriggerPrice] the price to activate a trailing order, default uses the price argument
10808
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
10809
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
10810
+ */
10811
+ if (trailingPercent === undefined) {
10812
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.ArgumentsRequired(this.id + ' createTrailingPercentOrder() requires a trailingPercent argument');
10813
+ }
10814
+ params['trailingPercent'] = trailingPercent;
10815
+ if (trailingTriggerPrice !== undefined) {
10816
+ params['trailingTriggerPrice'] = trailingTriggerPrice;
10817
+ }
10818
+ if (this.has['createTrailingPercentOrder']) {
10819
+ return await this.createOrder(symbol, type, side, amount, price, params);
10820
+ }
10821
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' createTrailingPercentOrder() is not supported yet');
10822
+ }
10734
10823
  async createMarketOrderWithCost(symbol, side, cost, params = {}) {
10735
10824
  /**
10736
10825
  * @method
@@ -10891,7 +10980,7 @@ class Exchange {
10891
10980
  throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchFundingHistory() is not supported yet');
10892
10981
  }
10893
10982
  async closePosition(symbol, side = undefined, params = {}) {
10894
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' closePositions() is not supported yet');
10983
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' closePosition() is not supported yet');
10895
10984
  }
10896
10985
  async closeAllPositions(params = {}) {
10897
10986
  throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' closeAllPositions() is not supported yet');
@@ -15264,10 +15353,10 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
15264
15353
  'has': {
15265
15354
  'CORS': undefined,
15266
15355
  'spot': true,
15267
- 'margin': undefined,
15356
+ 'margin': false,
15268
15357
  'swap': undefined,
15269
15358
  'future': undefined,
15270
- 'option': undefined,
15359
+ 'option': false,
15271
15360
  'cancelAllOrders': true,
15272
15361
  'cancelOrder': true,
15273
15362
  'createMarketBuyOrderWithCost': true,
@@ -15321,6 +15410,8 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
15321
15410
  'api': {
15322
15411
  'public': 'https://{hostname}/api/v3',
15323
15412
  'private': 'https://{hostname}/api/v3/viewer',
15413
+ 'contractPublic': 'https://{hostname}/api/contract/v2',
15414
+ 'contractPrivate': 'https://{hostname}/api/contract/v2',
15324
15415
  'webExchange': 'https://{hostname}/api/',
15325
15416
  },
15326
15417
  'www': 'https://big.one',
@@ -15360,6 +15451,38 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
15360
15451
  'transfer',
15361
15452
  ],
15362
15453
  },
15454
+ 'contractPublic': {
15455
+ 'get': [
15456
+ 'instruments',
15457
+ 'depth@{symbol}/snapshot',
15458
+ 'instruments/difference',
15459
+ 'instruments/prices',
15460
+ ],
15461
+ },
15462
+ 'contractPrivate': {
15463
+ 'get': [
15464
+ 'accounts',
15465
+ 'orders/{id}',
15466
+ 'orders',
15467
+ 'orders/opening',
15468
+ 'orders/count',
15469
+ 'orders/opening/count',
15470
+ 'trades',
15471
+ 'trades/count',
15472
+ ],
15473
+ 'post': [
15474
+ 'orders',
15475
+ 'orders/batch',
15476
+ ],
15477
+ 'put': [
15478
+ 'positions/{symbol}/margin',
15479
+ 'positions/{symbol}/risk-limit',
15480
+ ],
15481
+ 'delete': [
15482
+ 'orders/{id}',
15483
+ 'orders/batch',
15484
+ ],
15485
+ },
15363
15486
  'webExchange': {
15364
15487
  'get': [
15365
15488
  'uc/v2/assets',
@@ -15751,93 +15874,214 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
15751
15874
  // ]
15752
15875
  // }
15753
15876
  //
15877
+ const contractResponse = await this.contractPublicGetInstruments(params);
15878
+ //
15879
+ // [
15880
+ // {
15881
+ // "usdtPrice": 1.00031998,
15882
+ // "symbol": "BTCUSD",
15883
+ // "btcPrice": 34700.4,
15884
+ // "ethPrice": 1787.83,
15885
+ // "nextFundingRate": 0.00010,
15886
+ // "fundingRate": 0.00010,
15887
+ // "latestPrice": 34708.5,
15888
+ // "last24hPriceChange": 0.0321,
15889
+ // "indexPrice": 34700.4,
15890
+ // "volume24h": 261319063,
15891
+ // "turnover24h": 8204.129380685496,
15892
+ // "nextFundingTime": 1698285600000,
15893
+ // "markPrice": 34702.4646738,
15894
+ // "last24hMaxPrice": 35127.5,
15895
+ // "volume24hInUsd": 0.0,
15896
+ // "openValue": 32.88054722085945,
15897
+ // "last24hMinPrice": 33552.0,
15898
+ // "openInterest": 1141372.0
15899
+ // }
15900
+ // ...
15901
+ // ]
15902
+ //
15754
15903
  const markets = this.safeValue(response, 'data', []);
15755
- return this.parseMarkets(markets);
15756
- }
15757
- parseMarket(market) {
15758
- const id = this.safeString(market, 'name');
15759
- const baseAsset = this.safeValue(market, 'base_asset', {});
15760
- const quoteAsset = this.safeValue(market, 'quote_asset', {});
15761
- const baseId = this.safeString(baseAsset, 'symbol');
15762
- const quoteId = this.safeString(quoteAsset, 'symbol');
15763
- const base = this.safeCurrencyCode(baseId);
15764
- const quote = this.safeCurrencyCode(quoteId);
15765
- return {
15766
- 'id': id,
15767
- 'symbol': base + '/' + quote,
15768
- 'base': base,
15769
- 'quote': quote,
15770
- 'settle': undefined,
15771
- 'baseId': baseId,
15772
- 'quoteId': quoteId,
15773
- 'settleId': undefined,
15774
- 'type': 'spot',
15775
- 'spot': true,
15776
- 'margin': false,
15777
- 'swap': false,
15778
- 'future': false,
15779
- 'option': false,
15780
- 'active': true,
15781
- 'contract': false,
15782
- 'linear': undefined,
15783
- 'inverse': undefined,
15784
- 'contractSize': undefined,
15785
- 'expiry': undefined,
15786
- 'expiryDatetime': undefined,
15787
- 'strike': undefined,
15788
- 'optionType': undefined,
15789
- 'precision': {
15790
- 'amount': this.parseNumber(this.parsePrecision(this.safeString(market, 'base_scale'))),
15791
- 'price': this.parseNumber(this.parsePrecision(this.safeString(market, 'quote_scale'))),
15792
- },
15793
- 'limits': {
15794
- 'leverage': {
15795
- 'min': undefined,
15796
- 'max': undefined,
15904
+ const result = [];
15905
+ for (let i = 0; i < markets.length; i++) {
15906
+ const market = markets[i];
15907
+ const baseAsset = this.safeValue(market, 'base_asset', {});
15908
+ const quoteAsset = this.safeValue(market, 'quote_asset', {});
15909
+ const baseId = this.safeString(baseAsset, 'symbol');
15910
+ const quoteId = this.safeString(quoteAsset, 'symbol');
15911
+ const base = this.safeCurrencyCode(baseId);
15912
+ const quote = this.safeCurrencyCode(quoteId);
15913
+ result.push(this.safeMarketStructure({
15914
+ 'id': this.safeString(market, 'name'),
15915
+ 'uuid': this.safeString(market, 'id'),
15916
+ 'symbol': base + '/' + quote,
15917
+ 'base': base,
15918
+ 'quote': quote,
15919
+ 'settle': undefined,
15920
+ 'baseId': baseId,
15921
+ 'quoteId': quoteId,
15922
+ 'settleId': undefined,
15923
+ 'type': 'spot',
15924
+ 'spot': true,
15925
+ 'margin': false,
15926
+ 'swap': false,
15927
+ 'future': false,
15928
+ 'option': false,
15929
+ 'active': true,
15930
+ 'contract': false,
15931
+ 'linear': undefined,
15932
+ 'inverse': undefined,
15933
+ 'contractSize': undefined,
15934
+ 'expiry': undefined,
15935
+ 'expiryDatetime': undefined,
15936
+ 'strike': undefined,
15937
+ 'optionType': undefined,
15938
+ 'precision': {
15939
+ 'amount': this.parseNumber(this.parsePrecision(this.safeString(market, 'base_scale'))),
15940
+ 'price': this.parseNumber(this.parsePrecision(this.safeString(market, 'quote_scale'))),
15797
15941
  },
15798
- 'amount': {
15799
- 'min': undefined,
15800
- 'max': undefined,
15942
+ 'limits': {
15943
+ 'leverage': {
15944
+ 'min': undefined,
15945
+ 'max': undefined,
15946
+ },
15947
+ 'amount': {
15948
+ 'min': undefined,
15949
+ 'max': undefined,
15950
+ },
15951
+ 'price': {
15952
+ 'min': undefined,
15953
+ 'max': undefined,
15954
+ },
15955
+ 'cost': {
15956
+ 'min': this.safeNumber(market, 'min_quote_value'),
15957
+ 'max': this.safeNumber(market, 'max_quote_value'),
15958
+ },
15801
15959
  },
15802
- 'price': {
15803
- 'min': undefined,
15804
- 'max': undefined,
15960
+ 'created': undefined,
15961
+ 'info': market,
15962
+ }));
15963
+ }
15964
+ for (let i = 0; i < contractResponse.length; i++) {
15965
+ const market = contractResponse[i];
15966
+ const marketId = this.safeString(market, 'symbol');
15967
+ const index = marketId.indexOf('USD');
15968
+ const baseId = marketId.slice(0, index);
15969
+ const quoteId = marketId.slice(index);
15970
+ const inverse = (quoteId === 'USD');
15971
+ const settleId = inverse ? baseId : quoteId;
15972
+ const base = this.safeCurrencyCode(baseId);
15973
+ const quote = this.safeCurrencyCode(quoteId);
15974
+ const settle = this.safeCurrencyCode(settleId);
15975
+ result.push(this.safeMarketStructure({
15976
+ 'id': marketId,
15977
+ 'symbol': base + '/' + quote + ':' + settle,
15978
+ 'base': base,
15979
+ 'quote': quote,
15980
+ 'settle': settle,
15981
+ 'baseId': baseId,
15982
+ 'quoteId': quoteId,
15983
+ 'settleId': settleId,
15984
+ 'type': 'swap',
15985
+ 'spot': false,
15986
+ 'margin': false,
15987
+ 'swap': true,
15988
+ 'future': false,
15989
+ 'option': false,
15990
+ 'active': true,
15991
+ 'contract': true,
15992
+ 'linear': !inverse,
15993
+ 'inverse': inverse,
15994
+ 'contractSize': 1,
15995
+ 'expiry': undefined,
15996
+ 'expiryDatetime': undefined,
15997
+ 'strike': undefined,
15998
+ 'optionType': undefined,
15999
+ 'precision': {
16000
+ 'amount': undefined,
16001
+ 'price': undefined,
15805
16002
  },
15806
- 'cost': {
15807
- 'min': this.safeNumber(market, 'min_quote_value'),
15808
- 'max': this.safeNumber(market, 'max_quote_value'),
16003
+ 'limits': {
16004
+ 'leverage': {
16005
+ 'min': undefined,
16006
+ 'max': undefined,
16007
+ },
16008
+ 'amount': {
16009
+ 'min': undefined,
16010
+ 'max': undefined,
16011
+ },
16012
+ 'price': {
16013
+ 'min': undefined,
16014
+ 'max': undefined,
16015
+ },
16016
+ 'cost': {
16017
+ 'min': undefined,
16018
+ 'max': undefined,
16019
+ },
15809
16020
  },
15810
- },
15811
- 'created': undefined,
15812
- 'info': market,
15813
- };
16021
+ 'info': market,
16022
+ }));
16023
+ }
16024
+ return result;
15814
16025
  }
15815
16026
  parseTicker(ticker, market = undefined) {
15816
16027
  //
15817
- // {
15818
- // "asset_pair_name":"ETH-BTC",
15819
- // "bid":{"price":"0.021593","order_count":1,"quantity":"0.20936"},
15820
- // "ask":{"price":"0.021613","order_count":1,"quantity":"2.87064"},
15821
- // "open":"0.021795",
15822
- // "high":"0.021795",
15823
- // "low":"0.021471",
15824
- // "close":"0.021613",
15825
- // "volume":"117078.90431",
15826
- // "daily_change":"-0.000182"
15827
- // }
16028
+ // spot
15828
16029
  //
15829
- const marketId = this.safeString(ticker, 'asset_pair_name');
15830
- const symbol = this.safeSymbol(marketId, market, '-');
15831
- const timestamp = undefined;
15832
- const close = this.safeString(ticker, 'close');
16030
+ // {
16031
+ // "asset_pair_name": "ETH-BTC",
16032
+ // "bid": {
16033
+ // "price": "0.021593",
16034
+ // "order_count": 1,
16035
+ // "quantity": "0.20936"
16036
+ // },
16037
+ // "ask": {
16038
+ // "price": "0.021613",
16039
+ // "order_count": 1,
16040
+ // "quantity": "2.87064"
16041
+ // },
16042
+ // "open": "0.021795",
16043
+ // "high": "0.021795",
16044
+ // "low": "0.021471",
16045
+ // "close": "0.021613",
16046
+ // "volume": "117078.90431",
16047
+ // "daily_change": "-0.000182"
16048
+ // }
16049
+ //
16050
+ // contract
16051
+ //
16052
+ // {
16053
+ // "usdtPrice": 1.00031998,
16054
+ // "symbol": "BTCUSD",
16055
+ // "btcPrice": 34700.4,
16056
+ // "ethPrice": 1787.83,
16057
+ // "nextFundingRate": 0.00010,
16058
+ // "fundingRate": 0.00010,
16059
+ // "latestPrice": 34708.5,
16060
+ // "last24hPriceChange": 0.0321,
16061
+ // "indexPrice": 34700.4,
16062
+ // "volume24h": 261319063,
16063
+ // "turnover24h": 8204.129380685496,
16064
+ // "nextFundingTime": 1698285600000,
16065
+ // "markPrice": 34702.4646738,
16066
+ // "last24hMaxPrice": 35127.5,
16067
+ // "volume24hInUsd": 0.0,
16068
+ // "openValue": 32.88054722085945,
16069
+ // "last24hMinPrice": 33552.0,
16070
+ // "openInterest": 1141372.0
16071
+ // }
16072
+ //
16073
+ const marketType = ('asset_pair_name' in ticker) ? 'spot' : 'swap';
16074
+ const marketId = this.safeString2(ticker, 'asset_pair_name', 'symbol');
16075
+ const symbol = this.safeSymbol(marketId, market, '-', marketType);
16076
+ const close = this.safeString2(ticker, 'close', 'latestPrice');
15833
16077
  const bid = this.safeValue(ticker, 'bid', {});
15834
16078
  const ask = this.safeValue(ticker, 'ask', {});
15835
16079
  return this.safeTicker({
15836
16080
  'symbol': symbol,
15837
- 'timestamp': timestamp,
15838
- 'datetime': this.iso8601(timestamp),
15839
- 'high': this.safeString(ticker, 'high'),
15840
- 'low': this.safeString(ticker, 'low'),
16081
+ 'timestamp': undefined,
16082
+ 'datetime': undefined,
16083
+ 'high': this.safeString2(ticker, 'high', 'last24hMaxPrice'),
16084
+ 'low': this.safeString2(ticker, 'low', 'last24hMinPrice'),
15841
16085
  'bid': this.safeString(bid, 'price'),
15842
16086
  'bidVolume': this.safeString(bid, 'quantity'),
15843
16087
  'ask': this.safeString(ask, 'price'),
@@ -15847,11 +16091,11 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
15847
16091
  'close': close,
15848
16092
  'last': close,
15849
16093
  'previousClose': undefined,
15850
- 'change': this.safeString(ticker, 'daily_change'),
16094
+ 'change': this.safeString2(ticker, 'daily_change', 'last24hPriceChange'),
15851
16095
  'percentage': undefined,
15852
16096
  'average': undefined,
15853
- 'baseVolume': this.safeString(ticker, 'volume'),
15854
- 'quoteVolume': undefined,
16097
+ 'baseVolume': this.safeString2(ticker, 'volume', 'volume24h'),
16098
+ 'quoteVolume': this.safeString(ticker, 'volume24hInUsd'),
15855
16099
  'info': ticker,
15856
16100
  }, market);
15857
16101
  }
@@ -15866,83 +16110,123 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
15866
16110
  */
15867
16111
  await this.loadMarkets();
15868
16112
  const market = this.market(symbol);
15869
- const request = {
15870
- 'asset_pair_name': market['id'],
15871
- };
15872
- const response = await this.publicGetAssetPairsAssetPairNameTicker(this.extend(request, params));
15873
- //
15874
- // {
15875
- // "code":0,
15876
- // "data":{
15877
- // "asset_pair_name":"ETH-BTC",
15878
- // "bid":{"price":"0.021593","order_count":1,"quantity":"0.20936"},
15879
- // "ask":{"price":"0.021613","order_count":1,"quantity":"2.87064"},
15880
- // "open":"0.021795",
15881
- // "high":"0.021795",
15882
- // "low":"0.021471",
15883
- // "close":"0.021613",
15884
- // "volume":"117078.90431",
15885
- // "daily_change":"-0.000182"
15886
- // }
15887
- // }
15888
- //
15889
- const ticker = this.safeValue(response, 'data', {});
15890
- return this.parseTicker(ticker, market);
16113
+ let type = undefined;
16114
+ [type, params] = this.handleMarketTypeAndParams('fetchTicker', market, params);
16115
+ if (type === 'spot') {
16116
+ const request = {
16117
+ 'asset_pair_name': market['id'],
16118
+ };
16119
+ const response = await this.publicGetAssetPairsAssetPairNameTicker(this.extend(request, params));
16120
+ //
16121
+ // {
16122
+ // "code":0,
16123
+ // "data":{
16124
+ // "asset_pair_name":"ETH-BTC",
16125
+ // "bid":{"price":"0.021593","order_count":1,"quantity":"0.20936"},
16126
+ // "ask":{"price":"0.021613","order_count":1,"quantity":"2.87064"},
16127
+ // "open":"0.021795",
16128
+ // "high":"0.021795",
16129
+ // "low":"0.021471",
16130
+ // "close":"0.021613",
16131
+ // "volume":"117078.90431",
16132
+ // "daily_change":"-0.000182"
16133
+ // }
16134
+ // }
16135
+ //
16136
+ const ticker = this.safeValue(response, 'data', {});
16137
+ return this.parseTicker(ticker, market);
16138
+ }
16139
+ else {
16140
+ const tickers = await this.fetchTickers([symbol], params);
16141
+ return this.safeValue(tickers, symbol);
16142
+ }
15891
16143
  }
15892
16144
  async fetchTickers(symbols = undefined, params = {}) {
15893
16145
  /**
15894
16146
  * @method
15895
16147
  * @name bigone#fetchTickers
15896
16148
  * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
15897
- * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
16149
+ * @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
15898
16150
  * @param {object} [params] extra parameters specific to the exchange API endpoint
15899
16151
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
15900
16152
  */
15901
16153
  await this.loadMarkets();
16154
+ let market = undefined;
16155
+ const symbol = this.safeString(symbols, 0);
16156
+ if (symbol !== undefined) {
16157
+ market = this.market(symbol);
16158
+ }
16159
+ let type = undefined;
16160
+ [type, params] = this.handleMarketTypeAndParams('fetchTickers', market, params);
16161
+ const isSpot = type === 'spot';
15902
16162
  const request = {};
15903
16163
  symbols = this.marketSymbols(symbols);
15904
- if (symbols !== undefined) {
15905
- const ids = this.marketIds(symbols);
15906
- request['pair_names'] = ids.join(',');
16164
+ let data = undefined;
16165
+ if (isSpot) {
16166
+ if (symbols !== undefined) {
16167
+ const ids = this.marketIds(symbols);
16168
+ request['pair_names'] = ids.join(',');
16169
+ }
16170
+ const response = await this.publicGetAssetPairsTickers(this.extend(request, params));
16171
+ //
16172
+ // {
16173
+ // "code": 0,
16174
+ // "data": [
16175
+ // {
16176
+ // "asset_pair_name": "PCX-BTC",
16177
+ // "bid": {
16178
+ // "price": "0.000234",
16179
+ // "order_count": 1,
16180
+ // "quantity": "0.518"
16181
+ // },
16182
+ // "ask": {
16183
+ // "price": "0.0002348",
16184
+ // "order_count": 1,
16185
+ // "quantity": "2.348"
16186
+ // },
16187
+ // "open": "0.0002343",
16188
+ // "high": "0.0002348",
16189
+ // "low": "0.0002162",
16190
+ // "close": "0.0002348",
16191
+ // "volume": "12887.016",
16192
+ // "daily_change": "0.0000005"
16193
+ // },
16194
+ // ...
16195
+ // ]
16196
+ // }
16197
+ //
16198
+ data = this.safeValue(response, 'data', []);
15907
16199
  }
15908
- const response = await this.publicGetAssetPairsTickers(this.extend(request, params));
15909
- //
15910
- // {
15911
- // "code":0,
15912
- // "data":[
15913
- // {
15914
- // "asset_pair_name":"PCX-BTC",
15915
- // "bid":{"price":"0.000234","order_count":1,"quantity":"0.518"},
15916
- // "ask":{"price":"0.0002348","order_count":1,"quantity":"2.348"},
15917
- // "open":"0.0002343",
15918
- // "high":"0.0002348",
15919
- // "low":"0.0002162",
15920
- // "close":"0.0002348",
15921
- // "volume":"12887.016",
15922
- // "daily_change":"0.0000005"
15923
- // },
15924
- // {
15925
- // "asset_pair_name":"GXC-USDT",
15926
- // "bid":{"price":"0.5054","order_count":1,"quantity":"40.53"},
15927
- // "ask":{"price":"0.5055","order_count":1,"quantity":"38.53"},
15928
- // "open":"0.5262",
15929
- // "high":"0.5323",
15930
- // "low":"0.5055",
15931
- // "close":"0.5055",
15932
- // "volume":"603963.05",
15933
- // "daily_change":"-0.0207"
15934
- // }
15935
- // ]
15936
- // }
15937
- //
15938
- const tickers = this.safeValue(response, 'data', []);
15939
- const result = {};
15940
- for (let i = 0; i < tickers.length; i++) {
15941
- const ticker = this.parseTicker(tickers[i]);
15942
- const symbol = ticker['symbol'];
15943
- result[symbol] = ticker;
16200
+ else {
16201
+ data = await this.contractPublicGetInstruments(params);
16202
+ //
16203
+ // [
16204
+ // {
16205
+ // "usdtPrice": 1.00031998,
16206
+ // "symbol": "BTCUSD",
16207
+ // "btcPrice": 34700.4,
16208
+ // "ethPrice": 1787.83,
16209
+ // "nextFundingRate": 0.00010,
16210
+ // "fundingRate": 0.00010,
16211
+ // "latestPrice": 34708.5,
16212
+ // "last24hPriceChange": 0.0321,
16213
+ // "indexPrice": 34700.4,
16214
+ // "volume24h": 261319063,
16215
+ // "turnover24h": 8204.129380685496,
16216
+ // "nextFundingTime": 1698285600000,
16217
+ // "markPrice": 34702.4646738,
16218
+ // "last24hMaxPrice": 35127.5,
16219
+ // "volume24hInUsd": 0.0,
16220
+ // "openValue": 32.88054722085945,
16221
+ // "last24hMinPrice": 33552.0,
16222
+ // "openInterest": 1141372.0
16223
+ // }
16224
+ // ...
16225
+ // ]
16226
+ //
15944
16227
  }
15945
- return this.filterByArrayTickers(result, 'symbol', symbols);
16228
+ const tickers = this.parseTickers(data, symbols);
16229
+ return this.filterByArrayTickers(tickers, 'symbol', symbols);
15946
16230
  }
15947
16231
  async fetchTime(params = {}) {
15948
16232
  /**
@@ -15976,29 +16260,90 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
15976
16260
  */
15977
16261
  await this.loadMarkets();
15978
16262
  const market = this.market(symbol);
15979
- const request = {
15980
- 'asset_pair_name': market['id'],
15981
- };
15982
- if (limit !== undefined) {
15983
- request['limit'] = limit; // default 50, max 200
16263
+ let response = undefined;
16264
+ if (market['contract']) {
16265
+ const request = {
16266
+ 'symbol': market['id'],
16267
+ };
16268
+ response = await this.contractPublicGetDepthSymbolSnapshot(this.extend(request, params));
16269
+ //
16270
+ // {
16271
+ // bids: {
16272
+ // '20000': '20',
16273
+ // ...
16274
+ // '34552': '64851',
16275
+ // '34526.5': '59594',
16276
+ // ...
16277
+ // '34551.5': '29711'
16278
+ // },
16279
+ // asks: {
16280
+ // '34557': '34395',
16281
+ // ...
16282
+ // '40000': '20',
16283
+ // '34611.5': '56024',
16284
+ // ...
16285
+ // '34578.5': '66367'
16286
+ // },
16287
+ // to: '59737174',
16288
+ // lastPrice: '34554.5',
16289
+ // bestPrices: {
16290
+ // ask: '34557.0',
16291
+ // bid: '34552.0'
16292
+ // },
16293
+ // from: '0'
16294
+ // }
16295
+ //
16296
+ return this.parseContractOrderBook(response, market['symbol'], limit);
16297
+ }
16298
+ else {
16299
+ const request = {
16300
+ 'asset_pair_name': market['id'],
16301
+ };
16302
+ if (limit !== undefined) {
16303
+ request['limit'] = limit; // default 50, max 200
16304
+ }
16305
+ response = await this.publicGetAssetPairsAssetPairNameDepth(this.extend(request, params));
16306
+ //
16307
+ // {
16308
+ // "code":0,
16309
+ // "data": {
16310
+ // "asset_pair_name": "EOS-BTC",
16311
+ // "bids": [
16312
+ // { "price": "42", "order_count": 4, "quantity": "23.33363711" }
16313
+ // ],
16314
+ // "asks": [
16315
+ // { "price": "45", "order_count": 2, "quantity": "4193.3283464" }
16316
+ // ]
16317
+ // }
16318
+ // }
16319
+ //
16320
+ const orderbook = this.safeValue(response, 'data', {});
16321
+ return this.parseOrderBook(orderbook, market['symbol'], undefined, 'bids', 'asks', 'price', 'quantity');
15984
16322
  }
15985
- const response = await this.publicGetAssetPairsAssetPairNameDepth(this.extend(request, params));
15986
- //
15987
- // {
15988
- // "code":0,
15989
- // "data": {
15990
- // "asset_pair_name": "EOS-BTC",
15991
- // "bids": [
15992
- // { "price": "42", "order_count": 4, "quantity": "23.33363711" }
15993
- // ],
15994
- // "asks": [
15995
- // { "price": "45", "order_count": 2, "quantity": "4193.3283464" }
15996
- // ]
15997
- // }
15998
- // }
15999
- //
16000
- const orderbook = this.safeValue(response, 'data', {});
16001
- return this.parseOrderBook(orderbook, market['symbol'], undefined, 'bids', 'asks', 'price', 'quantity');
16323
+ }
16324
+ parseContractBidsAsks(bidsAsks) {
16325
+ const bidsAsksKeys = Object.keys(bidsAsks);
16326
+ const result = [];
16327
+ for (let i = 0; i < bidsAsksKeys.length; i++) {
16328
+ const price = bidsAsksKeys[i];
16329
+ const amount = bidsAsks[price];
16330
+ result.push([this.parseNumber(price), this.parseNumber(amount)]);
16331
+ }
16332
+ return result;
16333
+ }
16334
+ parseContractOrderBook(orderbook, symbol, limit = undefined) {
16335
+ const responseBids = this.safeValue(orderbook, 'bids');
16336
+ const responseAsks = this.safeValue(orderbook, 'asks');
16337
+ const bids = this.parseContractBidsAsks(responseBids);
16338
+ const asks = this.parseContractBidsAsks(responseAsks);
16339
+ return {
16340
+ 'symbol': symbol,
16341
+ 'bids': this.filterByLimit(this.sortBy(bids, 0, true), limit),
16342
+ 'asks': this.filterByLimit(this.sortBy(asks, 0), limit),
16343
+ 'timestamp': undefined,
16344
+ 'datetime': undefined,
16345
+ 'nonce': undefined,
16346
+ };
16002
16347
  }
16003
16348
  parseTrade(trade, market = undefined) {
16004
16349
  //
@@ -16158,6 +16503,9 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
16158
16503
  */
16159
16504
  await this.loadMarkets();
16160
16505
  const market = this.market(symbol);
16506
+ if (market['contract']) {
16507
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' fetchTrades () can only fetch trades for spot markets');
16508
+ }
16161
16509
  const request = {
16162
16510
  'asset_pair_name': market['id'],
16163
16511
  };
@@ -16220,6 +16568,9 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
16220
16568
  */
16221
16569
  await this.loadMarkets();
16222
16570
  const market = this.market(symbol);
16571
+ if (market['contract']) {
16572
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' fetchOHLCV () can only fetch ohlcvs for spot markets');
16573
+ }
16223
16574
  if (limit === undefined) {
16224
16575
  limit = 100; // default 100, max 500
16225
16576
  }
@@ -16756,7 +17107,7 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
16756
17107
  const baseUrl = this.implodeHostname(this.urls['api'][api]);
16757
17108
  let url = baseUrl + '/' + this.implodeParams(path, params);
16758
17109
  headers = {};
16759
- if (api === 'public' || api === 'webExchange') {
17110
+ if (api === 'public' || api === 'webExchange' || api === 'contractPublic') {
16760
17111
  if (Object.keys(query).length) {
16761
17112
  url += '?' + this.urlencode(query);
16762
17113
  }
@@ -16779,7 +17130,7 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
16779
17130
  }
16780
17131
  else if (method === 'POST') {
16781
17132
  headers['Content-Type'] = 'application/json';
16782
- body = this.json(query);
17133
+ body = query;
16783
17134
  }
16784
17135
  }
16785
17136
  headers['User-Agent'] = 'ccxt/' + this.id + '-' + this.version;
@@ -17173,7 +17524,7 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
17173
17524
  //
17174
17525
  const code = this.safeString(response, 'code');
17175
17526
  const message = this.safeString(response, 'message');
17176
- if (code !== '0') {
17527
+ if ((code !== '0') && (code !== undefined)) {
17177
17528
  const feedback = this.id + ' ' + body;
17178
17529
  this.throwExactlyMatchedException(this.exceptions['exact'], message, feedback);
17179
17530
  this.throwExactlyMatchedException(this.exceptions['exact'], code, feedback);
@@ -17251,6 +17602,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
17251
17602
  'createStopLimitOrder': true,
17252
17603
  'createStopMarketOrder': false,
17253
17604
  'createStopOrder': true,
17605
+ 'createTrailingPercentOrder': true,
17254
17606
  'editOrder': true,
17255
17607
  'fetchAccounts': undefined,
17256
17608
  'fetchBalance': true,
@@ -17426,6 +17778,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
17426
17778
  'asset/convert-transfer/queryByPage': 0.033335,
17427
17779
  'asset/wallet/balance': 6,
17428
17780
  'asset/custody/transfer-history': 6,
17781
+ 'margin/borrow-repay': 1,
17429
17782
  'margin/loan': 1,
17430
17783
  'margin/repay': 1,
17431
17784
  'margin/account': 1,
@@ -17677,6 +18030,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
17677
18030
  'capital/withdraw/apply': 4.0002,
17678
18031
  'capital/contract/convertible-coins': 4.0002,
17679
18032
  'capital/deposit/credit-apply': 0.1,
18033
+ 'margin/borrow-repay': 20.001,
17680
18034
  'margin/transfer': 4.0002,
17681
18035
  'margin/loan': 20.001,
17682
18036
  'margin/repay': 20.001,
@@ -23302,12 +23656,13 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
23302
23656
  * @name binance#transfer
23303
23657
  * @description transfer currency internally between wallets on the same account
23304
23658
  * @see https://binance-docs.github.io/apidocs/spot/en/#user-universal-transfer-user_data
23305
- * @see https://binance-docs.github.io/apidocs/spot/en/#isolated-margin-account-transfer-margin
23306
23659
  * @param {string} code unified currency code
23307
23660
  * @param {float} amount amount to transfer
23308
23661
  * @param {string} fromAccount account to transfer from
23309
23662
  * @param {string} toAccount account to transfer to
23310
23663
  * @param {object} [params] extra parameters specific to the exchange API endpoint
23664
+ * @param {string} [params.type] exchange specific transfer type
23665
+ * @param {string} [params.symbol] the unified symbol, required for isolated margin transfers
23311
23666
  * @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
23312
23667
  */
23313
23668
  await this.loadMarkets();
@@ -23318,76 +23673,82 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
23318
23673
  };
23319
23674
  request['type'] = this.safeString(params, 'type');
23320
23675
  params = this.omit(params, 'type');
23321
- let response = undefined;
23322
23676
  if (request['type'] === undefined) {
23323
23677
  const symbol = this.safeString(params, 'symbol');
23678
+ let market = undefined;
23324
23679
  if (symbol !== undefined) {
23680
+ market = this.market(symbol);
23325
23681
  params = this.omit(params, 'symbol');
23326
23682
  }
23327
23683
  let fromId = this.convertTypeToAccount(fromAccount).toUpperCase();
23328
23684
  let toId = this.convertTypeToAccount(toAccount).toUpperCase();
23685
+ let isolatedSymbol = undefined;
23686
+ if (market !== undefined) {
23687
+ isolatedSymbol = market['id'];
23688
+ }
23329
23689
  if (fromId === 'ISOLATED') {
23330
23690
  if (symbol === undefined) {
23331
23691
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' transfer () requires params["symbol"] when fromAccount is ' + fromAccount);
23332
23692
  }
23333
- else {
23334
- fromId = this.marketId(symbol);
23335
- }
23336
23693
  }
23337
23694
  if (toId === 'ISOLATED') {
23338
23695
  if (symbol === undefined) {
23339
23696
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' transfer () requires params["symbol"] when toAccount is ' + toAccount);
23340
23697
  }
23341
- else {
23342
- toId = this.marketId(symbol);
23343
- }
23344
23698
  }
23345
23699
  const accountsById = this.safeValue(this.options, 'accountsById', {});
23346
23700
  const fromIsolated = !(fromId in accountsById);
23347
23701
  const toIsolated = !(toId in accountsById);
23702
+ if (fromIsolated && (market === undefined)) {
23703
+ isolatedSymbol = fromId; // allow user provide symbol as the from/to account
23704
+ }
23705
+ if (toIsolated && (market === undefined)) {
23706
+ isolatedSymbol = toId;
23707
+ }
23348
23708
  if (fromIsolated || toIsolated) { // Isolated margin transfer
23349
23709
  const fromFuture = fromId === 'UMFUTURE' || fromId === 'CMFUTURE';
23350
23710
  const toFuture = toId === 'UMFUTURE' || toId === 'CMFUTURE';
23351
23711
  const fromSpot = fromId === 'MAIN';
23352
23712
  const toSpot = toId === 'MAIN';
23353
23713
  const funding = fromId === 'FUNDING' || toId === 'FUNDING';
23354
- const mining = fromId === 'MINING' || toId === 'MINING';
23355
23714
  const option = fromId === 'OPTION' || toId === 'OPTION';
23356
- const prohibitedWithIsolated = fromFuture || toFuture || mining || funding || option;
23715
+ const prohibitedWithIsolated = fromFuture || toFuture || funding || option;
23357
23716
  if ((fromIsolated || toIsolated) && prohibitedWithIsolated) {
23358
23717
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' transfer () does not allow transfers between ' + fromAccount + ' and ' + toAccount);
23359
23718
  }
23360
23719
  else if (toSpot && fromIsolated) {
23361
- request['transFrom'] = 'ISOLATED_MARGIN';
23362
- request['transTo'] = 'SPOT';
23363
- request['symbol'] = fromId;
23364
- response = await this.sapiPostMarginIsolatedTransfer(this.extend(request, params));
23720
+ fromId = 'ISOLATED_MARGIN';
23721
+ request['fromSymbol'] = isolatedSymbol;
23365
23722
  }
23366
23723
  else if (fromSpot && toIsolated) {
23367
- request['transFrom'] = 'SPOT';
23368
- request['transTo'] = 'ISOLATED_MARGIN';
23369
- request['symbol'] = toId;
23370
- response = await this.sapiPostMarginIsolatedTransfer(this.extend(request, params));
23724
+ toId = 'ISOLATED_MARGIN';
23725
+ request['toSymbol'] = isolatedSymbol;
23371
23726
  }
23372
23727
  else {
23373
- if (fromIsolated) {
23728
+ if (fromIsolated && toIsolated) {
23374
23729
  request['fromSymbol'] = fromId;
23375
- fromId = 'ISOLATEDMARGIN';
23376
- }
23377
- if (toIsolated) {
23378
23730
  request['toSymbol'] = toId;
23731
+ fromId = 'ISOLATEDMARGIN';
23379
23732
  toId = 'ISOLATEDMARGIN';
23380
23733
  }
23381
- request['type'] = fromId + '_' + toId;
23734
+ else {
23735
+ if (fromIsolated) {
23736
+ request['fromSymbol'] = isolatedSymbol;
23737
+ fromId = 'ISOLATEDMARGIN';
23738
+ }
23739
+ if (toIsolated) {
23740
+ request['toSymbol'] = isolatedSymbol;
23741
+ toId = 'ISOLATEDMARGIN';
23742
+ }
23743
+ }
23382
23744
  }
23745
+ request['type'] = fromId + '_' + toId;
23383
23746
  }
23384
23747
  else {
23385
23748
  request['type'] = fromId + '_' + toId;
23386
23749
  }
23387
23750
  }
23388
- if (response === undefined) {
23389
- response = await this.sapiPostAssetTransfer(this.extend(request, params));
23390
- }
23751
+ const response = await this.sapiPostAssetTransfer(this.extend(request, params));
23391
23752
  //
23392
23753
  // {
23393
23754
  // "tranId":13526853623
@@ -26325,7 +26686,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
26325
26686
  * @method
26326
26687
  * @name binance#repayCrossMargin
26327
26688
  * @description repay borrowed margin and interest
26328
- * @see https://binance-docs.github.io/apidocs/spot/en/#margin-account-repay-margin
26689
+ * @see https://binance-docs.github.io/apidocs/spot/en/#margin-account-borrow-repay-margin
26329
26690
  * @param {string} code unified currency code of the currency to repay
26330
26691
  * @param {float} amount the amount to repay
26331
26692
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -26337,8 +26698,9 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
26337
26698
  'asset': currency['id'],
26338
26699
  'amount': this.currencyToPrecision(code, amount),
26339
26700
  'isIsolated': 'FALSE',
26701
+ 'type': 'REPAY',
26340
26702
  };
26341
- const response = await this.sapiPostMarginRepay(this.extend(request, params));
26703
+ const response = await this.sapiPostMarginBorrowRepay(this.extend(request, params));
26342
26704
  //
26343
26705
  // {
26344
26706
  // "tranId": 108988250265,
@@ -26352,7 +26714,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
26352
26714
  * @method
26353
26715
  * @name binance#repayIsolatedMargin
26354
26716
  * @description repay borrowed margin and interest
26355
- * @see https://binance-docs.github.io/apidocs/spot/en/#margin-account-repay-margin
26717
+ * @see https://binance-docs.github.io/apidocs/spot/en/#margin-account-borrow-repay-margin
26356
26718
  * @param {string} symbol unified market symbol, required for isolated margin
26357
26719
  * @param {string} code unified currency code of the currency to repay
26358
26720
  * @param {float} amount the amount to repay
@@ -26367,8 +26729,9 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
26367
26729
  'amount': this.currencyToPrecision(code, amount),
26368
26730
  'symbol': market['id'],
26369
26731
  'isIsolated': 'TRUE',
26732
+ 'type': 'REPAY',
26370
26733
  };
26371
- const response = await this.sapiPostMarginRepay(this.extend(request, params));
26734
+ const response = await this.sapiPostMarginBorrowRepay(this.extend(request, params));
26372
26735
  //
26373
26736
  // {
26374
26737
  // "tranId": 108988250265,
@@ -26382,7 +26745,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
26382
26745
  * @method
26383
26746
  * @name binance#borrowCrossMargin
26384
26747
  * @description create a loan to borrow margin
26385
- * @see https://binance-docs.github.io/apidocs/spot/en/#margin-account-borrow-margin
26748
+ * @see https://binance-docs.github.io/apidocs/spot/en/#margin-account-borrow-repay-margin
26386
26749
  * @param {string} code unified currency code of the currency to borrow
26387
26750
  * @param {float} amount the amount to borrow
26388
26751
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -26394,8 +26757,9 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
26394
26757
  'asset': currency['id'],
26395
26758
  'amount': this.currencyToPrecision(code, amount),
26396
26759
  'isIsolated': 'FALSE',
26760
+ 'type': 'BORROW',
26397
26761
  };
26398
- const response = await this.sapiPostMarginLoan(this.extend(request, params));
26762
+ const response = await this.sapiPostMarginBorrowRepay(this.extend(request, params));
26399
26763
  //
26400
26764
  // {
26401
26765
  // "tranId": 108988250265,
@@ -26409,7 +26773,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
26409
26773
  * @method
26410
26774
  * @name binance#borrowIsolatedMargin
26411
26775
  * @description create a loan to borrow margin
26412
- * @see https://binance-docs.github.io/apidocs/spot/en/#margin-account-borrow-margin
26776
+ * @see https://binance-docs.github.io/apidocs/spot/en/#margin-account-borrow-repay-margin
26413
26777
  * @param {string} symbol unified market symbol, required for isolated margin
26414
26778
  * @param {string} code unified currency code of the currency to borrow
26415
26779
  * @param {float} amount the amount to borrow
@@ -26424,8 +26788,9 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
26424
26788
  'amount': this.currencyToPrecision(code, amount),
26425
26789
  'symbol': market['id'],
26426
26790
  'isIsolated': 'TRUE',
26791
+ 'type': 'BORROW',
26427
26792
  };
26428
- const response = await this.sapiPostMarginLoan(this.extend(request, params));
26793
+ const response = await this.sapiPostMarginBorrowRepay(this.extend(request, params));
26429
26794
  //
26430
26795
  // {
26431
26796
  // "tranId": 108988250265,
@@ -27174,6 +27539,8 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
27174
27539
  'createMarketSellOrderWithCost': true,
27175
27540
  'createOrder': true,
27176
27541
  'createOrders': true,
27542
+ 'createTrailingAmountOrder': true,
27543
+ 'createTrailingPercentOrder': true,
27177
27544
  'fetchBalance': true,
27178
27545
  'fetchClosedOrders': true,
27179
27546
  'fetchCurrencies': true,
@@ -27255,6 +27622,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
27255
27622
  'trade/query': 3,
27256
27623
  'trade/openOrders': 3,
27257
27624
  'trade/historyOrders': 3,
27625
+ 'trade/myTrades': 3,
27258
27626
  'user/commissionRate': 3,
27259
27627
  'account/balance': 3,
27260
27628
  },
@@ -27314,6 +27682,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
27314
27682
  'user/positions': 3,
27315
27683
  'user/income': 3,
27316
27684
  'trade/openOrders': 3,
27685
+ 'trade/openOrder': 3,
27317
27686
  'trade/order': 3,
27318
27687
  'trade/marginType': 3,
27319
27688
  'trade/leverage': 3,
@@ -27981,6 +28350,22 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
27981
28350
  // "buyerMaker": false
27982
28351
  // }
27983
28352
  //
28353
+ // spot
28354
+ // fetchMyTrades
28355
+ // {
28356
+ // "symbol": "LTC-USDT",
28357
+ // "id": 36237072,
28358
+ // "orderId": 1674069326895775744,
28359
+ // "price": "85.891",
28360
+ // "qty": "0.0582",
28361
+ // "quoteQty": "4.9988562000000005",
28362
+ // "commission": -0.00005820000000000001,
28363
+ // "commissionAsset": "LTC",
28364
+ // "time": 1687964205000,
28365
+ // "isBuyer": true,
28366
+ // "isMaker": false
28367
+ // }
28368
+ //
27984
28369
  // swap
27985
28370
  // fetchTrades
27986
28371
  //
@@ -28043,7 +28428,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
28043
28428
  }
28044
28429
  const cost = this.safeString(trade, 'quoteQty');
28045
28430
  const type = (cost === undefined) ? 'spot' : 'swap';
28046
- const currencyId = this.safeString2(trade, 'currency', 'N');
28431
+ const currencyId = this.safeStringN(trade, ['currency', 'N', 'commissionAsset']);
28047
28432
  const currencyCode = this.safeCurrencyCode(currencyId);
28048
28433
  const m = this.safeValue(trade, 'm');
28049
28434
  const marketId = this.safeString(trade, 's');
@@ -28059,6 +28444,14 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
28059
28444
  takeOrMaker = 'taker';
28060
28445
  }
28061
28446
  }
28447
+ const isBuyer = this.safeValue(trade, 'isBuyer');
28448
+ if (isBuyer !== undefined) {
28449
+ side = isBuyer ? 'buy' : 'sell';
28450
+ }
28451
+ const isMaker = this.safeValue(trade, 'isMaker');
28452
+ if (isMaker !== undefined) {
28453
+ takeOrMaker = isMaker ? 'maker' : 'taker';
28454
+ }
28062
28455
  return this.safeTrade({
28063
28456
  'id': this.safeStringN(trade, ['id', 't']),
28064
28457
  'info': trade,
@@ -29555,6 +29948,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
29555
29948
  'symbol': market['id'],
29556
29949
  };
29557
29950
  const clientOrderIds = this.safeValue(params, 'clientOrderIds');
29951
+ params = this.omit(params, 'clientOrderIds');
29558
29952
  let idsToParse = ids;
29559
29953
  const areClientOrderIds = (clientOrderIds !== undefined);
29560
29954
  if (areClientOrderIds) {
@@ -29573,8 +29967,12 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
29573
29967
  response = await this.spotV1PrivatePostTradeCancelOrders(this.extend(request, params));
29574
29968
  }
29575
29969
  else {
29576
- const swapReqKey = areClientOrderIds ? 'ClientOrderIDList' : 'orderIdList';
29577
- request[swapReqKey] = parsedIds;
29970
+ if (areClientOrderIds) {
29971
+ request['clientOrderIDList'] = this.json(parsedIds);
29972
+ }
29973
+ else {
29974
+ request['orderIdList'] = parsedIds;
29975
+ }
29578
29976
  response = await this.swapV2PrivateDeleteTradeBatchOrders(this.extend(request, params));
29579
29977
  }
29580
29978
  //
@@ -30388,57 +30786,101 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
30388
30786
  * @method
30389
30787
  * @name bingx#fetchMyTrades
30390
30788
  * @description fetch all trades made by the user
30789
+ * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Order%20History
30391
30790
  * @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Query%20historical%20transaction%20orders
30392
30791
  * @param {string} [symbol] unified market symbol
30393
30792
  * @param {int} [since] the earliest time in ms to fetch trades for
30394
30793
  * @param {int} [limit] the maximum number of trades structures to retrieve
30395
30794
  * @param {object} [params] extra parameters specific to the exchange API endpoint
30795
+ * @param {int} [params.until] timestamp in ms for the ending date filter, default is undefined
30396
30796
  * @param {string} params.trandingUnit COIN (directly represent assets such as BTC and ETH) or CONT (represents the number of contract sheets)
30397
30797
  * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
30398
30798
  */
30399
30799
  if (symbol === undefined) {
30400
30800
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument');
30401
30801
  }
30402
- if (since === undefined) {
30403
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchMyTrades() requires a since argument');
30404
- }
30405
- const tradingUnit = this.safeStringUpper(params, 'tradingUnit', 'CONT');
30406
30802
  await this.loadMarkets();
30407
30803
  const market = this.market(symbol);
30408
- if (market['spot']) {
30409
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadSymbol(this.id + ' fetchMyTrades() supports swap contracts only');
30410
- }
30804
+ const now = this.milliseconds();
30805
+ let response = undefined;
30411
30806
  const request = {
30412
30807
  'symbol': market['id'],
30413
- 'tradingUnit': tradingUnit,
30414
- 'startTs': since,
30415
- 'endTs': this.nonce(),
30416
30808
  };
30417
- const query = this.omit(params, 'tradingUnit');
30418
- const response = await this.swapV2PrivateGetTradeAllFillOrders(this.extend(request, query));
30419
- //
30420
- // {
30421
- // "code": "0",
30422
- // "msg": '',
30423
- // "data": { fill_orders: [
30424
- // {
30425
- // "volume": "0.1",
30426
- // "price": "106.75",
30427
- // "amount": "10.6750",
30428
- // "commission": "-0.0053",
30429
- // "currency": "USDT",
30430
- // "orderId": "1676213270274379776",
30431
- // "liquidatedPrice": "0.00",
30432
- // "liquidatedMarginRatio": "0.00",
30433
- // "filledTime": "2023-07-04T20:56:01.000+0800"
30434
- // }
30435
- // ]
30436
- // }
30437
- // }
30438
- //
30439
- const data = this.safeValue(response, 'data', []);
30440
- const fillOrders = this.safeValue(data, 'fill_orders', []);
30441
- return this.parseTrades(fillOrders, market, since, limit, query);
30809
+ if (since !== undefined) {
30810
+ const startTimeReq = market['spot'] ? 'startTime' : 'startTs';
30811
+ request[startTimeReq] = since;
30812
+ }
30813
+ else if (market['swap']) {
30814
+ request['startTs'] = now - 7776000000; // 90 days
30815
+ }
30816
+ const until = this.safeInteger(params, 'until');
30817
+ params = this.omit(params, 'until');
30818
+ if (until !== undefined) {
30819
+ const endTimeReq = market['spot'] ? 'endTime' : 'endTs';
30820
+ request[endTimeReq] = until;
30821
+ }
30822
+ else if (market['swap']) {
30823
+ request['endTs'] = now;
30824
+ }
30825
+ let fills = undefined;
30826
+ if (market['spot']) {
30827
+ response = await this.spotV1PrivateGetTradeMyTrades(this.extend(request, params));
30828
+ const data = this.safeValue(response, 'data', []);
30829
+ fills = this.safeValue(data, 'fills', []);
30830
+ //
30831
+ // {
30832
+ // "code": 0,
30833
+ // "msg": "",
30834
+ // "debugMsg": "",
30835
+ // "data": {
30836
+ // "fills": [
30837
+ // {
30838
+ // "symbol": "LTC-USDT",
30839
+ // "id": 36237072,
30840
+ // "orderId": 1674069326895775744,
30841
+ // "price": "85.891",
30842
+ // "qty": "0.0582",
30843
+ // "quoteQty": "4.9988562000000005",
30844
+ // "commission": -0.00005820000000000001,
30845
+ // "commissionAsset": "LTC",
30846
+ // "time": 1687964205000,
30847
+ // "isBuyer": true,
30848
+ // "isMaker": false
30849
+ // }
30850
+ // ]
30851
+ // }
30852
+ // }
30853
+ //
30854
+ }
30855
+ else {
30856
+ const tradingUnit = this.safeStringUpper(params, 'tradingUnit', 'CONT');
30857
+ params = this.omit(params, 'tradingUnit');
30858
+ request['tradingUnit'] = tradingUnit;
30859
+ response = await this.swapV2PrivateGetTradeAllFillOrders(this.extend(request, params));
30860
+ const data = this.safeValue(response, 'data', []);
30861
+ fills = this.safeValue(data, 'fill_orders', []);
30862
+ //
30863
+ // {
30864
+ // "code": "0",
30865
+ // "msg": '',
30866
+ // "data": { fill_orders: [
30867
+ // {
30868
+ // "volume": "0.1",
30869
+ // "price": "106.75",
30870
+ // "amount": "10.6750",
30871
+ // "commission": "-0.0053",
30872
+ // "currency": "USDT",
30873
+ // "orderId": "1676213270274379776",
30874
+ // "liquidatedPrice": "0.00",
30875
+ // "liquidatedMarginRatio": "0.00",
30876
+ // "filledTime": "2023-07-04T20:56:01.000+0800"
30877
+ // }
30878
+ // ]
30879
+ // }
30880
+ // }
30881
+ //
30882
+ }
30883
+ return this.parseTrades(fills, market, since, limit, params);
30442
30884
  }
30443
30885
  parseDepositWithdrawFee(fee, currency = undefined) {
30444
30886
  //
@@ -34878,12 +35320,11 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
34878
35320
  // "message": "0.0001 Bitcoin transfered from Margin to Exchange"
34879
35321
  // }
34880
35322
  //
34881
- const timestamp = this.milliseconds();
34882
35323
  return {
34883
35324
  'info': transfer,
34884
35325
  'id': undefined,
34885
- 'timestamp': timestamp,
34886
- 'datetime': this.iso8601(timestamp),
35326
+ 'timestamp': undefined,
35327
+ 'datetime': undefined,
34887
35328
  'currency': this.safeCurrencyCode(undefined, currency),
34888
35329
  'amount': undefined,
34889
35330
  'fromAccount': undefined,
@@ -40729,6 +41170,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
40729
41170
  'createOrder': true,
40730
41171
  'createOrders': true,
40731
41172
  'createReduceOnlyOrder': false,
41173
+ 'createTrailingPercentOrder': true,
40732
41174
  'editOrder': true,
40733
41175
  'fetchAccounts': false,
40734
41176
  'fetchBalance': true,
@@ -43642,7 +44084,12 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
43642
44084
  'symbol': market['id'],
43643
44085
  };
43644
44086
  if (limit !== undefined) {
43645
- request['limit'] = limit;
44087
+ if (market['contract']) {
44088
+ request['limit'] = Math.min(limit, 1000);
44089
+ }
44090
+ else {
44091
+ request['limit'] = limit;
44092
+ }
43646
44093
  }
43647
44094
  const options = this.safeValue(this.options, 'fetchTrades', {});
43648
44095
  let response = undefined;
@@ -43954,31 +44401,45 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
43954
44401
  const marketType = market['spot'] ? 'spot' : 'swap';
43955
44402
  const timeframes = this.options['timeframes'][marketType];
43956
44403
  const selectedTimeframe = this.safeString(timeframes, timeframe, timeframe);
43957
- let request = {
44404
+ const request = {
43958
44405
  'symbol': market['id'],
43959
44406
  'granularity': selectedTimeframe,
43960
44407
  };
43961
- [request, params] = this.handleUntilOption('endTime', request, params);
43962
- if (since !== undefined) {
43963
- request['startTime'] = limit;
43964
- }
44408
+ const until = this.safeInteger2(params, 'until', 'till');
44409
+ params = this.omit(params, ['until', 'till']);
43965
44410
  if (limit !== undefined) {
43966
44411
  request['limit'] = limit;
43967
44412
  }
43968
44413
  const options = this.safeValue(this.options, 'fetchOHLCV', {});
44414
+ const spotOptions = this.safeValue(options, 'spot', {});
44415
+ const defaultSpotMethod = this.safeString(spotOptions, 'method', 'publicSpotGetV2SpotMarketCandles');
44416
+ const method = this.safeString(params, 'method', defaultSpotMethod);
44417
+ params = this.omit(params, 'method');
44418
+ if (method !== 'publicSpotGetV2SpotMarketHistoryCandles') {
44419
+ if (since !== undefined) {
44420
+ request['startTime'] = since;
44421
+ }
44422
+ if (until !== undefined) {
44423
+ request['endTime'] = until;
44424
+ }
44425
+ }
43969
44426
  let response = undefined;
43970
44427
  if (market['spot']) {
43971
- const spotOptions = this.safeValue(options, 'spot', {});
43972
- const defaultSpotMethod = this.safeString(spotOptions, 'method', 'publicSpotGetV2SpotMarketCandles');
43973
- const method = this.safeString(params, 'method', defaultSpotMethod);
43974
- params = this.omit(params, 'method');
43975
44428
  if (method === 'publicSpotGetV2SpotMarketCandles') {
43976
44429
  response = await this.publicSpotGetV2SpotMarketCandles(this.extend(request, params));
43977
44430
  }
43978
44431
  else if (method === 'publicSpotGetV2SpotMarketHistoryCandles') {
43979
- const until = this.safeInteger2(params, 'until', 'till');
43980
- params = this.omit(params, ['until', 'till']);
43981
- if (until === undefined) {
44432
+ if (since !== undefined) {
44433
+ if (limit === undefined) {
44434
+ limit = 100; // exchange default
44435
+ }
44436
+ const duration = this.parseTimeframe(timeframe) * 1000;
44437
+ request['endTime'] = this.sum(since, duration * limit);
44438
+ }
44439
+ else if (until !== undefined) {
44440
+ request['endTime'] = until;
44441
+ }
44442
+ else {
43982
44443
  request['endTime'] = this.milliseconds();
43983
44444
  }
43984
44445
  response = await this.publicSpotGetV2SpotMarketHistoryCandles(this.extend(request, params));
@@ -50111,6 +50572,7 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
50111
50572
  'createStopLimitOrder': false,
50112
50573
  'createStopMarketOrder': false,
50113
50574
  'createStopOrder': false,
50575
+ 'createTrailingPercentOrder': true,
50114
50576
  'fetchBalance': true,
50115
50577
  'fetchBorrowInterest': true,
50116
50578
  'fetchBorrowRateHistories': false,
@@ -50329,8 +50791,8 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
50329
50791
  'trading': {
50330
50792
  'tierBased': true,
50331
50793
  'percentage': true,
50332
- 'taker': this.parseNumber('0.0025'),
50333
- 'maker': this.parseNumber('0.0025'),
50794
+ 'taker': this.parseNumber('0.0040'),
50795
+ 'maker': this.parseNumber('0.0035'),
50334
50796
  'tiers': {
50335
50797
  'taker': [
50336
50798
  [this.parseNumber('0'), this.parseNumber('0.0020')],
@@ -53579,14 +54041,13 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
53579
54041
  // "repay_id": "2afcc16d99bd4707818c5a355dc89bed",
53580
54042
  // }
53581
54043
  //
53582
- const timestamp = this.milliseconds();
53583
54044
  return {
53584
54045
  'id': this.safeString2(info, 'borrow_id', 'repay_id'),
53585
54046
  'currency': this.safeCurrencyCode(undefined, currency),
53586
54047
  'amount': undefined,
53587
54048
  'symbol': undefined,
53588
- 'timestamp': timestamp,
53589
- 'datetime': this.iso8601(timestamp),
54049
+ 'timestamp': undefined,
54050
+ 'datetime': undefined,
53590
54051
  'info': info,
53591
54052
  };
53592
54053
  }
@@ -54573,6 +55034,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
54573
55034
  'closePosition': true,
54574
55035
  'createOrder': true,
54575
55036
  'createReduceOnlyOrder': true,
55037
+ 'createTrailingAmountOrder': true,
54576
55038
  'editOrder': true,
54577
55039
  'fetchBalance': true,
54578
55040
  'fetchClosedOrders': true,
@@ -78061,6 +78523,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
78061
78523
  'createStopLimitOrder': true,
78062
78524
  'createStopMarketOrder': true,
78063
78525
  'createStopOrder': true,
78526
+ 'createTrailingAmountOrder': true,
78064
78527
  'editOrder': true,
78065
78528
  'fetchBalance': true,
78066
78529
  'fetchBorrowInterest': false,
@@ -78307,6 +78770,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
78307
78770
  'v5/account/wallet-balance': 1,
78308
78771
  'v5/account/borrow-history': 1,
78309
78772
  'v5/account/set-collateral-switch': 5,
78773
+ 'v5/account/set-collateral-switch-batch': 5,
78310
78774
  'v5/account/collateral-info': 1,
78311
78775
  'v5/asset/coin-greeks': 1,
78312
78776
  'v5/account/fee-rate': 10,
@@ -87478,7 +87942,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
87478
87942
  'setLeverage': false,
87479
87943
  'setMarginMode': false,
87480
87944
  'setPositionMode': false,
87481
- 'withdraw': undefined,
87945
+ 'withdraw': true,
87482
87946
  },
87483
87947
  'urls': {
87484
87948
  'logo': 'https://user-images.githubusercontent.com/1294454/40811661-b6eceae2-653a-11e8-829e-10bfadb078cf.jpg',
@@ -88149,46 +88613,102 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
88149
88613
  // "next_step": null
88150
88614
  // }
88151
88615
  //
88152
- const subtotalObject = this.safeValue(transaction, 'subtotal', {});
88153
- const feeObject = this.safeValue(transaction, 'fee', {});
88154
- const id = this.safeString(transaction, 'id');
88155
- const timestamp = this.parse8601(this.safeValue(transaction, 'created_at'));
88156
- const updated = this.parse8601(this.safeValue(transaction, 'updated_at'));
88157
- const type = this.safeString(transaction, 'resource');
88158
- const amount = this.safeNumber(subtotalObject, 'amount');
88159
- const currencyId = this.safeString(subtotalObject, 'currency');
88160
- const code = this.safeCurrencyCode(currencyId, currency);
88161
- const feeCost = this.safeNumber(feeObject, 'amount');
88162
- const feeCurrencyId = this.safeString(feeObject, 'currency');
88163
- const feeCurrency = this.safeCurrencyCode(feeCurrencyId);
88164
- const fee = {
88165
- 'cost': feeCost,
88166
- 'currency': feeCurrency,
88167
- };
88616
+ // withdraw
88617
+ //
88618
+ // {
88619
+ // "id": "a1794ecf-5693-55fa-70cf-ef731748ed82",
88620
+ // "type": "send",
88621
+ // "status": "pending",
88622
+ // "amount": {
88623
+ // "amount": "-14.008308",
88624
+ // "currency": "USDC"
88625
+ // },
88626
+ // "native_amount": {
88627
+ // "amount": "-18.74",
88628
+ // "currency": "CAD"
88629
+ // },
88630
+ // "description": null,
88631
+ // "created_at": "2024-01-12T01:27:31Z",
88632
+ // "updated_at": "2024-01-12T01:27:31Z",
88633
+ // "resource": "transaction",
88634
+ // "resource_path": "/v2/accounts/a34bgfad-ed67-538b-bffc-730c98c10da0/transactions/a1794ecf-5693-55fa-70cf-ef731748ed82",
88635
+ // "instant_exchange": false,
88636
+ // "network": {
88637
+ // "status": "pending",
88638
+ // "status_description": "Pending (est. less than 10 minutes)",
88639
+ // "transaction_fee": {
88640
+ // "amount": "4.008308",
88641
+ // "currency": "USDC"
88642
+ // },
88643
+ // "transaction_amount": {
88644
+ // "amount": "10.000000",
88645
+ // "currency": "USDC"
88646
+ // },
88647
+ // "confirmations": 0
88648
+ // },
88649
+ // "to": {
88650
+ // "resource": "ethereum_address",
88651
+ // "address": "0x9...",
88652
+ // "currency": "USDC",
88653
+ // "address_info": {
88654
+ // "address": "0x9..."
88655
+ // }
88656
+ // },
88657
+ // "idem": "748d8591-dg9a-7831-a45b-crd61dg78762",
88658
+ // "details": {
88659
+ // "title": "Sent USDC",
88660
+ // "subtitle": "To USDC address on Ethereum network",
88661
+ // "header": "Sent 14.008308 USDC ($18.74)",
88662
+ // "health": "warning"
88663
+ // },
88664
+ // "hide_native_amount": false
88665
+ // }
88666
+ //
88667
+ const transactionType = this.safeString(transaction, 'type');
88668
+ let amountAndCurrencyObject = undefined;
88669
+ let feeObject = undefined;
88670
+ if (transactionType === 'send') {
88671
+ const network = this.safeValue(transaction, 'network', {});
88672
+ amountAndCurrencyObject = this.safeValue(network, 'transaction_amount', {});
88673
+ feeObject = this.safeValue(network, 'transaction_fee', {});
88674
+ }
88675
+ else {
88676
+ amountAndCurrencyObject = this.safeValue(transaction, 'subtotal', {});
88677
+ feeObject = this.safeValue(transaction, 'fee', {});
88678
+ }
88168
88679
  let status = this.parseTransactionStatus(this.safeString(transaction, 'status'));
88169
88680
  if (status === undefined) {
88170
88681
  const committed = this.safeValue(transaction, 'committed');
88171
88682
  status = committed ? 'ok' : 'pending';
88172
88683
  }
88684
+ const id = this.safeString(transaction, 'id');
88685
+ const currencyId = this.safeString(amountAndCurrencyObject, 'currency');
88686
+ const feeCurrencyId = this.safeString(feeObject, 'currency');
88687
+ const datetime = this.safeValue(transaction, 'created_at');
88688
+ const toObject = this.safeValue(transaction, 'to', {});
88689
+ const toAddress = this.safeString(toObject, 'address');
88173
88690
  return {
88174
88691
  'info': transaction,
88175
88692
  'id': id,
88176
88693
  'txid': id,
88177
- 'timestamp': timestamp,
88178
- 'datetime': this.iso8601(timestamp),
88694
+ 'timestamp': this.parse8601(datetime),
88695
+ 'datetime': datetime,
88179
88696
  'network': undefined,
88180
- 'address': undefined,
88181
- 'addressTo': undefined,
88697
+ 'address': toAddress,
88698
+ 'addressTo': toAddress,
88182
88699
  'addressFrom': undefined,
88183
88700
  'tag': undefined,
88184
88701
  'tagTo': undefined,
88185
88702
  'tagFrom': undefined,
88186
- 'type': type,
88187
- 'amount': amount,
88188
- 'currency': code,
88703
+ 'type': this.safeString(transaction, 'resource'),
88704
+ 'amount': this.safeNumber(amountAndCurrencyObject, 'amount'),
88705
+ 'currency': this.safeCurrencyCode(currencyId, currency),
88189
88706
  'status': status,
88190
- 'updated': updated,
88191
- 'fee': fee,
88707
+ 'updated': this.parse8601(this.safeValue(transaction, 'updated_at')),
88708
+ 'fee': {
88709
+ 'cost': this.safeNumber(feeObject, 'amount'),
88710
+ 'currency': this.safeCurrencyCode(feeCurrencyId),
88711
+ },
88192
88712
  };
88193
88713
  }
88194
88714
  parseTrade(trade, market = undefined) {
@@ -90542,6 +91062,100 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
90542
91062
  const tickers = this.safeValue(response, 'pricebooks', []);
90543
91063
  return this.parseTickers(tickers, symbols);
90544
91064
  }
91065
+ async withdraw(code, amount, address, tag = undefined, params = {}) {
91066
+ /**
91067
+ * @method
91068
+ * @name coinbase#withdraw
91069
+ * @description make a withdrawal
91070
+ * @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-transactions#send-money
91071
+ * @param {string} code unified currency code
91072
+ * @param {float} amount the amount to withdraw
91073
+ * @param {string} address the address to withdraw to
91074
+ * @param {string} [tag] an optional tag for the withdrawal
91075
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
91076
+ * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
91077
+ */
91078
+ [tag, params] = this.handleWithdrawTagAndParams(tag, params);
91079
+ this.checkAddress(address);
91080
+ await this.loadMarkets();
91081
+ const currency = this.currency(code);
91082
+ let accountId = this.safeString2(params, 'account_id', 'accountId');
91083
+ params = this.omit(params, ['account_id', 'accountId']);
91084
+ if (accountId === undefined) {
91085
+ if (code === undefined) {
91086
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' withdraw() requires an account_id (or accountId) parameter OR a currency code argument');
91087
+ }
91088
+ accountId = await this.findAccountId(code);
91089
+ if (accountId === undefined) {
91090
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(this.id + ' withdraw() could not find account id for ' + code);
91091
+ }
91092
+ }
91093
+ const request = {
91094
+ 'account_id': accountId,
91095
+ 'type': 'send',
91096
+ 'to': address,
91097
+ 'amount': amount,
91098
+ 'currency': currency['id'],
91099
+ };
91100
+ if (tag !== undefined) {
91101
+ request['destination_tag'] = tag;
91102
+ }
91103
+ const response = await this.v2PrivatePostAccountsAccountIdTransactions(this.extend(request, params));
91104
+ //
91105
+ // {
91106
+ // "data": {
91107
+ // "id": "a1794ecf-5693-55fa-70cf-ef731748ed82",
91108
+ // "type": "send",
91109
+ // "status": "pending",
91110
+ // "amount": {
91111
+ // "amount": "-14.008308",
91112
+ // "currency": "USDC"
91113
+ // },
91114
+ // "native_amount": {
91115
+ // "amount": "-18.74",
91116
+ // "currency": "CAD"
91117
+ // },
91118
+ // "description": null,
91119
+ // "created_at": "2024-01-12T01:27:31Z",
91120
+ // "updated_at": "2024-01-12T01:27:31Z",
91121
+ // "resource": "transaction",
91122
+ // "resource_path": "/v2/accounts/a34bgfad-ed67-538b-bffc-730c98c10da0/transactions/a1794ecf-5693-55fa-70cf-ef731748ed82",
91123
+ // "instant_exchange": false,
91124
+ // "network": {
91125
+ // "status": "pending",
91126
+ // "status_description": "Pending (est. less than 10 minutes)",
91127
+ // "transaction_fee": {
91128
+ // "amount": "4.008308",
91129
+ // "currency": "USDC"
91130
+ // },
91131
+ // "transaction_amount": {
91132
+ // "amount": "10.000000",
91133
+ // "currency": "USDC"
91134
+ // },
91135
+ // "confirmations": 0
91136
+ // },
91137
+ // "to": {
91138
+ // "resource": "ethereum_address",
91139
+ // "address": "0x9...",
91140
+ // "currency": "USDC",
91141
+ // "address_info": {
91142
+ // "address": "0x9..."
91143
+ // }
91144
+ // },
91145
+ // "idem": "748d8591-dg9a-7831-a45b-crd61dg78762",
91146
+ // "details": {
91147
+ // "title": "Sent USDC",
91148
+ // "subtitle": "To USDC address on Ethereum network",
91149
+ // "header": "Sent 14.008308 USDC ($18.74)",
91150
+ // "health": "warning"
91151
+ // },
91152
+ // "hide_native_amount": false
91153
+ // }
91154
+ // }
91155
+ //
91156
+ const data = this.safeValue(response, 'data', {});
91157
+ return this.parseTransaction(data, currency);
91158
+ }
90545
91159
  sign(path, api = [], method = 'GET', params = {}, headers = undefined, body = undefined) {
90546
91160
  const version = api[0];
90547
91161
  const signed = api[1] === 'private';
@@ -99563,7 +100177,7 @@ class coinlist extends _abstract_coinlist_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
99563
100177
  request['start_time'] = this.iso8601(since);
99564
100178
  }
99565
100179
  if (limit !== undefined) {
99566
- request['count'] = limit;
100180
+ request['count'] = Math.min(limit, 500);
99567
100181
  }
99568
100182
  const until = this.safeInteger2(params, 'till', 'until');
99569
100183
  if (until !== undefined) {
@@ -99922,11 +100536,10 @@ class coinlist extends _abstract_coinlist_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
99922
100536
  // "net_liquidation_value_usd": "string"
99923
100537
  // }
99924
100538
  //
99925
- const timestamp = this.milliseconds();
99926
100539
  const result = {
99927
100540
  'info': response,
99928
- 'timestamp': timestamp,
99929
- 'datetime': this.iso8601(timestamp),
100541
+ 'timestamp': undefined,
100542
+ 'datetime': undefined,
99930
100543
  };
99931
100544
  const totalBalances = this.safeValue(response, 'asset_balances', {});
99932
100545
  const usedBalances = this.safeValue(response, 'asset_holds', {});
@@ -102861,7 +103474,7 @@ class coinone extends _abstract_coinone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
102861
103474
  'target_currency': market['base'],
102862
103475
  };
102863
103476
  if (limit !== undefined) {
102864
- request['size'] = limit; // only support 10, 50, 100, 150, 200
103477
+ request['size'] = Math.min(limit, 200);
102865
103478
  }
102866
103479
  const response = await this.v2PublicGetTradesQuoteCurrencyTargetCurrency(this.extend(request, params));
102867
103480
  //
@@ -104408,11 +105021,10 @@ class coinsph extends _abstract_coinsph_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
104408
105021
  }
104409
105022
  parseBalance(response) {
104410
105023
  const balances = this.safeValue(response, 'balances', []);
104411
- const timestamp = this.milliseconds();
104412
105024
  const result = {
104413
105025
  'info': response,
104414
- 'timestamp': timestamp,
104415
- 'datetime': this.iso8601(timestamp),
105026
+ 'timestamp': undefined,
105027
+ 'datetime': undefined,
104416
105028
  };
104417
105029
  for (let i = 0; i < balances.length; i++) {
104418
105030
  const balance = balances[i];
@@ -114198,6 +114810,7 @@ class deribit extends _abstract_deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
114198
114810
  'createStopLimitOrder': true,
114199
114811
  'createStopMarketOrder': true,
114200
114812
  'createStopOrder': true,
114813
+ 'createTrailingAmountOrder': true,
114201
114814
  'editOrder': true,
114202
114815
  'fetchAccounts': true,
114203
114816
  'fetchBalance': true,
@@ -124939,6 +125552,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
124939
125552
  '{settle}/orders': 0.4,
124940
125553
  '{settle}/batch_orders': 0.4,
124941
125554
  '{settle}/countdown_cancel_all': 0.4,
125555
+ '{settle}/batch_cancel_orders': 0.4,
124942
125556
  '{settle}/price_orders': 0.4,
124943
125557
  },
124944
125558
  'put': {
@@ -125029,11 +125643,21 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
125029
125643
  'collateral/total_amount': 20 / 15,
125030
125644
  'collateral/ltv': 20 / 15,
125031
125645
  'collateral/currencies': 20 / 15,
125646
+ 'multi_collateral/orders': 20 / 15,
125647
+ 'multi_collateral/orders/{order_id}': 20 / 15,
125648
+ 'multi_collateral/repay': 20 / 15,
125649
+ 'multi_collateral/mortgage': 20 / 15,
125650
+ 'multi_collateral/currency_quota': 20 / 15,
125651
+ 'multi_collateral/currencies': 20 / 15,
125652
+ 'multi_collateral/ltv': 20 / 15,
125032
125653
  },
125033
125654
  'post': {
125034
125655
  'collateral/orders': 20 / 15,
125035
125656
  'collateral/repay': 20 / 15,
125036
125657
  'collateral/collaterals': 20 / 15,
125658
+ 'multi_collateral/orders': 20 / 15,
125659
+ 'multi_collateral/repay': 20 / 15,
125660
+ 'multi_collateral/mortgage': 20 / 15,
125037
125661
  },
125038
125662
  },
125039
125663
  'account': {
@@ -127621,7 +128245,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
127621
128245
  request['to'] = this.parseToInt(until / 1000);
127622
128246
  }
127623
128247
  if (limit !== undefined) {
127624
- request['limit'] = limit; // default 100, max 1000
128248
+ request['limit'] = Math.min(limit, 1000); // default 100, max 1000
127625
128249
  }
127626
128250
  if (since !== undefined && (market['contract'])) {
127627
128251
  request['from'] = this.parseToInt(since / 1000);
@@ -129659,11 +130283,19 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
129659
130283
  return this.parseTransfer(response, currency);
129660
130284
  }
129661
130285
  parseTransfer(transfer, currency = undefined) {
129662
- const timestamp = this.milliseconds();
130286
+ //
130287
+ // {
130288
+ // "currency": "BTC",
130289
+ // "from": "spot",
130290
+ // "to": "margin",
130291
+ // "amount": "1",
130292
+ // "currency_pair": "BTC_USDT"
130293
+ // }
130294
+ //
129663
130295
  return {
129664
130296
  'id': this.safeString(transfer, 'tx_id'),
129665
- 'timestamp': timestamp,
129666
- 'datetime': this.iso8601(timestamp),
130297
+ 'timestamp': undefined,
130298
+ 'datetime': undefined,
129667
130299
  'currency': this.safeCurrencyCode(undefined, currency),
129668
130300
  'amount': undefined,
129669
130301
  'fromAccount': undefined,
@@ -129753,29 +130385,35 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
129753
130385
  // swap and future
129754
130386
  //
129755
130387
  // {
129756
- // "value": "12.475572",
130388
+ // "value": "4.60516",
129757
130389
  // "leverage": "0",
129758
130390
  // "mode": "single",
129759
130391
  // "realised_point": "0",
129760
130392
  // "contract": "BTC_USDT",
129761
- // "entry_price": "62422.6",
129762
- // "mark_price": "62377.86",
130393
+ // "entry_price": "46030.3",
130394
+ // "mark_price": "46051.6",
129763
130395
  // "history_point": "0",
129764
- // "realised_pnl": "-0.00624226",
129765
- // "close_order": null,
129766
- // "size": "2",
129767
- // "cross_leverage_limit": "25",
129768
- // "pending_orders": "0",
129769
- // "adl_ranking": "5",
129770
- // "maintenance_rate": "0.005",
129771
- // "unrealised_pnl": "-0.008948",
129772
- // "user": "663337",
129773
- // "leverage_max": "100",
129774
- // "history_pnl": "14.98868396636",
130396
+ // "realised_pnl": "-0.002301515",
130397
+ // "close_order": null,
130398
+ // "size": 1,
130399
+ // "cross_leverage_limit": "0",
130400
+ // "pending_orders": 0,
130401
+ // "adl_ranking": 5,
130402
+ // "maintenance_rate": "0.004",
130403
+ // "unrealised_pnl": "0.00213",
130404
+ // "user": 5691076,
130405
+ // "leverage_max": "125",
130406
+ // "history_pnl": "0",
129775
130407
  // "risk_limit": "1000000",
129776
- // "margin": "0.740721495056",
129777
- // "last_close_pnl": "-0.041996015",
129778
- // "liq_price": "59058.58"
130408
+ // "margin": "8.997698485",
130409
+ // "last_close_pnl": "0",
130410
+ // "liq_price": "0",
130411
+ // "update_time": 1705034246,
130412
+ // "update_id": 1,
130413
+ // "initial_margin": "0",
130414
+ // "maintenance_margin": "0",
130415
+ // "open_time": 1705034246,
130416
+ // "trade_max_size": "0"
129779
130417
  // }
129780
130418
  //
129781
130419
  // option
@@ -129826,14 +130464,14 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
129826
130464
  const takerFee = '0.00075';
129827
130465
  const feePaid = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(takerFee, notional);
129828
130466
  const initialMarginString = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAdd(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringDiv(notional, leverage), feePaid);
129829
- const timestamp = this.safeInteger(position, 'time_ms');
130467
+ const timestamp = this.safeTimestamp(position, 'open_time');
129830
130468
  return this.safePosition({
129831
130469
  'info': position,
129832
130470
  'id': undefined,
129833
130471
  'symbol': this.safeString(market, 'symbol'),
129834
- 'timestamp': undefined,
129835
- 'datetime': undefined,
129836
- 'lastUpdateTimestamp': timestamp,
130472
+ 'timestamp': timestamp,
130473
+ 'datetime': this.iso8601(timestamp),
130474
+ 'lastUpdateTimestamp': this.safeTimestamp(position, 'update_time'),
129837
130475
  'initialMargin': this.parseNumber(initialMarginString),
129838
130476
  'initialMarginPercentage': this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringDiv(initialMarginString, notional)),
129839
130477
  'maintenanceMargin': this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(maintenanceRate, notional)),
@@ -129892,29 +130530,35 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
129892
130530
  // swap and future
129893
130531
  //
129894
130532
  // {
129895
- // "value": "12.475572",
130533
+ // "value": "4.60516",
129896
130534
  // "leverage": "0",
129897
130535
  // "mode": "single",
129898
130536
  // "realised_point": "0",
129899
130537
  // "contract": "BTC_USDT",
129900
- // "entry_price": "62422.6",
129901
- // "mark_price": "62377.86",
130538
+ // "entry_price": "46030.3",
130539
+ // "mark_price": "46051.6",
129902
130540
  // "history_point": "0",
129903
- // "realised_pnl": "-0.00624226",
129904
- // "close_order": null,
129905
- // "size": "2",
129906
- // "cross_leverage_limit": "25",
129907
- // "pending_orders": "0",
129908
- // "adl_ranking": "5",
129909
- // "maintenance_rate": "0.005",
129910
- // "unrealised_pnl": "-0.008948",
129911
- // "user": "6693577",
129912
- // "leverage_max": "100",
129913
- // "history_pnl": "14.98868396636",
130541
+ // "realised_pnl": "-0.002301515",
130542
+ // "close_order": null,
130543
+ // "size": 1,
130544
+ // "cross_leverage_limit": "0",
130545
+ // "pending_orders": 0,
130546
+ // "adl_ranking": 5,
130547
+ // "maintenance_rate": "0.004",
130548
+ // "unrealised_pnl": "0.00213",
130549
+ // "user": 5691076,
130550
+ // "leverage_max": "125",
130551
+ // "history_pnl": "0",
129914
130552
  // "risk_limit": "1000000",
129915
- // "margin": "0.740721495056",
129916
- // "last_close_pnl": "-0.041996015",
129917
- // "liq_price": "59058.58"
130553
+ // "margin": "8.997698485",
130554
+ // "last_close_pnl": "0",
130555
+ // "liq_price": "0",
130556
+ // "update_time": 1705034246,
130557
+ // "update_id": 1,
130558
+ // "initial_margin": "0",
130559
+ // "maintenance_margin": "0",
130560
+ // "open_time": 1705034246,
130561
+ // "trade_max_size": "0"
129918
130562
  // }
129919
130563
  //
129920
130564
  // option
@@ -129994,29 +130638,35 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
129994
130638
  //
129995
130639
  // [
129996
130640
  // {
129997
- // "value": "12.475572",
130641
+ // "value": "4.602828",
129998
130642
  // "leverage": "0",
129999
130643
  // "mode": "single",
130000
130644
  // "realised_point": "0",
130001
130645
  // "contract": "BTC_USDT",
130002
- // "entry_price": "62422.6",
130003
- // "mark_price": "62377.86",
130646
+ // "entry_price": "46030.3",
130647
+ // "mark_price": "46028.28",
130004
130648
  // "history_point": "0",
130005
- // "realised_pnl": "-0.00624226",
130006
- // "close_order": null,
130007
- // "size": "2",
130008
- // "cross_leverage_limit": "25",
130009
- // "pending_orders": "0",
130010
- // "adl_ranking": "5",
130011
- // "maintenance_rate": "0.005",
130012
- // "unrealised_pnl": "-0.008948",
130013
- // "user": "6693577",
130014
- // "leverage_max": "100",
130015
- // "history_pnl": "14.98868396636",
130649
+ // "realised_pnl": "-0.002301515",
130650
+ // "close_order": null,
130651
+ // "size": 1,
130652
+ // "cross_leverage_limit": "0",
130653
+ // "pending_orders": 0,
130654
+ // "adl_ranking": 5,
130655
+ // "maintenance_rate": "0.004",
130656
+ // "unrealised_pnl": "-0.000202",
130657
+ // "user": 5691076,
130658
+ // "leverage_max": "125",
130659
+ // "history_pnl": "0",
130016
130660
  // "risk_limit": "1000000",
130017
- // "margin": "0.740721495056",
130018
- // "last_close_pnl": "-0.041996015",
130019
- // "liq_price": "59058.58"
130661
+ // "margin": "8.997698485",
130662
+ // "last_close_pnl": "0",
130663
+ // "liq_price": "0",
130664
+ // "update_time": 1705034246,
130665
+ // "update_id": 1,
130666
+ // "initial_margin": "0",
130667
+ // "maintenance_margin": "0",
130668
+ // "open_time": 1705034246,
130669
+ // "trade_max_size": "0"
130020
130670
  // }
130021
130671
  // ]
130022
130672
  //
@@ -132530,7 +133180,7 @@ class gemini extends _abstract_gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
132530
133180
  'symbol': market['id'],
132531
133181
  };
132532
133182
  if (limit !== undefined) {
132533
- request['limit_trades'] = limit;
133183
+ request['limit_trades'] = Math.min(limit, 500);
132534
133184
  }
132535
133185
  if (since !== undefined) {
132536
133186
  request['timestamp'] = since;
@@ -136020,11 +136670,10 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
136020
136670
  // "2db6ebab-fb26-4537-9ef8-1a689472d236"
136021
136671
  // ]
136022
136672
  //
136023
- const timestamp = this.milliseconds();
136024
136673
  return {
136025
136674
  'id': this.safeString(transfer, 0),
136026
- 'timestamp': timestamp,
136027
- 'datetime': this.iso8601(timestamp),
136675
+ 'timestamp': undefined,
136676
+ 'datetime': undefined,
136028
136677
  'currency': this.safeCurrencyCode(undefined, currency),
136029
136678
  'amount': undefined,
136030
136679
  'fromAccount': undefined,
@@ -139025,6 +139674,7 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
139025
139674
  'createStopLimitOrder': true,
139026
139675
  'createStopMarketOrder': true,
139027
139676
  'createStopOrder': true,
139677
+ 'createTrailingPercentOrder': true,
139028
139678
  'fetchAccounts': true,
139029
139679
  'fetchBalance': true,
139030
139680
  'fetchBidsAsks': undefined,
@@ -143946,6 +144596,31 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
143946
144596
  params['createMarketBuyOrderRequiresPrice'] = false;
143947
144597
  return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
143948
144598
  }
144599
+ async createTrailingPercentOrder(symbol, type, side, amount, price = undefined, trailingPercent = undefined, trailingTriggerPrice = undefined, params = {}) {
144600
+ /**
144601
+ * @method
144602
+ * @name createTrailingPercentOrder
144603
+ * @description create a trailing order by providing the symbol, type, side, amount, price and trailingPercent
144604
+ * @param {string} symbol unified symbol of the market to create an order in
144605
+ * @param {string} type 'market' or 'limit'
144606
+ * @param {string} side 'buy' or 'sell'
144607
+ * @param {float} amount how much you want to trade in units of the base currency, or number of contracts
144608
+ * @param {float} [price] the price for the order to be filled at, in units of the quote currency, ignored in market orders
144609
+ * @param {float} trailingPercent the percent to trail away from the current market price
144610
+ * @param {float} trailingTriggerPrice the price to activate a trailing order, default uses the price argument
144611
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
144612
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
144613
+ */
144614
+ if (trailingPercent === undefined) {
144615
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' createTrailingPercentOrder() requires a trailingPercent argument');
144616
+ }
144617
+ if (trailingTriggerPrice === undefined) {
144618
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' createTrailingPercentOrder() requires a trailingTriggerPrice argument');
144619
+ }
144620
+ params['trailingPercent'] = trailingPercent;
144621
+ params['trailingTriggerPrice'] = trailingTriggerPrice;
144622
+ return await this.createOrder(symbol, type, side, amount, price, params);
144623
+ }
143949
144624
  async createSpotOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
143950
144625
  /**
143951
144626
  * @method
@@ -144158,15 +144833,11 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
144158
144833
  }
144159
144834
  }
144160
144835
  if (!isStopLossTriggerOrder && !isTakeProfitTriggerOrder) {
144161
- const leverRate = this.safeIntegerN(params, ['leverRate', 'lever_rate', 'leverage'], 1);
144162
144836
  const reduceOnly = this.safeValue2(params, 'reduceOnly', 'reduce_only', false);
144163
- const openOrClose = (reduceOnly) ? 'close' : 'open';
144164
- const offset = this.safeString(params, 'offset', openOrClose);
144165
- request['offset'] = offset;
144166
144837
  if (reduceOnly) {
144167
144838
  request['reduce_only'] = 1;
144168
144839
  }
144169
- request['lever_rate'] = leverRate;
144840
+ request['lever_rate'] = this.safeIntegerN(params, ['leverRate', 'lever_rate', 'leverage'], 1);
144170
144841
  if (!isTrailingPercentOrder) {
144171
144842
  request['order_price_type'] = type;
144172
144843
  }
@@ -144230,10 +144901,10 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
144230
144901
  response = await this.spotPrivatePostV1OrderOrdersPlace(spotRequest);
144231
144902
  }
144232
144903
  else {
144233
- const contractRequest = this.createContractOrderRequest(symbol, type, side, amount, price, params);
144904
+ let contractRequest = this.createContractOrderRequest(symbol, type, side, amount, price, params);
144234
144905
  if (market['linear']) {
144235
144906
  let marginMode = undefined;
144236
- [marginMode, params] = this.handleMarginModeAndParams('createOrder', params);
144907
+ [marginMode, contractRequest] = this.handleMarginModeAndParams('createOrder', contractRequest);
144237
144908
  marginMode = (marginMode === undefined) ? 'cross' : marginMode;
144238
144909
  if (marginMode === 'isolated') {
144239
144910
  if (isStop) {
@@ -149485,13 +150156,12 @@ class huobijp extends _abstract_huobijp_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
149485
150156
  }
149486
150157
  const method = this.options['createOrderMethod'];
149487
150158
  const response = await this[method](this.extend(request, params));
149488
- const timestamp = this.milliseconds();
149489
150159
  const id = this.safeString(response, 'data');
149490
150160
  return this.safeOrder({
149491
150161
  'info': response,
149492
150162
  'id': id,
149493
- 'timestamp': timestamp,
149494
- 'datetime': this.iso8601(timestamp),
150163
+ 'timestamp': undefined,
150164
+ 'datetime': undefined,
149495
150165
  'lastTradeTimestamp': undefined,
149496
150166
  'status': undefined,
149497
150167
  'symbol': symbol,
@@ -152431,20 +153101,22 @@ class independentreserve extends _abstract_independentreserve_js__WEBPACK_IMPORT
152431
153101
  */
152432
153102
  await this.loadMarkets();
152433
153103
  const market = this.market(symbol);
152434
- const capitalizedOrderType = this.capitalize(type);
152435
- const method = 'privatePostPlace' + capitalizedOrderType + 'Order';
152436
- let orderType = capitalizedOrderType;
153104
+ let orderType = this.capitalize(type);
152437
153105
  orderType += (side === 'sell') ? 'Offer' : 'Bid';
152438
153106
  const request = this.ordered({
152439
153107
  'primaryCurrencyCode': market['baseId'],
152440
153108
  'secondaryCurrencyCode': market['quoteId'],
152441
153109
  'orderType': orderType,
152442
153110
  });
153111
+ let response = undefined;
153112
+ request['volume'] = amount;
152443
153113
  if (type === 'limit') {
152444
153114
  request['price'] = price;
153115
+ response = await this.privatePostPlaceLimitOrder(this.extend(request, params));
153116
+ }
153117
+ else {
153118
+ response = await this.privatePostPlaceMarketOrder(this.extend(request, params));
152445
153119
  }
152446
- request['volume'] = amount;
152447
- const response = await this[method](this.extend(request, params));
152448
153120
  return this.safeOrder({
152449
153121
  'info': response,
152450
153122
  'id': response['OrderGuid'],
@@ -153635,6 +154307,7 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
153635
154307
  'createStopLimitOrder': true,
153636
154308
  'createStopMarketOrder': true,
153637
154309
  'createStopOrder': true,
154310
+ 'createTrailingAmountOrder': true,
153638
154311
  'editOrder': true,
153639
154312
  'fetchBalance': true,
153640
154313
  'fetchBorrowInterest': false,
@@ -154859,12 +155532,8 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
154859
155532
  request['since'] = since * 1e6;
154860
155533
  request['since'] = since.toString() + '000000'; // expected to be in nanoseconds
154861
155534
  }
154862
- // https://github.com/ccxt/ccxt/issues/5698
154863
- if (limit !== undefined && limit !== 1000) {
154864
- const fetchTradesWarning = this.safeValue(this.options, 'fetchTradesWarning', true);
154865
- if (fetchTradesWarning) {
154866
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(this.id + ' fetchTrades() cannot serve ' + limit.toString() + " trades without breaking the pagination, see https://github.com/ccxt/ccxt/issues/5698 for more details. Set exchange.options['fetchTradesWarning'] to acknowledge this warning and silence it.");
154867
- }
155535
+ if (limit !== undefined) {
155536
+ request['count'] = limit;
154868
155537
  }
154869
155538
  const response = await this.publicGetTrades(this.extend(request, params));
154870
155539
  //
@@ -170496,13 +171165,17 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
170496
171165
  else {
170497
171166
  request['size'] = 600; // max
170498
171167
  }
170499
- let method = this.safeString(params, 'method');
171168
+ const options = this.safeValue(this.options, 'fetchTrades', {});
171169
+ const defaultMethod = this.safeString(options, 'method', 'spotPublicGetTrades');
171170
+ const method = this.safeString(params, 'method', defaultMethod);
170500
171171
  params = this.omit(params, 'method');
170501
- if (method === undefined) {
170502
- const options = this.safeValue(this.options, 'fetchTrades', {});
170503
- method = this.safeString(options, 'method', 'spotPublicGetTrades');
171172
+ let response = undefined;
171173
+ if (method === 'spotPublicGetSupplementTrades') {
171174
+ response = await this.spotPublicGetSupplementTrades(this.extend(request, params));
171175
+ }
171176
+ else {
171177
+ response = await this.spotPublicGetTrades(this.extend(request, params));
170504
171178
  }
170505
- const response = await this[method](this.extend(request, params));
170506
171179
  //
170507
171180
  // {
170508
171181
  // "result":"true",
@@ -170739,12 +171412,19 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
170739
171412
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
170740
171413
  */
170741
171414
  await this.loadMarkets();
170742
- let method = this.safeString(params, 'method');
170743
- if (method === undefined) {
170744
- const options = this.safeValue(this.options, 'fetchBalance', {});
170745
- method = this.safeString(options, 'method', 'spotPrivatePostSupplementUserInfo');
171415
+ const options = this.safeValue(this.options, 'fetchBalance', {});
171416
+ const defaultMethod = this.safeString(options, 'method', 'spotPrivatePostSupplementUserInfo');
171417
+ const method = this.safeString(params, 'method', defaultMethod);
171418
+ let response = undefined;
171419
+ if (method === 'spotPrivatePostSupplementUserInfoAccount') {
171420
+ response = await this.spotPrivatePostSupplementUserInfoAccount();
171421
+ }
171422
+ else if (method === 'spotPrivatePostUserInfo') {
171423
+ response = await this.spotPrivatePostUserInfo();
171424
+ }
171425
+ else {
171426
+ response = await this.spotPrivatePostSupplementUserInfo();
170746
171427
  }
170747
- const response = await this[method]();
170748
171428
  //
170749
171429
  // {
170750
171430
  // "result": "true",
@@ -170929,14 +171609,17 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
170929
171609
  if (clientOrderId !== undefined) {
170930
171610
  request['custom_id'] = clientOrderId;
170931
171611
  }
170932
- let method = undefined;
170933
- method = this.safeString(params, 'method');
171612
+ const options = this.safeValue(this.options, 'createOrder', {});
171613
+ const defaultMethod = this.safeString(options, 'method', 'spotPrivatePostSupplementCreateOrder');
171614
+ const method = this.safeString(params, 'method', defaultMethod);
170934
171615
  params = this.omit(params, 'method');
170935
- if (method === undefined) {
170936
- const options = this.safeValue(this.options, 'createOrder', {});
170937
- method = this.safeString(options, 'method', 'spotPrivatePostSupplementCreateOrder');
171616
+ let response = undefined;
171617
+ if (method === 'spotPrivatePostCreateOrder') {
171618
+ response = await this.spotPrivatePostCreateOrder(this.extend(request, params));
171619
+ }
171620
+ else {
171621
+ response = await this.spotPrivatePostSupplementCreateOrder(this.extend(request, params));
170938
171622
  }
170939
- const response = await this[method](this.extend(request, params));
170940
171623
  //
170941
171624
  // {
170942
171625
  // "result":true,
@@ -171471,13 +172154,18 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
171471
172154
  * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
171472
172155
  */
171473
172156
  await this.loadMarkets();
171474
- let method = this.safeString(params, 'method');
172157
+ const options = this.safeValue(this.options, 'fetchDepositAddress', {});
172158
+ const defaultMethod = this.safeString(options, 'method', 'fetchDepositAddressDefault');
172159
+ const method = this.safeString(params, 'method', defaultMethod);
171475
172160
  params = this.omit(params, 'method');
171476
- if (method === undefined) {
171477
- const options = this.safeValue(this.options, 'fetchDepositAddress', {});
171478
- method = this.safeString(options, 'method', 'fetchDepositAddressDefault');
172161
+ let response = undefined;
172162
+ if (method === 'fetchDepositAddressSupplement') {
172163
+ response = await this.fetchDepositAddressSupplement(code, params);
171479
172164
  }
171480
- return await this[method](code, params);
172165
+ else {
172166
+ response = await this.fetchDepositAddressDefault(code, params);
172167
+ }
172168
+ return response;
171481
172169
  }
171482
172170
  async fetchDepositAddressDefault(code, params = {}) {
171483
172171
  await this.loadMarkets();
@@ -171849,13 +172537,16 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
171849
172537
  const isAuthorized = this.checkRequiredCredentials(false);
171850
172538
  let result = undefined;
171851
172539
  if (isAuthorized === true) {
171852
- let method = this.safeString(params, 'method');
172540
+ const options = this.safeValue(this.options, 'fetchTransactionFees', {});
172541
+ const defaultMethod = this.safeString(options, 'method', 'fetchPrivateTransactionFees');
172542
+ const method = this.safeString(params, 'method', defaultMethod);
171853
172543
  params = this.omit(params, 'method');
171854
- if (method === undefined) {
171855
- const options = this.safeValue(this.options, 'fetchTransactionFees', {});
171856
- method = this.safeString(options, 'method', 'fetchPrivateTransactionFees');
172544
+ if (method === 'fetchPublicTransactionFees') {
172545
+ result = await this.fetchPublicTransactionFees(params);
172546
+ }
172547
+ else {
172548
+ result = await this.fetchPrivateTransactionFees(params);
171857
172549
  }
171858
- result = await this[method](params);
171859
172550
  }
171860
172551
  else {
171861
172552
  result = await this.fetchPublicTransactionFees(params);
@@ -171993,19 +172684,23 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
171993
172684
  */
171994
172685
  await this.loadMarkets();
171995
172686
  const isAuthorized = this.checkRequiredCredentials(false);
171996
- let method = undefined;
172687
+ const response = undefined;
171997
172688
  if (isAuthorized === true) {
171998
- method = this.safeString(params, 'method');
172689
+ const options = this.safeValue(this.options, 'fetchDepositWithdrawFees', {});
172690
+ const defaultMethod = this.safeString(options, 'method', 'fetchPrivateDepositWithdrawFees');
172691
+ const method = this.safeString(params, 'method', defaultMethod);
171999
172692
  params = this.omit(params, 'method');
172000
- if (method === undefined) {
172001
- const options = this.safeValue(this.options, 'fetchDepositWithdrawFees', {});
172002
- method = this.safeString(options, 'method', 'fetchPrivateDepositWithdrawFees');
172693
+ if (method === 'fetchPublicDepositWithdrawFees') {
172694
+ await this.fetchPublicDepositWithdrawFees(codes, params);
172695
+ }
172696
+ else {
172697
+ await this.fetchPrivateDepositWithdrawFees(codes, params);
172003
172698
  }
172004
172699
  }
172005
172700
  else {
172006
- method = 'fetchPublicDepositWithdrawFees';
172701
+ await this.fetchPublicDepositWithdrawFees(codes, params);
172007
172702
  }
172008
- return await this[method](codes, params);
172703
+ return response;
172009
172704
  }
172010
172705
  async fetchPrivateDepositWithdrawFees(codes = undefined, params = {}) {
172011
172706
  // complete response
@@ -176998,7 +177693,8 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
176998
177693
  // ]
176999
177694
  // }
177000
177695
  //
177001
- orderbook = this.parseOrderBook(response, symbol);
177696
+ const spotTimestamp = this.safeInteger(response, 'timestamp');
177697
+ orderbook = this.parseOrderBook(response, symbol, spotTimestamp);
177002
177698
  orderbook['nonce'] = this.safeInteger(response, 'lastUpdateId');
177003
177699
  }
177004
177700
  else if (market['swap']) {
@@ -185590,7 +186286,7 @@ class oceanex extends _abstract_oceanex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
185590
186286
  'market': market['id'],
185591
186287
  };
185592
186288
  if (limit !== undefined) {
185593
- request['limit'] = limit;
186289
+ request['limit'] = Math.min(limit, 1000);
185594
186290
  }
185595
186291
  const response = await this.publicGetTrades(this.extend(request, params));
185596
186292
  //
@@ -189262,6 +189958,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
189262
189958
  'createStopLimitOrder': true,
189263
189959
  'createStopMarketOrder': true,
189264
189960
  'createStopOrder': true,
189961
+ 'createTrailingPercentOrder': true,
189265
189962
  'editOrder': true,
189266
189963
  'fetchAccounts': true,
189267
189964
  'fetchBalance': true,
@@ -189374,8 +190071,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
189374
190071
  'referral': {
189375
190072
  // old reflink 0% discount https://www.okx.com/join/1888677
189376
190073
  // new reflink 20% discount https://www.okx.com/join/CCXT2023
189377
- // okx + ccxt campaign reflink with 20% discount https://www.okx.com/activities/ccxt-trade-and-earn?channelid=CCXT2023
189378
- 'url': 'https://www.okx.com/activities/ccxt-trade-and-earn?channelid=CCXT2023',
190074
+ 'url': 'https://www.okx.com/join/CCXT2023',
189379
190075
  'discount': 0.2,
189380
190076
  },
189381
190077
  'test': {
@@ -189476,6 +190172,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
189476
190172
  'sprd/order': 1 / 3,
189477
190173
  'sprd/orders-pending': 1 / 3,
189478
190174
  'sprd/orders-history': 1 / 2,
190175
+ 'sprd/orders-history-archive': 1 / 2,
189479
190176
  'sprd/trades': 1 / 3,
189480
190177
  // trade
189481
190178
  'trade/order': 1 / 3,
@@ -190432,10 +191129,20 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
190432
191129
  for (let i = 0; i < data.length; i++) {
190433
191130
  const event = data[i];
190434
191131
  const state = this.safeString(event, 'state');
191132
+ update['eta'] = this.safeInteger(event, 'end');
191133
+ update['url'] = this.safeString(event, 'href');
190435
191134
  if (state === 'ongoing') {
190436
- update['eta'] = this.safeInteger(event, 'end');
190437
191135
  update['status'] = 'maintenance';
190438
191136
  }
191137
+ else if (state === 'scheduled') {
191138
+ update['status'] = 'ok';
191139
+ }
191140
+ else if (state === 'completed') {
191141
+ update['status'] = 'ok';
191142
+ }
191143
+ else if (state === 'canceled') {
191144
+ update['status'] = 'ok';
191145
+ }
190439
191146
  }
190440
191147
  return update;
190441
191148
  }
@@ -198857,7 +199564,7 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
198857
199564
  },
198858
199565
  },
198859
199566
  'options': {
198860
- 'brokerId': 'CCXT',
199567
+ 'brokerId': 'CCXT123456',
198861
199568
  'x-phemex-request-expiry': 60,
198862
199569
  'createOrderByQuoteRequiresPrice': true,
198863
199570
  'networks': {
@@ -200882,7 +201589,7 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
200882
201589
  const takeProfit = this.safeValue(params, 'takeProfit');
200883
201590
  const takeProfitDefined = (takeProfit !== undefined);
200884
201591
  if (clientOrderId === undefined) {
200885
- const brokerId = this.safeString(this.options, 'brokerId');
201592
+ const brokerId = this.safeString(this.options, 'brokerId', 'CCXT123456');
200886
201593
  if (brokerId !== undefined) {
200887
201594
  request['clOrdID'] = brokerId + this.uuid16();
200888
201595
  }
@@ -202678,6 +203385,13 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
202678
203385
  };
202679
203386
  let payload = '';
202680
203387
  if (method === 'POST') {
203388
+ const isOrderPlacement = (path === 'g-orders') || (path === 'spot/orders') || (path === 'orders');
203389
+ if (isOrderPlacement) {
203390
+ if (this.safeString(params, 'clOrdID') === undefined) {
203391
+ const id = this.safeString(this.options, 'brokerId', 'CCXT123456');
203392
+ params['clOrdID'] = id + this.uuid16();
203393
+ }
203394
+ }
202681
203395
  payload = this.json(params);
202682
203396
  body = payload;
202683
203397
  headers['Content-Type'] = 'application/json';
@@ -209100,6 +209814,12 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
209100
209814
  'future': 50,
209101
209815
  'delivery': 50, // max 200
209102
209816
  },
209817
+ 'subscriptionLimitByStream': {
209818
+ 'spot': 200,
209819
+ 'margin': 200,
209820
+ 'future': 200,
209821
+ 'delivery': 200,
209822
+ },
209103
209823
  'streamBySubscriptionsHash': {},
209104
209824
  'streamIndex': -1,
209105
209825
  // get updates every 1000ms or 100ms
@@ -209148,7 +209868,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
209148
209868
  this.options['requestId'][url] = newValue;
209149
209869
  return newValue;
209150
209870
  }
209151
- stream(type, subscriptionHash) {
209871
+ stream(type, subscriptionHash, numSubscriptions = 1) {
209152
209872
  const streamBySubscriptionsHash = this.safeValue(this.options, 'streamBySubscriptionsHash', {});
209153
209873
  let stream = this.safeString(streamBySubscriptionsHash, subscriptionHash);
209154
209874
  if (stream === undefined) {
@@ -209160,6 +209880,17 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
209160
209880
  this.options['streamIndex'] = streamIndex;
209161
209881
  stream = this.numberToString(normalizedIndex);
209162
209882
  this.options['streamBySubscriptionsHash'][subscriptionHash] = stream;
209883
+ const subscriptionsByStreams = this.safeValue(this.options, 'numSubscriptionsByStream');
209884
+ if (subscriptionsByStreams === undefined) {
209885
+ this.options['numSubscriptionsByStream'] = {};
209886
+ }
209887
+ const subscriptionsByStream = this.safeInteger(this.options['numSubscriptionsByStream'], stream, 0);
209888
+ const newNumSubscriptions = subscriptionsByStream + numSubscriptions;
209889
+ const subscriptionLimitByStream = this.safeInteger(this.options, 'subscriptionLimitByStream', 200);
209890
+ if (newNumSubscriptions > subscriptionLimitByStream) {
209891
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' reached the limit of subscriptions by stream. Increase the number of streams, or increase the stream limit or subscription limit by stream if the exchange allows.');
209892
+ }
209893
+ this.options['numSubscriptionsByStream'][stream] = subscriptionsByStream + numSubscriptions;
209163
209894
  }
209164
209895
  return stream;
209165
209896
  }
@@ -209230,8 +209961,14 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
209230
209961
  type = firstMarket['linear'] ? 'future' : 'delivery';
209231
209962
  }
209232
209963
  const name = 'depth';
209233
- const url = this.urls['api']['ws'][type] + '/' + this.stream(type, 'multipleOrderbook');
209234
- const requestId = this.requestId(url);
209964
+ let streamHash = 'multipleOrderbook';
209965
+ if (symbols !== undefined) {
209966
+ const symbolsLength = symbols.length;
209967
+ if (symbolsLength > 200) {
209968
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' watchOrderBookForSymbols() accepts 200 symbols at most. To watch more symbols call watchOrderBookForSymbols() multiple times');
209969
+ }
209970
+ streamHash += '::' + symbols.join(',');
209971
+ }
209235
209972
  const watchOrderBookRate = this.safeString(this.options, 'watchOrderBookRate', '100');
209236
209973
  const subParams = [];
209237
209974
  const messageHashes = [];
@@ -209243,6 +209980,9 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
209243
209980
  const symbolHash = messageHash + '@' + watchOrderBookRate + 'ms';
209244
209981
  subParams.push(symbolHash);
209245
209982
  }
209983
+ const messageHashesLength = messageHashes.length;
209984
+ const url = this.urls['api']['ws'][type] + '/' + this.stream(type, streamHash, messageHashesLength);
209985
+ const requestId = this.requestId(url);
209246
209986
  const request = {
209247
209987
  'method': 'SUBSCRIBE',
209248
209988
  'params': subParams,
@@ -209486,6 +210226,14 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
209486
210226
  */
209487
210227
  await this.loadMarkets();
209488
210228
  symbols = this.marketSymbols(symbols, undefined, false, true, true);
210229
+ let streamHash = 'multipleTrades';
210230
+ if (symbols !== undefined) {
210231
+ const symbolsLength = symbols.length;
210232
+ if (symbolsLength > 200) {
210233
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' watchTradesForSymbols() accepts 200 symbols at most. To watch more symbols call watchTradesForSymbols() multiple times');
210234
+ }
210235
+ streamHash += '::' + symbols.join(',');
210236
+ }
209489
210237
  const options = this.safeValue(this.options, 'watchTradesForSymbols', {});
209490
210238
  const name = this.safeString(options, 'name', 'trade');
209491
210239
  const firstMarket = this.market(symbols[0]);
@@ -209501,7 +210249,8 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
209501
210249
  subParams.push(currentMessageHash);
209502
210250
  }
209503
210251
  const query = this.omit(params, 'type');
209504
- const url = this.urls['api']['ws'][type] + '/' + this.stream(type, 'multipleTrades');
210252
+ const subParamsLength = subParams.length;
210253
+ const url = this.urls['api']['ws'][type] + '/' + this.stream(type, streamHash, subParamsLength);
209505
210254
  const requestId = this.requestId(url);
209506
210255
  const request = {
209507
210256
  'method': 'SUBSCRIBE',
@@ -209985,30 +210734,30 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
209985
210734
  }
209986
210735
  const marketId = this.safeString(message, 's');
209987
210736
  const symbol = this.safeSymbol(marketId, undefined, undefined, marketType);
209988
- const last = this.safeFloat(message, 'c');
209989
- const ticker = {
210737
+ const market = this.safeMarket(marketId, undefined, undefined, marketType);
210738
+ const last = this.safeString(message, 'c');
210739
+ return this.safeTicker({
209990
210740
  'symbol': symbol,
209991
210741
  'timestamp': timestamp,
209992
210742
  'datetime': this.iso8601(timestamp),
209993
- 'high': this.safeFloat(message, 'h'),
209994
- 'low': this.safeFloat(message, 'l'),
209995
- 'bid': this.safeFloat(message, 'b'),
209996
- 'bidVolume': this.safeFloat(message, 'B'),
209997
- 'ask': this.safeFloat(message, 'a'),
209998
- 'askVolume': this.safeFloat(message, 'A'),
209999
- 'vwap': this.safeFloat(message, 'w'),
210000
- 'open': this.safeFloat(message, 'o'),
210743
+ 'high': this.safeString(message, 'h'),
210744
+ 'low': this.safeString(message, 'l'),
210745
+ 'bid': this.safeString(message, 'b'),
210746
+ 'bidVolume': this.safeString(message, 'B'),
210747
+ 'ask': this.safeString(message, 'a'),
210748
+ 'askVolume': this.safeString(message, 'A'),
210749
+ 'vwap': this.safeString(message, 'w'),
210750
+ 'open': this.safeString(message, 'o'),
210001
210751
  'close': last,
210002
210752
  'last': last,
210003
- 'previousClose': this.safeFloat(message, 'x'),
210004
- 'change': this.safeFloat(message, 'p'),
210005
- 'percentage': this.safeFloat(message, 'P'),
210753
+ 'previousClose': this.safeString(message, 'x'),
210754
+ 'change': this.safeString(message, 'p'),
210755
+ 'percentage': this.safeString(message, 'P'),
210006
210756
  'average': undefined,
210007
- 'baseVolume': this.safeFloat(message, 'v'),
210008
- 'quoteVolume': this.safeFloat(message, 'q'),
210757
+ 'baseVolume': this.safeString(message, 'v'),
210758
+ 'quoteVolume': this.safeString(message, 'q'),
210009
210759
  'info': message,
210010
- };
210011
- return ticker;
210760
+ }, market);
210012
210761
  }
210013
210762
  handleTicker(client, message) {
210014
210763
  //
@@ -211273,7 +212022,8 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
211273
212022
  market = this.getMarketFromSymbols(symbols);
211274
212023
  messageHash = '::' + symbols.join(',');
211275
212024
  }
211276
- let type = this.handleMarketTypeAndParams('watchPositions', market, params);
212025
+ let type = undefined;
212026
+ [type, params] = this.handleMarketTypeAndParams('watchPositions', market, params);
211277
212027
  if (type === 'spot' || type === 'margin') {
211278
212028
  type = 'future';
211279
212029
  }
@@ -227297,7 +228047,10 @@ class coinbase extends _coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
227297
228047
  }
227298
228048
  const name = 'ticker_batch';
227299
228049
  const tickers = await this.subscribe(name, symbols, params);
227300
- return tickers;
228050
+ if (this.newUpdates) {
228051
+ return tickers;
228052
+ }
228053
+ return this.tickers;
227301
228054
  }
227302
228055
  handleTickers(client, message) {
227303
228056
  //
@@ -241431,7 +242184,7 @@ class kraken extends _kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
241431
242184
  ],
241432
242185
  'subscription': {
241433
242186
  'name': name,
241434
- 'interval': this.safeString(this.timeframes, timeframe, timeframe),
242187
+ 'interval': this.safeValue(this.timeframes, timeframe, timeframe),
241435
242188
  },
241436
242189
  };
241437
242190
  const request = this.deepExtend(subscribe, params);
@@ -248671,6 +249424,7 @@ class okx extends _okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
248671
249424
  'watchOrderBookForSymbols': true,
248672
249425
  'watchBalance': true,
248673
249426
  'watchOHLCV': true,
249427
+ 'watchOHLCVForSymbols': true,
248674
249428
  'watchOrders': true,
248675
249429
  'watchMyTrades': true,
248676
249430
  'watchPositions': true,
@@ -249007,6 +249761,50 @@ class okx extends _okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
249007
249761
  }
249008
249762
  return this.filterBySinceLimit(ohlcv, since, limit, 0, true);
249009
249763
  }
249764
+ async watchOHLCVForSymbols(symbolsAndTimeframes, since = undefined, limit = undefined, params = {}) {
249765
+ /**
249766
+ * @method
249767
+ * @name okx#watchOHLCVForSymbols
249768
+ * @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
249769
+ * @param {string[][]} symbolsAndTimeframes array of arrays containing unified symbols and timeframes to fetch OHLCV data for, example [['BTC/USDT', '1m'], ['LTC/USDT', '5m']]
249770
+ * @param {int} [since] timestamp in ms of the earliest candle to fetch
249771
+ * @param {int} [limit] the maximum amount of candles to fetch
249772
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
249773
+ * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
249774
+ */
249775
+ const symbolsLength = symbolsAndTimeframes.length;
249776
+ if (symbolsLength === 0 || !Array.isArray(symbolsAndTimeframes[0])) {
249777
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + " watchOHLCVForSymbols() requires a an array of symbols and timeframes, like [['BTC/USDT', '1m'], ['LTC/USDT', '5m']]");
249778
+ }
249779
+ await this.loadMarkets();
249780
+ const topics = [];
249781
+ const messageHashes = [];
249782
+ for (let i = 0; i < symbolsAndTimeframes.length; i++) {
249783
+ const symbolAndTimeframe = symbolsAndTimeframes[i];
249784
+ const sym = symbolAndTimeframe[0];
249785
+ const tf = symbolAndTimeframe[1];
249786
+ const marketId = this.marketId(sym);
249787
+ const interval = this.safeString(this.timeframes, tf, tf);
249788
+ const channel = 'candle' + interval;
249789
+ const topic = {
249790
+ 'channel': channel,
249791
+ 'instId': marketId,
249792
+ };
249793
+ topics.push(topic);
249794
+ messageHashes.push('multi:' + channel + ':' + sym);
249795
+ }
249796
+ const request = {
249797
+ 'op': 'subscribe',
249798
+ 'args': topics,
249799
+ };
249800
+ const url = this.getUrl('candle', 'public');
249801
+ const [symbol, timeframe, candles] = await this.watchMultiple(url, messageHashes, request, messageHashes);
249802
+ if (this.newUpdates) {
249803
+ limit = candles.getLimit(symbol, limit);
249804
+ }
249805
+ const filtered = this.filterBySinceLimit(candles, since, limit, 0, true);
249806
+ return this.createOHLCVObject(symbol, timeframe, filtered);
249807
+ }
249010
249808
  handleOHLCV(client, message) {
249011
249809
  //
249012
249810
  // {
@@ -249029,7 +249827,7 @@ class okx extends _okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
249029
249827
  const data = this.safeValue(message, 'data', []);
249030
249828
  const marketId = this.safeString(arg, 'instId');
249031
249829
  const market = this.safeMarket(marketId);
249032
- const symbol = market['id'];
249830
+ const symbol = market['symbol'];
249033
249831
  const interval = channel.replace('candle', '');
249034
249832
  // use a reverse lookup in a static map instead
249035
249833
  const timeframe = this.findTimeframe(interval);
@@ -249043,8 +249841,13 @@ class okx extends _okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
249043
249841
  this.ohlcvs[symbol][timeframe] = stored;
249044
249842
  }
249045
249843
  stored.append(parsed);
249046
- const messageHash = channel + ':' + marketId;
249844
+ const messageHash = channel + ':' + market['id'];
249047
249845
  client.resolve(stored, messageHash);
249846
+ // for multiOHLCV we need special object, as opposed to other "multi"
249847
+ // methods, because OHLCV response item does not contain symbol
249848
+ // or timeframe, thus otherwise it would be unrecognizable
249849
+ const messageHashForMulti = 'multi:' + channel + ':' + symbol;
249850
+ client.resolve([symbol, timeframe, stored], messageHashForMulti);
249048
249851
  }
249049
249852
  }
249050
249853
  async watchOrderBook(symbol, limit = undefined, params = {}) {
@@ -258138,7 +258941,6 @@ class probit extends _abstract_probit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
258138
258941
  const market = this.market(symbol);
258139
258942
  const request = {
258140
258943
  'market_id': market['id'],
258141
- 'limit': 100,
258142
258944
  'start_time': '1970-01-01T00:00:00.000Z',
258143
258945
  'end_time': this.iso8601(this.milliseconds()),
258144
258946
  };
@@ -258146,7 +258948,10 @@ class probit extends _abstract_probit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
258146
258948
  request['start_time'] = this.iso8601(since);
258147
258949
  }
258148
258950
  if (limit !== undefined) {
258149
- request['limit'] = Math.min(limit, 10000);
258951
+ request['limit'] = Math.min(limit, 1000);
258952
+ }
258953
+ else {
258954
+ request['limit'] = 1000; // required to set any value
258150
258955
  }
258151
258956
  const response = await this.publicGetTrade(this.extend(request, params));
258152
258957
  //
@@ -272554,11 +273359,11 @@ class upbit extends _abstract_upbit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
272554
273359
  else if ((locked !== undefined) && locked) {
272555
273360
  active = false;
272556
273361
  }
272557
- const maxOnetimeWithdrawal = this.safeNumber(withdrawLimits, 'onetime');
272558
- const maxDailyWithdrawal = this.safeNumber(withdrawLimits, 'daily', maxOnetimeWithdrawal);
272559
- const remainingDailyWithdrawal = this.safeNumber(withdrawLimits, 'remaining_daily', maxDailyWithdrawal);
273362
+ const maxOnetimeWithdrawal = this.safeString(withdrawLimits, 'onetime');
273363
+ const maxDailyWithdrawal = this.safeString(withdrawLimits, 'daily', maxOnetimeWithdrawal);
273364
+ const remainingDailyWithdrawal = this.safeString(withdrawLimits, 'remaining_daily', maxDailyWithdrawal);
272560
273365
  let maxWithdrawLimit = undefined;
272561
- if (remainingDailyWithdrawal > 0) {
273366
+ if (_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringGt(remainingDailyWithdrawal, '0')) {
272562
273367
  maxWithdrawLimit = remainingDailyWithdrawal;
272563
273368
  }
272564
273369
  else {
@@ -272577,7 +273382,7 @@ class upbit extends _abstract_upbit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
272577
273382
  'limits': {
272578
273383
  'withdraw': {
272579
273384
  'min': this.safeNumber(withdrawLimits, 'minimum'),
272580
- 'max': maxWithdrawLimit,
273385
+ 'max': this.parseNumber(maxWithdrawLimit),
272581
273386
  },
272582
273387
  },
272583
273388
  };
@@ -272637,10 +273442,10 @@ class upbit extends _abstract_upbit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
272637
273442
  const base = this.safeCurrencyCode(baseId);
272638
273443
  const quote = this.safeCurrencyCode(quoteId);
272639
273444
  const state = this.safeString(marketInfo, 'state');
272640
- const bidFee = this.safeNumber(response, 'bid_fee');
272641
- const askFee = this.safeNumber(response, 'ask_fee');
272642
- const fee = Math.max(bidFee, askFee);
272643
- return {
273445
+ const bidFee = this.safeString(response, 'bid_fee');
273446
+ const askFee = this.safeString(response, 'ask_fee');
273447
+ const fee = this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMax(bidFee, askFee));
273448
+ return this.safeMarketStructure({
272644
273449
  'id': marketId,
272645
273450
  'symbol': base + '/' + quote,
272646
273451
  'base': base,
@@ -272689,7 +273494,7 @@ class upbit extends _abstract_upbit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
272689
273494
  },
272690
273495
  'info': response,
272691
273496
  },
272692
- };
273497
+ });
272693
273498
  }
272694
273499
  async fetchMarkets(params = {}) {
272695
273500
  /**
@@ -272718,7 +273523,7 @@ class upbit extends _abstract_upbit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
272718
273523
  const [quoteId, baseId] = id.split('-');
272719
273524
  const base = this.safeCurrencyCode(baseId);
272720
273525
  const quote = this.safeCurrencyCode(quoteId);
272721
- return {
273526
+ return this.safeMarketStructure({
272722
273527
  'id': id,
272723
273528
  'symbol': base + '/' + quote,
272724
273529
  'base': base,
@@ -272768,7 +273573,7 @@ class upbit extends _abstract_upbit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
272768
273573
  },
272769
273574
  'created': undefined,
272770
273575
  'info': market,
272771
- };
273576
+ });
272772
273577
  }
272773
273578
  parseBalance(response) {
272774
273579
  const result = {
@@ -276239,7 +277044,7 @@ class wavesexchange extends _abstract_wavesexchange_js__WEBPACK_IMPORTED_MODULE_
276239
277044
  'priceAsset': market['quoteId'],
276240
277045
  };
276241
277046
  if (limit !== undefined) {
276242
- request['limit'] = limit;
277047
+ request['limit'] = Math.min(limit, 100);
276243
277048
  }
276244
277049
  if (since !== undefined) {
276245
277050
  request['timeStart'] = since;
@@ -280092,6 +280897,8 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
280092
280897
  'createStopLimitOrder': false,
280093
280898
  'createStopMarketOrder': false,
280094
280899
  'createStopOrder': false,
280900
+ 'createTrailingAmountOrder': true,
280901
+ 'createTrailingPercentOrder': true,
280095
280902
  'fetchAccounts': true,
280096
280903
  'fetchBalance': true,
280097
280904
  'fetchCanceledOrders': false,
@@ -280807,6 +281614,56 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
280807
281614
  params['createMarketBuyOrderRequiresPrice'] = false;
280808
281615
  return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
280809
281616
  }
281617
+ async createTrailingAmountOrder(symbol, type, side, amount, price = undefined, trailingAmount = undefined, trailingTriggerPrice = undefined, params = {}) {
281618
+ /**
281619
+ * @method
281620
+ * @name createTrailingAmountOrder
281621
+ * @description create a trailing order by providing the symbol, type, side, amount, price and trailingAmount
281622
+ * @param {string} symbol unified symbol of the market to create an order in
281623
+ * @param {string} type 'market' or 'limit'
281624
+ * @param {string} side 'buy' or 'sell'
281625
+ * @param {float} amount how much you want to trade in units of the base currency, or number of contracts
281626
+ * @param {float} [price] the price for the order to be filled at, in units of the quote currency, ignored in market orders
281627
+ * @param {float} trailingAmount the quote amount to trail away from the current market price
281628
+ * @param {float} trailingTriggerPrice the price to activate a trailing order, default uses the price argument
281629
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
281630
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
281631
+ */
281632
+ if (trailingAmount === undefined) {
281633
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' createTrailingAmountOrder() requires a trailingAmount argument');
281634
+ }
281635
+ if (trailingTriggerPrice === undefined) {
281636
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' createTrailingAmountOrder() requires a trailingTriggerPrice argument');
281637
+ }
281638
+ params['trailingAmount'] = trailingAmount;
281639
+ params['trailingTriggerPrice'] = trailingTriggerPrice;
281640
+ return await this.createOrder(symbol, type, side, amount, price, params);
281641
+ }
281642
+ async createTrailingPercentOrder(symbol, type, side, amount, price = undefined, trailingPercent = undefined, trailingTriggerPrice = undefined, params = {}) {
281643
+ /**
281644
+ * @method
281645
+ * @name createTrailingPercentOrder
281646
+ * @description create a trailing order by providing the symbol, type, side, amount, price and trailingPercent
281647
+ * @param {string} symbol unified symbol of the market to create an order in
281648
+ * @param {string} type 'market' or 'limit'
281649
+ * @param {string} side 'buy' or 'sell'
281650
+ * @param {float} amount how much you want to trade in units of the base currency, or number of contracts
281651
+ * @param {float} [price] the price for the order to be filled at, in units of the quote currency, ignored in market orders
281652
+ * @param {float} trailingPercent the percent to trail away from the current market price
281653
+ * @param {float} trailingTriggerPrice the price to activate a trailing order, default uses the price argument
281654
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
281655
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
281656
+ */
281657
+ if (trailingPercent === undefined) {
281658
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' createTrailingPercentOrder() requires a trailingPercent argument');
281659
+ }
281660
+ if (trailingTriggerPrice === undefined) {
281661
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' createTrailingPercentOrder() requires a trailingTriggerPrice argument');
281662
+ }
281663
+ params['trailingPercent'] = trailingPercent;
281664
+ params['trailingTriggerPrice'] = trailingTriggerPrice;
281665
+ return await this.createOrder(symbol, type, side, amount, price, params);
281666
+ }
280810
281667
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
280811
281668
  /**
280812
281669
  * @method
@@ -292275,7 +293132,7 @@ SOFTWARE.
292275
293132
 
292276
293133
  //-----------------------------------------------------------------------------
292277
293134
  // this is updated by vss.js when building
292278
- const version = '4.2.11';
293135
+ const version = '4.2.13';
292279
293136
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
292280
293137
  //-----------------------------------------------------------------------------
292281
293138