ccxt 4.5.4 → 4.5.5

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 (912) hide show
  1. package/README.md +6 -5
  2. package/dist/ccxt.browser.min.js +6 -6
  3. package/dist/cjs/ccxt.js +6 -1
  4. package/dist/cjs/src/abstract/alpaca.js +1 -1
  5. package/dist/cjs/src/abstract/apex.js +1 -1
  6. package/dist/cjs/src/abstract/ascendex.js +1 -1
  7. package/dist/cjs/src/abstract/backpack.js +11 -0
  8. package/dist/cjs/src/abstract/bigone.js +1 -1
  9. package/dist/cjs/src/abstract/binance.js +1 -1
  10. package/dist/cjs/src/abstract/bingx.js +1 -1
  11. package/dist/cjs/src/abstract/bit2c.js +1 -1
  12. package/dist/cjs/src/abstract/bitbank.js +1 -1
  13. package/dist/cjs/src/abstract/bitbns.js +1 -1
  14. package/dist/cjs/src/abstract/bitfinex.js +1 -1
  15. package/dist/cjs/src/abstract/bitflyer.js +1 -1
  16. package/dist/cjs/src/abstract/bitget.js +1 -1
  17. package/dist/cjs/src/abstract/bithumb.js +1 -1
  18. package/dist/cjs/src/abstract/bitmart.js +1 -1
  19. package/dist/cjs/src/abstract/bitmex.js +1 -1
  20. package/dist/cjs/src/abstract/bitopro.js +1 -1
  21. package/dist/cjs/src/abstract/bitrue.js +1 -1
  22. package/dist/cjs/src/abstract/bitso.js +1 -1
  23. package/dist/cjs/src/abstract/bitstamp.js +1 -1
  24. package/dist/cjs/src/abstract/bitteam.js +1 -1
  25. package/dist/cjs/src/abstract/bittrade.js +1 -1
  26. package/dist/cjs/src/abstract/bitvavo.js +1 -1
  27. package/dist/cjs/src/abstract/blockchaincom.js +1 -1
  28. package/dist/cjs/src/abstract/blofin.js +1 -1
  29. package/dist/cjs/src/abstract/btcalpha.js +1 -1
  30. package/dist/cjs/src/abstract/btcbox.js +1 -1
  31. package/dist/cjs/src/abstract/btcmarkets.js +1 -1
  32. package/dist/cjs/src/abstract/btcturk.js +1 -1
  33. package/dist/cjs/src/abstract/bybit.js +1 -1
  34. package/dist/cjs/src/abstract/cex.js +1 -1
  35. package/dist/cjs/src/abstract/coinbase.js +1 -1
  36. package/dist/cjs/src/abstract/coinbaseexchange.js +1 -1
  37. package/dist/cjs/src/abstract/coinbaseinternational.js +1 -1
  38. package/dist/cjs/src/abstract/coincatch.js +1 -1
  39. package/dist/cjs/src/abstract/coincheck.js +1 -1
  40. package/dist/cjs/src/abstract/coinex.js +1 -1
  41. package/dist/cjs/src/abstract/coinmate.js +1 -1
  42. package/dist/cjs/src/abstract/coinmetro.js +1 -1
  43. package/dist/cjs/src/abstract/coinone.js +1 -1
  44. package/dist/cjs/src/abstract/coinsph.js +1 -1
  45. package/dist/cjs/src/abstract/coinspot.js +1 -1
  46. package/dist/cjs/src/abstract/cryptocom.js +1 -1
  47. package/dist/cjs/src/abstract/cryptomus.js +1 -1
  48. package/dist/cjs/src/abstract/defx.js +1 -1
  49. package/dist/cjs/src/abstract/delta.js +1 -1
  50. package/dist/cjs/src/abstract/deribit.js +1 -1
  51. package/dist/cjs/src/abstract/derive.js +1 -1
  52. package/dist/cjs/src/abstract/digifinex.js +1 -1
  53. package/dist/cjs/src/abstract/exmo.js +1 -1
  54. package/dist/cjs/src/abstract/foxbit.js +1 -1
  55. package/dist/cjs/src/abstract/gate.js +1 -1
  56. package/dist/cjs/src/abstract/gemini.js +1 -1
  57. package/dist/cjs/src/abstract/hashkey.js +1 -1
  58. package/dist/cjs/src/abstract/hibachi.js +1 -1
  59. package/dist/cjs/src/abstract/hitbtc.js +1 -1
  60. package/dist/cjs/src/abstract/hollaex.js +1 -1
  61. package/dist/cjs/src/abstract/htx.js +1 -1
  62. package/dist/cjs/src/abstract/hyperliquid.js +1 -1
  63. package/dist/cjs/src/abstract/independentreserve.js +1 -1
  64. package/dist/cjs/src/abstract/indodax.js +1 -1
  65. package/dist/cjs/src/abstract/kraken.js +1 -1
  66. package/dist/cjs/src/abstract/krakenfutures.js +1 -1
  67. package/dist/cjs/src/abstract/kucoin.js +1 -1
  68. package/dist/cjs/src/abstract/kucoinfutures.js +1 -1
  69. package/dist/cjs/src/abstract/latoken.js +1 -1
  70. package/dist/cjs/src/abstract/lbank.js +1 -1
  71. package/dist/cjs/src/abstract/luno.js +1 -1
  72. package/dist/cjs/src/abstract/mercado.js +1 -1
  73. package/dist/cjs/src/abstract/mexc.js +1 -1
  74. package/dist/cjs/src/abstract/modetrade.js +1 -1
  75. package/dist/cjs/src/abstract/ndax.js +1 -1
  76. package/dist/cjs/src/abstract/novadax.js +1 -1
  77. package/dist/cjs/src/abstract/oceanex.js +1 -1
  78. package/dist/cjs/src/abstract/okcoin.js +1 -1
  79. package/dist/cjs/src/abstract/okx.js +1 -1
  80. package/dist/cjs/src/abstract/onetrading.js +1 -1
  81. package/dist/cjs/src/abstract/oxfun.js +1 -1
  82. package/dist/cjs/src/abstract/p2b.js +1 -1
  83. package/dist/cjs/src/abstract/paradex.js +1 -1
  84. package/dist/cjs/src/abstract/paymium.js +1 -1
  85. package/dist/cjs/src/abstract/phemex.js +1 -1
  86. package/dist/cjs/src/abstract/poloniex.js +1 -1
  87. package/dist/cjs/src/abstract/probit.js +1 -1
  88. package/dist/cjs/src/abstract/timex.js +1 -1
  89. package/dist/cjs/src/abstract/tokocrypto.js +1 -1
  90. package/dist/cjs/src/abstract/tradeogre.js +1 -1
  91. package/dist/cjs/src/abstract/upbit.js +1 -1
  92. package/dist/cjs/src/abstract/wavesexchange.js +1 -1
  93. package/dist/cjs/src/abstract/whitebit.js +1 -1
  94. package/dist/cjs/src/abstract/woo.js +1 -1
  95. package/dist/cjs/src/abstract/woofipro.js +1 -1
  96. package/dist/cjs/src/abstract/xt.js +1 -1
  97. package/dist/cjs/src/abstract/yobit.js +1 -1
  98. package/dist/cjs/src/abstract/zaif.js +1 -1
  99. package/dist/cjs/src/abstract/zonda.js +1 -1
  100. package/dist/cjs/src/alpaca.js +1 -1
  101. package/dist/cjs/src/apex.js +1 -1
  102. package/dist/cjs/src/ascendex.js +1 -1
  103. package/dist/cjs/src/backpack.js +2280 -0
  104. package/dist/cjs/src/base/Exchange.js +97 -60
  105. package/dist/cjs/src/base/Precise.js +0 -6
  106. package/dist/cjs/src/base/errors.js +0 -6
  107. package/dist/cjs/src/base/functions/crypto.js +1 -1
  108. package/dist/cjs/src/base/functions/encode.js +1 -1
  109. package/dist/cjs/src/base/functions/misc.js +0 -1
  110. package/dist/cjs/src/base/functions/number.js +0 -6
  111. package/dist/cjs/src/base/functions/platform.js +0 -6
  112. package/dist/cjs/src/base/functions/rsa.js +0 -1
  113. package/dist/cjs/src/base/functions/string.js +0 -6
  114. package/dist/cjs/src/base/functions/throttle.js +1 -1
  115. package/dist/cjs/src/base/functions/time.js +0 -6
  116. package/dist/cjs/src/base/functions/totp.js +0 -1
  117. package/dist/cjs/src/base/functions/type.js +0 -6
  118. package/dist/cjs/src/base/functions.js +1 -1
  119. package/dist/cjs/src/base/ws/Cache.js +0 -6
  120. package/dist/cjs/src/base/ws/Client.js +0 -1
  121. package/dist/cjs/src/base/ws/Future.js +1 -1
  122. package/dist/cjs/src/base/ws/OrderBook.js +1 -1
  123. package/dist/cjs/src/base/ws/OrderBookSide.js +0 -6
  124. package/dist/cjs/src/base/ws/WsClient.js +1 -1
  125. package/dist/cjs/src/bequant.js +1 -1
  126. package/dist/cjs/src/bigone.js +1 -1
  127. package/dist/cjs/src/binance.js +1 -1
  128. package/dist/cjs/src/binancecoinm.js +1 -1
  129. package/dist/cjs/src/binanceus.js +1 -1
  130. package/dist/cjs/src/binanceusdm.js +1 -1
  131. package/dist/cjs/src/bingx.js +1 -1
  132. package/dist/cjs/src/bit2c.js +1 -1
  133. package/dist/cjs/src/bitbank.js +2 -2
  134. package/dist/cjs/src/bitbns.js +1 -1
  135. package/dist/cjs/src/bitfinex.js +1 -1
  136. package/dist/cjs/src/bitflyer.js +1 -1
  137. package/dist/cjs/src/bitget.js +57 -10
  138. package/dist/cjs/src/bithumb.js +1 -1
  139. package/dist/cjs/src/bitmart.js +1 -1
  140. package/dist/cjs/src/bitmex.js +1 -1
  141. package/dist/cjs/src/bitopro.js +1 -1
  142. package/dist/cjs/src/bitrue.js +1 -1
  143. package/dist/cjs/src/bitso.js +1 -1
  144. package/dist/cjs/src/bitstamp.js +1 -1
  145. package/dist/cjs/src/bitteam.js +1 -1
  146. package/dist/cjs/src/bittrade.js +1 -1
  147. package/dist/cjs/src/blockchaincom.js +1 -1
  148. package/dist/cjs/src/blofin.js +1 -1
  149. package/dist/cjs/src/btcalpha.js +1 -1
  150. package/dist/cjs/src/btcbox.js +1 -1
  151. package/dist/cjs/src/btcmarkets.js +1 -1
  152. package/dist/cjs/src/btcturk.js +1 -1
  153. package/dist/cjs/src/bybit.js +1 -1
  154. package/dist/cjs/src/cex.js +1 -1
  155. package/dist/cjs/src/coinbaseadvanced.js +1 -1
  156. package/dist/cjs/src/coincatch.js +2 -2
  157. package/dist/cjs/src/coincheck.js +1 -1
  158. package/dist/cjs/src/coinex.js +1 -1
  159. package/dist/cjs/src/coinmate.js +1 -1
  160. package/dist/cjs/src/coinmetro.js +12 -1
  161. package/dist/cjs/src/coinone.js +1 -1
  162. package/dist/cjs/src/coinsph.js +0 -1
  163. package/dist/cjs/src/coinspot.js +1 -1
  164. package/dist/cjs/src/cryptocom.js +1 -1
  165. package/dist/cjs/src/cryptomus.js +1 -1
  166. package/dist/cjs/src/defx.js +1 -1
  167. package/dist/cjs/src/delta.js +1 -1
  168. package/dist/cjs/src/deribit.js +1 -1
  169. package/dist/cjs/src/derive.js +1 -1
  170. package/dist/cjs/src/digifinex.js +1 -1
  171. package/dist/cjs/src/exmo.js +1 -1
  172. package/dist/cjs/src/fmfwio.js +1 -1
  173. package/dist/cjs/src/foxbit.js +1 -1
  174. package/dist/cjs/src/gate.js +8 -2
  175. package/dist/cjs/src/gateio.js +1 -1
  176. package/dist/cjs/src/gemini.js +11 -6
  177. package/dist/cjs/src/hashkey.js +1 -1
  178. package/dist/cjs/src/hibachi.js +1 -1
  179. package/dist/cjs/src/hitbtc.js +0 -1
  180. package/dist/cjs/src/hollaex.js +1 -1
  181. package/dist/cjs/src/htx.js +1 -1
  182. package/dist/cjs/src/huobi.js +1 -1
  183. package/dist/cjs/src/hyperliquid.js +1 -1
  184. package/dist/cjs/src/independentreserve.js +1 -1
  185. package/dist/cjs/src/indodax.js +1 -1
  186. package/dist/cjs/src/kraken.js +1 -1
  187. package/dist/cjs/src/krakenfutures.js +2 -2
  188. package/dist/cjs/src/kucoin.js +1 -1
  189. package/dist/cjs/src/kucoinfutures.js +52 -4
  190. package/dist/cjs/src/latoken.js +1 -1
  191. package/dist/cjs/src/lbank.js +1 -1
  192. package/dist/cjs/src/luno.js +1 -1
  193. package/dist/cjs/src/mercado.js +1 -1
  194. package/dist/cjs/src/mexc.js +1 -1
  195. package/dist/cjs/src/modetrade.js +1 -1
  196. package/dist/cjs/src/myokx.js +1 -1
  197. package/dist/cjs/src/ndax.js +1 -1
  198. package/dist/cjs/src/novadax.js +1 -1
  199. package/dist/cjs/src/oceanex.js +1 -1
  200. package/dist/cjs/src/okcoin.js +1 -1
  201. package/dist/cjs/src/okx.js +25 -15
  202. package/dist/cjs/src/okxus.js +1 -1
  203. package/dist/cjs/src/onetrading.js +161 -66
  204. package/dist/cjs/src/oxfun.js +1 -1
  205. package/dist/cjs/src/p2b.js +1 -1
  206. package/dist/cjs/src/paradex.js +1 -1
  207. package/dist/cjs/src/paymium.js +1 -1
  208. package/dist/cjs/src/phemex.js +15 -9
  209. package/dist/cjs/src/poloniex.js +1 -1
  210. package/dist/cjs/src/pro/alpaca.js +1 -1
  211. package/dist/cjs/src/pro/apex.js +1 -1
  212. package/dist/cjs/src/pro/ascendex.js +1 -1
  213. package/dist/cjs/src/pro/backpack.js +1325 -0
  214. package/dist/cjs/src/pro/bequant.js +1 -1
  215. package/dist/cjs/src/pro/binance.js +9 -0
  216. package/dist/cjs/src/pro/binancecoinm.js +1 -1
  217. package/dist/cjs/src/pro/binanceus.js +1 -1
  218. package/dist/cjs/src/pro/binanceusdm.js +1 -1
  219. package/dist/cjs/src/pro/bingx.js +1 -1
  220. package/dist/cjs/src/pro/bitfinex.js +1 -1
  221. package/dist/cjs/src/pro/bitget.js +41 -12
  222. package/dist/cjs/src/pro/bithumb.js +1 -1
  223. package/dist/cjs/src/pro/bitmart.js +1 -1
  224. package/dist/cjs/src/pro/bitmex.js +1 -1
  225. package/dist/cjs/src/pro/bitrue.js +1 -1
  226. package/dist/cjs/src/pro/bitstamp.js +1 -1
  227. package/dist/cjs/src/pro/bitvavo.js +1 -1
  228. package/dist/cjs/src/pro/blockchaincom.js +1 -1
  229. package/dist/cjs/src/pro/blofin.js +1 -1
  230. package/dist/cjs/src/pro/bybit.js +4 -1
  231. package/dist/cjs/src/pro/cex.js +1 -1
  232. package/dist/cjs/src/pro/coinbase.js +227 -1
  233. package/dist/cjs/src/pro/coinbaseadvanced.js +1 -1
  234. package/dist/cjs/src/pro/coinbaseexchange.js +1 -1
  235. package/dist/cjs/src/pro/coinbaseinternational.js +1 -1
  236. package/dist/cjs/src/pro/coincatch.js +1 -1
  237. package/dist/cjs/src/pro/coincheck.js +1 -1
  238. package/dist/cjs/src/pro/coinex.js +1 -1
  239. package/dist/cjs/src/pro/coinone.js +1 -1
  240. package/dist/cjs/src/pro/cryptocom.js +1 -1
  241. package/dist/cjs/src/pro/defx.js +1 -1
  242. package/dist/cjs/src/pro/deribit.js +1 -1
  243. package/dist/cjs/src/pro/exmo.js +1 -1
  244. package/dist/cjs/src/pro/gate.js +1 -1
  245. package/dist/cjs/src/pro/gateio.js +1 -1
  246. package/dist/cjs/src/pro/gemini.js +1 -1
  247. package/dist/cjs/src/pro/hashkey.js +1 -1
  248. package/dist/cjs/src/pro/hitbtc.js +1 -1
  249. package/dist/cjs/src/pro/hollaex.js +1 -1
  250. package/dist/cjs/src/pro/htx.js +1 -1
  251. package/dist/cjs/src/pro/huobi.js +1 -1
  252. package/dist/cjs/src/pro/hyperliquid.js +1 -1
  253. package/dist/cjs/src/pro/independentreserve.js +1 -1
  254. package/dist/cjs/src/pro/kraken.js +1 -1
  255. package/dist/cjs/src/pro/krakenfutures.js +1 -1
  256. package/dist/cjs/src/pro/kucoin.js +1 -1
  257. package/dist/cjs/src/pro/kucoinfutures.js +1 -1
  258. package/dist/cjs/src/pro/lbank.js +0 -1
  259. package/dist/cjs/src/pro/luno.js +1 -1
  260. package/dist/cjs/src/pro/mexc.js +1 -1
  261. package/dist/cjs/src/pro/myokx.js +1 -1
  262. package/dist/cjs/src/pro/ndax.js +1 -1
  263. package/dist/cjs/src/pro/okcoin.js +1 -1
  264. package/dist/cjs/src/pro/okx.js +1 -1
  265. package/dist/cjs/src/pro/okxus.js +1 -1
  266. package/dist/cjs/src/pro/onetrading.js +1 -1
  267. package/dist/cjs/src/pro/oxfun.js +1 -1
  268. package/dist/cjs/src/pro/p2b.js +1 -1
  269. package/dist/cjs/src/pro/paradex.js +1 -1
  270. package/dist/cjs/src/pro/phemex.js +1 -1
  271. package/dist/cjs/src/pro/poloniex.js +1 -1
  272. package/dist/cjs/src/pro/probit.js +1 -1
  273. package/dist/cjs/src/pro/tradeogre.js +1 -1
  274. package/dist/cjs/src/pro/upbit.js +1 -1
  275. package/dist/cjs/src/pro/whitebit.js +1 -1
  276. package/dist/cjs/src/pro/xt.js +1 -1
  277. package/dist/cjs/src/probit.js +1 -1
  278. package/dist/cjs/src/protobuf/mexc/compiled.cjs.js +1 -0
  279. package/dist/cjs/src/static_dependencies/ethers/abi-coder.js +0 -6
  280. package/dist/cjs/src/static_dependencies/ethers/address/address.js +1 -1
  281. package/dist/cjs/src/static_dependencies/ethers/coders/abstract-coder.js +0 -6
  282. package/dist/cjs/src/static_dependencies/ethers/coders/address.js +0 -1
  283. package/dist/cjs/src/static_dependencies/ethers/coders/anonymous.js +0 -1
  284. package/dist/cjs/src/static_dependencies/ethers/coders/array.js +0 -1
  285. package/dist/cjs/src/static_dependencies/ethers/coders/boolean.js +0 -1
  286. package/dist/cjs/src/static_dependencies/ethers/coders/bytes.js +0 -1
  287. package/dist/cjs/src/static_dependencies/ethers/coders/fixed-bytes.js +0 -1
  288. package/dist/cjs/src/static_dependencies/ethers/coders/null.js +0 -1
  289. package/dist/cjs/src/static_dependencies/ethers/coders/number.js +0 -1
  290. package/dist/cjs/src/static_dependencies/ethers/coders/string.js +0 -1
  291. package/dist/cjs/src/static_dependencies/ethers/coders/tuple.js +0 -1
  292. package/dist/cjs/src/static_dependencies/ethers/fragments.js +0 -6
  293. package/dist/cjs/src/static_dependencies/ethers/hash/typed-data.js +0 -6
  294. package/dist/cjs/src/static_dependencies/ethers/index.js +10 -1
  295. package/dist/cjs/src/static_dependencies/ethers/interface.js +0 -6
  296. package/dist/cjs/src/static_dependencies/ethers/typed.js +0 -6
  297. package/dist/cjs/src/static_dependencies/ethers/utils/base58.js +13 -1
  298. package/dist/cjs/src/static_dependencies/ethers/utils/data.js +6 -1
  299. package/dist/cjs/src/static_dependencies/ethers/utils/errors.js +9 -1
  300. package/dist/cjs/src/static_dependencies/ethers/utils/events.js +0 -6
  301. package/dist/cjs/src/static_dependencies/ethers/utils/fixednumber.js +0 -6
  302. package/dist/cjs/src/static_dependencies/ethers/utils/index.js +7 -1
  303. package/dist/cjs/src/static_dependencies/ethers/utils/maths.js +5 -1
  304. package/dist/cjs/src/static_dependencies/ethers/utils/properties.js +0 -6
  305. package/dist/cjs/src/static_dependencies/ethers/utils/utf8.js +8 -1
  306. package/dist/cjs/src/static_dependencies/fflake/browser.js +1 -1
  307. package/dist/cjs/src/static_dependencies/jsencrypt/JSEncrypt.js +0 -1
  308. package/dist/cjs/src/static_dependencies/jsencrypt/JSEncryptRSAKey.js +0 -1
  309. package/dist/cjs/src/static_dependencies/jsencrypt/lib/asn1js/asn1.js +1 -1
  310. package/dist/cjs/src/static_dependencies/jsencrypt/lib/asn1js/base64.js +0 -6
  311. package/dist/cjs/src/static_dependencies/jsencrypt/lib/asn1js/hex.js +0 -6
  312. package/dist/cjs/src/static_dependencies/jsencrypt/lib/asn1js/int10.js +0 -6
  313. package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsbn/base64.js +0 -1
  314. package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.js +1 -1
  315. package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsbn/prng4.js +0 -6
  316. package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsbn/rng.js +1 -1
  317. package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsbn/rsa.js +1 -1
  318. package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsbn/util.js +0 -6
  319. package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsrsasign/asn1-1.0.js +1 -1
  320. package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsrsasign/yahoo.js +0 -6
  321. package/dist/cjs/src/static_dependencies/messagepack/msgpack.js +0 -6
  322. package/dist/cjs/src/static_dependencies/noble-curves/_shortw_utils.js +1 -1
  323. package/dist/cjs/src/static_dependencies/noble-curves/abstract/curve.js +1 -1
  324. package/dist/cjs/src/static_dependencies/noble-curves/abstract/edwards.js +1 -1
  325. package/dist/cjs/src/static_dependencies/noble-curves/abstract/hash-to-curve.js +0 -1
  326. package/dist/cjs/src/static_dependencies/noble-curves/abstract/modular.js +1 -1
  327. package/dist/cjs/src/static_dependencies/noble-curves/abstract/montgomery.js +1 -1
  328. package/dist/cjs/src/static_dependencies/noble-curves/abstract/poseidon.js +1 -1
  329. package/dist/cjs/src/static_dependencies/noble-curves/abstract/utils.js +0 -6
  330. package/dist/cjs/src/static_dependencies/noble-curves/abstract/weierstrass.js +1 -1
  331. package/dist/cjs/src/static_dependencies/noble-curves/ed25519.js +1 -1
  332. package/dist/cjs/src/static_dependencies/noble-curves/p256.js +1 -1
  333. package/dist/cjs/src/static_dependencies/noble-curves/secp256k1.js +1 -1
  334. package/dist/cjs/src/static_dependencies/noble-hashes/_assert.js +0 -6
  335. package/dist/cjs/src/static_dependencies/noble-hashes/_sha2.js +0 -1
  336. package/dist/cjs/src/static_dependencies/noble-hashes/_u64.js +0 -6
  337. package/dist/cjs/src/static_dependencies/noble-hashes/crypto.js +0 -6
  338. package/dist/cjs/src/static_dependencies/noble-hashes/hmac.js +0 -1
  339. package/dist/cjs/src/static_dependencies/noble-hashes/md5.js +0 -1
  340. package/dist/cjs/src/static_dependencies/noble-hashes/sha1.js +0 -1
  341. package/dist/cjs/src/static_dependencies/noble-hashes/sha256.js +0 -1
  342. package/dist/cjs/src/static_dependencies/noble-hashes/sha3.js +0 -1
  343. package/dist/cjs/src/static_dependencies/noble-hashes/sha512.js +0 -1
  344. package/dist/cjs/src/static_dependencies/noble-hashes/utils.js +1 -1
  345. package/dist/cjs/src/static_dependencies/node-fetch/body.js +5 -1
  346. package/dist/cjs/src/static_dependencies/node-fetch/errors/abort-error.js +0 -1
  347. package/dist/cjs/src/static_dependencies/node-fetch/errors/base.js +0 -6
  348. package/dist/cjs/src/static_dependencies/node-fetch/errors/fetch-error.js +0 -1
  349. package/dist/cjs/src/static_dependencies/node-fetch/headers.js +5 -1
  350. package/dist/cjs/src/static_dependencies/node-fetch/index.js +7 -1
  351. package/dist/cjs/src/static_dependencies/node-fetch/request.js +7 -1
  352. package/dist/cjs/src/static_dependencies/node-fetch/response.js +5 -1
  353. package/dist/cjs/src/static_dependencies/node-fetch/utils/get-search.js +0 -6
  354. package/dist/cjs/src/static_dependencies/node-fetch/utils/is-redirect.js +0 -6
  355. package/dist/cjs/src/static_dependencies/node-fetch/utils/is.js +0 -6
  356. package/dist/cjs/src/static_dependencies/node-fetch/utils/referrer.js +0 -1
  357. package/dist/cjs/src/static_dependencies/proxies/agent-base/index.js +0 -1
  358. package/dist/cjs/src/static_dependencies/proxies/http-proxy-agent/index.js +0 -1
  359. package/dist/cjs/src/static_dependencies/proxies/https-proxy-agent/index.js +0 -1
  360. package/dist/cjs/src/static_dependencies/proxies/https-proxy-agent/parse-proxy-response.js +0 -6
  361. package/dist/cjs/src/static_dependencies/scure-base/index.js +0 -6
  362. package/dist/cjs/src/static_dependencies/scure-starknet/index.js +1 -1
  363. package/dist/cjs/src/static_dependencies/starknet/constants.js +1 -1
  364. package/dist/cjs/src/static_dependencies/starknet/types/calldata.js +0 -6
  365. package/dist/cjs/src/static_dependencies/starknet/types/lib/contract/abi.js +0 -6
  366. package/dist/cjs/src/static_dependencies/starknet/types/lib/contract/index.js +0 -6
  367. package/dist/cjs/src/static_dependencies/starknet/types/lib/index.js +0 -6
  368. package/dist/cjs/src/static_dependencies/starknet/types/typedData.js +0 -6
  369. package/dist/cjs/src/static_dependencies/starknet/utils/assert.js +0 -6
  370. package/dist/cjs/src/static_dependencies/starknet/utils/cairoDataTypes/felt.js +1 -1
  371. package/dist/cjs/src/static_dependencies/starknet/utils/cairoDataTypes/uint256.js +1 -1
  372. package/dist/cjs/src/static_dependencies/starknet/utils/cairoDataTypes/uint512.js +1 -1
  373. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/byteArray.js +0 -1
  374. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/cairo.js +0 -1
  375. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/enum/CairoCustomEnum.js +0 -6
  376. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/enum/CairoOption.js +0 -6
  377. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/enum/CairoResult.js +0 -6
  378. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/formatter.js +0 -1
  379. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/index.js +1 -1
  380. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/parser/index.js +0 -1
  381. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/parser/parser-0-1.1.0.js +0 -1
  382. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/parser/parser-2.0.0.js +0 -6
  383. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/propertyOrder.js +0 -1
  384. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/requestParser.js +0 -1
  385. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/responseParser.js +0 -1
  386. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/tuple.js +1 -1
  387. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/validate.js +4 -1
  388. package/dist/cjs/src/static_dependencies/starknet/utils/encode.js +0 -1
  389. package/dist/cjs/src/static_dependencies/starknet/utils/hash/classHash.js +3 -1
  390. package/dist/cjs/src/static_dependencies/starknet/utils/merkle.js +0 -1
  391. package/dist/cjs/src/static_dependencies/starknet/utils/num.js +0 -1
  392. package/dist/cjs/src/static_dependencies/starknet/utils/selector.js +0 -1
  393. package/dist/cjs/src/static_dependencies/starknet/utils/shortString.js +0 -1
  394. package/dist/cjs/src/static_dependencies/starknet/utils/typedData.js +1 -1
  395. package/dist/cjs/src/static_dependencies/watchable/src/unpromise.js +0 -6
  396. package/dist/cjs/src/static_dependencies/zklink/zklink-sdk-web.js +0 -6
  397. package/dist/cjs/src/timex.js +0 -1
  398. package/dist/cjs/src/tokocrypto.js +1 -1
  399. package/dist/cjs/src/tradeogre.js +1 -1
  400. package/dist/cjs/src/upbit.js +1 -1
  401. package/dist/cjs/src/wavesexchange.js +1 -1
  402. package/dist/cjs/src/whitebit.js +1 -1
  403. package/dist/cjs/src/woo.js +1 -1
  404. package/dist/cjs/src/woofipro.js +1 -1
  405. package/dist/cjs/src/xt.js +10 -1
  406. package/dist/cjs/src/yobit.js +10 -1
  407. package/dist/cjs/src/zaif.js +1 -1
  408. package/dist/cjs/src/zonda.js +1 -1
  409. package/js/ccxt.d.ts +8 -2
  410. package/js/ccxt.js +6 -8
  411. package/js/src/abstract/alpaca.js +0 -6
  412. package/js/src/abstract/apex.js +0 -6
  413. package/js/src/abstract/ascendex.js +0 -6
  414. package/js/src/abstract/backpack.d.ts +63 -0
  415. package/js/src/abstract/backpack.js +5 -0
  416. package/js/src/abstract/bequant.js +0 -6
  417. package/js/src/abstract/bigone.js +0 -6
  418. package/js/src/abstract/binance.js +0 -6
  419. package/js/src/abstract/binancecoinm.js +0 -6
  420. package/js/src/abstract/binanceus.js +0 -6
  421. package/js/src/abstract/binanceusdm.js +0 -6
  422. package/js/src/abstract/bingx.js +0 -6
  423. package/js/src/abstract/bit2c.js +0 -6
  424. package/js/src/abstract/bitbank.js +0 -6
  425. package/js/src/abstract/bitbns.js +0 -6
  426. package/js/src/abstract/bitfinex.js +0 -6
  427. package/js/src/abstract/bitflyer.js +0 -6
  428. package/js/src/abstract/bitget.js +0 -6
  429. package/js/src/abstract/bithumb.js +0 -6
  430. package/js/src/abstract/bitmart.js +0 -6
  431. package/js/src/abstract/bitmex.js +0 -6
  432. package/js/src/abstract/bitopro.js +0 -6
  433. package/js/src/abstract/bitrue.js +0 -6
  434. package/js/src/abstract/bitso.js +0 -6
  435. package/js/src/abstract/bitstamp.js +0 -6
  436. package/js/src/abstract/bitteam.js +0 -6
  437. package/js/src/abstract/bittrade.js +0 -6
  438. package/js/src/abstract/bitvavo.js +0 -6
  439. package/js/src/abstract/blockchaincom.js +0 -6
  440. package/js/src/abstract/blofin.js +0 -6
  441. package/js/src/abstract/btcalpha.js +0 -6
  442. package/js/src/abstract/btcbox.js +0 -6
  443. package/js/src/abstract/btcmarkets.js +0 -6
  444. package/js/src/abstract/btcturk.js +0 -6
  445. package/js/src/abstract/bybit.js +0 -6
  446. package/js/src/abstract/cex.js +0 -6
  447. package/js/src/abstract/coinbase.js +0 -6
  448. package/js/src/abstract/coinbaseadvanced.js +0 -6
  449. package/js/src/abstract/coinbaseexchange.js +0 -6
  450. package/js/src/abstract/coinbaseinternational.js +0 -6
  451. package/js/src/abstract/coincatch.js +0 -6
  452. package/js/src/abstract/coincheck.js +0 -6
  453. package/js/src/abstract/coinex.js +0 -6
  454. package/js/src/abstract/coinmate.js +0 -6
  455. package/js/src/abstract/coinmetro.js +0 -6
  456. package/js/src/abstract/coinone.js +0 -6
  457. package/js/src/abstract/coinsph.js +0 -6
  458. package/js/src/abstract/coinspot.js +0 -6
  459. package/js/src/abstract/cryptocom.js +0 -6
  460. package/js/src/abstract/cryptomus.js +0 -6
  461. package/js/src/abstract/defx.js +0 -6
  462. package/js/src/abstract/delta.js +0 -6
  463. package/js/src/abstract/deribit.js +0 -6
  464. package/js/src/abstract/derive.js +0 -6
  465. package/js/src/abstract/digifinex.js +0 -6
  466. package/js/src/abstract/exmo.js +0 -6
  467. package/js/src/abstract/fmfwio.js +0 -6
  468. package/js/src/abstract/foxbit.js +0 -6
  469. package/js/src/abstract/gate.js +0 -6
  470. package/js/src/abstract/gateio.js +0 -6
  471. package/js/src/abstract/gemini.js +0 -6
  472. package/js/src/abstract/hashkey.js +0 -6
  473. package/js/src/abstract/hibachi.js +0 -6
  474. package/js/src/abstract/hitbtc.js +0 -6
  475. package/js/src/abstract/hollaex.js +0 -6
  476. package/js/src/abstract/htx.js +0 -6
  477. package/js/src/abstract/huobi.js +0 -6
  478. package/js/src/abstract/hyperliquid.js +0 -6
  479. package/js/src/abstract/independentreserve.js +0 -6
  480. package/js/src/abstract/indodax.js +0 -6
  481. package/js/src/abstract/kraken.js +0 -6
  482. package/js/src/abstract/krakenfutures.js +0 -6
  483. package/js/src/abstract/kucoin.js +0 -6
  484. package/js/src/abstract/kucoinfutures.d.ts +1 -0
  485. package/js/src/abstract/kucoinfutures.js +0 -6
  486. package/js/src/abstract/latoken.js +0 -6
  487. package/js/src/abstract/lbank.js +0 -6
  488. package/js/src/abstract/luno.js +0 -6
  489. package/js/src/abstract/mercado.js +0 -6
  490. package/js/src/abstract/mexc.js +0 -6
  491. package/js/src/abstract/modetrade.js +0 -6
  492. package/js/src/abstract/myokx.js +0 -6
  493. package/js/src/abstract/ndax.js +0 -6
  494. package/js/src/abstract/novadax.js +0 -6
  495. package/js/src/abstract/oceanex.js +0 -6
  496. package/js/src/abstract/okcoin.js +0 -6
  497. package/js/src/abstract/okx.js +0 -6
  498. package/js/src/abstract/okxus.js +0 -6
  499. package/js/src/abstract/onetrading.js +0 -6
  500. package/js/src/abstract/oxfun.js +0 -6
  501. package/js/src/abstract/p2b.js +0 -6
  502. package/js/src/abstract/paradex.js +0 -6
  503. package/js/src/abstract/paymium.js +0 -6
  504. package/js/src/abstract/phemex.d.ts +1 -1
  505. package/js/src/abstract/phemex.js +0 -6
  506. package/js/src/abstract/poloniex.js +0 -6
  507. package/js/src/abstract/probit.js +0 -6
  508. package/js/src/abstract/timex.js +0 -6
  509. package/js/src/abstract/tokocrypto.js +0 -6
  510. package/js/src/abstract/tradeogre.js +0 -6
  511. package/js/src/abstract/upbit.js +0 -6
  512. package/js/src/abstract/wavesexchange.js +0 -6
  513. package/js/src/abstract/whitebit.js +0 -6
  514. package/js/src/abstract/woo.js +0 -6
  515. package/js/src/abstract/woofipro.js +0 -6
  516. package/js/src/abstract/xt.js +0 -6
  517. package/js/src/abstract/yobit.js +0 -6
  518. package/js/src/abstract/zaif.js +0 -6
  519. package/js/src/abstract/zonda.js +0 -6
  520. package/js/src/alpaca.js +0 -6
  521. package/js/src/apex.js +0 -6
  522. package/js/src/ascendex.js +0 -6
  523. package/js/src/backpack.d.ts +371 -0
  524. package/js/src/backpack.js +2273 -0
  525. package/js/src/base/Exchange.d.ts +39 -40
  526. package/js/src/base/Exchange.js +102 -70
  527. package/js/src/base/Precise.js +0 -6
  528. package/js/src/base/errorHierarchy.js +0 -6
  529. package/js/src/base/errors.js +0 -6
  530. package/js/src/base/functions/crypto.js +0 -6
  531. package/js/src/base/functions/encode.js +0 -6
  532. package/js/src/base/functions/generic.js +0 -6
  533. package/js/src/base/functions/misc.js +0 -6
  534. package/js/src/base/functions/number.js +0 -6
  535. package/js/src/base/functions/platform.js +0 -6
  536. package/js/src/base/functions/rsa.js +0 -6
  537. package/js/src/base/functions/string.js +0 -6
  538. package/js/src/base/functions/throttle.js +0 -6
  539. package/js/src/base/functions/time.js +0 -6
  540. package/js/src/base/functions/totp.js +0 -6
  541. package/js/src/base/functions/type.js +0 -6
  542. package/js/src/base/functions.js +0 -6
  543. package/js/src/base/types.d.ts +1 -3
  544. package/js/src/base/types.js +0 -6
  545. package/js/src/base/ws/Cache.js +0 -6
  546. package/js/src/base/ws/Client.js +0 -6
  547. package/js/src/base/ws/Future.js +0 -6
  548. package/js/src/base/ws/OrderBook.js +0 -6
  549. package/js/src/base/ws/OrderBookSide.js +0 -6
  550. package/js/src/base/ws/WsClient.js +0 -6
  551. package/js/src/base/ws/functions.js +0 -6
  552. package/js/src/bequant.js +0 -6
  553. package/js/src/bigone.js +0 -6
  554. package/js/src/binance.d.ts +1 -1
  555. package/js/src/binance.js +0 -6
  556. package/js/src/binancecoinm.js +0 -6
  557. package/js/src/binanceus.js +0 -6
  558. package/js/src/binanceusdm.js +0 -6
  559. package/js/src/bingx.js +0 -6
  560. package/js/src/bit2c.js +0 -6
  561. package/js/src/bitbank.js +1 -7
  562. package/js/src/bitbns.js +0 -6
  563. package/js/src/bitfinex.js +0 -6
  564. package/js/src/bitflyer.js +0 -6
  565. package/js/src/bitget.d.ts +3 -1
  566. package/js/src/bitget.js +56 -15
  567. package/js/src/bithumb.js +0 -6
  568. package/js/src/bitmart.js +0 -6
  569. package/js/src/bitmex.js +0 -6
  570. package/js/src/bitopro.js +0 -6
  571. package/js/src/bitrue.js +0 -6
  572. package/js/src/bitso.js +0 -6
  573. package/js/src/bitstamp.js +0 -6
  574. package/js/src/bitteam.js +0 -6
  575. package/js/src/bittrade.js +0 -6
  576. package/js/src/bitvavo.js +0 -6
  577. package/js/src/blockchaincom.js +0 -6
  578. package/js/src/blofin.js +0 -6
  579. package/js/src/btcalpha.js +0 -6
  580. package/js/src/btcbox.js +0 -6
  581. package/js/src/btcmarkets.js +0 -6
  582. package/js/src/btcturk.js +0 -6
  583. package/js/src/bybit.js +0 -6
  584. package/js/src/cex.js +0 -6
  585. package/js/src/coinbase.d.ts +1 -1
  586. package/js/src/coinbase.js +0 -6
  587. package/js/src/coinbaseadvanced.js +0 -6
  588. package/js/src/coinbaseexchange.js +0 -6
  589. package/js/src/coinbaseinternational.js +0 -6
  590. package/js/src/coincatch.js +1 -7
  591. package/js/src/coincheck.js +0 -6
  592. package/js/src/coinex.js +0 -6
  593. package/js/src/coinmate.js +0 -6
  594. package/js/src/coinmetro.js +11 -6
  595. package/js/src/coinone.js +0 -6
  596. package/js/src/coinsph.js +0 -6
  597. package/js/src/coinspot.js +0 -6
  598. package/js/src/cryptocom.js +0 -6
  599. package/js/src/cryptomus.js +0 -6
  600. package/js/src/defx.js +0 -6
  601. package/js/src/delta.js +0 -6
  602. package/js/src/deribit.js +0 -6
  603. package/js/src/derive.js +0 -6
  604. package/js/src/digifinex.js +0 -6
  605. package/js/src/exmo.js +0 -6
  606. package/js/src/fmfwio.js +0 -6
  607. package/js/src/foxbit.js +0 -6
  608. package/js/src/gate.d.ts +6 -0
  609. package/js/src/gate.js +7 -7
  610. package/js/src/gateio.js +0 -6
  611. package/js/src/gemini.js +10 -11
  612. package/js/src/hashkey.js +0 -6
  613. package/js/src/hibachi.js +0 -6
  614. package/js/src/hitbtc.js +0 -6
  615. package/js/src/hollaex.js +0 -6
  616. package/js/src/htx.js +0 -6
  617. package/js/src/huobi.js +0 -6
  618. package/js/src/hyperliquid.js +0 -6
  619. package/js/src/independentreserve.js +0 -6
  620. package/js/src/indodax.js +0 -6
  621. package/js/src/kraken.js +0 -6
  622. package/js/src/krakenfutures.js +1 -7
  623. package/js/src/kucoin.js +0 -6
  624. package/js/src/kucoinfutures.d.ts +14 -1
  625. package/js/src/kucoinfutures.js +51 -9
  626. package/js/src/latoken.js +0 -6
  627. package/js/src/lbank.js +0 -6
  628. package/js/src/luno.js +0 -6
  629. package/js/src/mercado.js +0 -6
  630. package/js/src/mexc.js +0 -6
  631. package/js/src/modetrade.js +0 -6
  632. package/js/src/myokx.js +0 -6
  633. package/js/src/ndax.js +0 -6
  634. package/js/src/novadax.js +0 -6
  635. package/js/src/oceanex.js +0 -6
  636. package/js/src/okcoin.js +0 -6
  637. package/js/src/okx.js +24 -20
  638. package/js/src/okxus.js +0 -6
  639. package/js/src/onetrading.d.ts +1 -0
  640. package/js/src/onetrading.js +160 -71
  641. package/js/src/oxfun.js +0 -6
  642. package/js/src/p2b.js +0 -6
  643. package/js/src/paradex.js +0 -6
  644. package/js/src/paymium.js +0 -6
  645. package/js/src/phemex.d.ts +3 -3
  646. package/js/src/phemex.js +15 -15
  647. package/js/src/poloniex.js +0 -6
  648. package/js/src/pro/alpaca.js +0 -6
  649. package/js/src/pro/apex.js +0 -6
  650. package/js/src/pro/ascendex.js +0 -6
  651. package/js/src/pro/backpack.d.ts +264 -0
  652. package/js/src/pro/backpack.js +1318 -0
  653. package/js/src/pro/bequant.js +0 -6
  654. package/js/src/pro/binance.js +9 -6
  655. package/js/src/pro/binancecoinm.js +0 -6
  656. package/js/src/pro/binanceus.js +0 -6
  657. package/js/src/pro/binanceusdm.js +0 -6
  658. package/js/src/pro/bingx.js +0 -6
  659. package/js/src/pro/bitfinex.js +0 -6
  660. package/js/src/pro/bitget.d.ts +6 -0
  661. package/js/src/pro/bitget.js +40 -17
  662. package/js/src/pro/bithumb.js +0 -6
  663. package/js/src/pro/bitmart.js +0 -6
  664. package/js/src/pro/bitmex.js +0 -6
  665. package/js/src/pro/bitopro.js +0 -6
  666. package/js/src/pro/bitrue.js +0 -6
  667. package/js/src/pro/bitstamp.js +0 -6
  668. package/js/src/pro/bittrade.js +0 -6
  669. package/js/src/pro/bitvavo.js +0 -6
  670. package/js/src/pro/blockchaincom.js +0 -6
  671. package/js/src/pro/blofin.js +0 -6
  672. package/js/src/pro/bybit.js +3 -6
  673. package/js/src/pro/cex.js +0 -6
  674. package/js/src/pro/coinbase.d.ts +85 -0
  675. package/js/src/pro/coinbase.js +226 -6
  676. package/js/src/pro/coinbaseadvanced.js +0 -6
  677. package/js/src/pro/coinbaseexchange.js +0 -6
  678. package/js/src/pro/coinbaseinternational.js +0 -6
  679. package/js/src/pro/coincatch.js +0 -6
  680. package/js/src/pro/coincheck.js +0 -6
  681. package/js/src/pro/coinex.js +0 -6
  682. package/js/src/pro/coinone.js +0 -6
  683. package/js/src/pro/cryptocom.js +0 -6
  684. package/js/src/pro/defx.js +0 -6
  685. package/js/src/pro/deribit.js +0 -6
  686. package/js/src/pro/derive.js +0 -6
  687. package/js/src/pro/exmo.js +0 -6
  688. package/js/src/pro/gate.js +0 -6
  689. package/js/src/pro/gateio.js +0 -6
  690. package/js/src/pro/gemini.js +0 -6
  691. package/js/src/pro/hashkey.js +0 -6
  692. package/js/src/pro/hitbtc.js +0 -6
  693. package/js/src/pro/hollaex.js +0 -6
  694. package/js/src/pro/htx.js +0 -6
  695. package/js/src/pro/huobi.js +0 -6
  696. package/js/src/pro/hyperliquid.js +0 -6
  697. package/js/src/pro/independentreserve.js +0 -6
  698. package/js/src/pro/kraken.js +0 -6
  699. package/js/src/pro/krakenfutures.js +0 -6
  700. package/js/src/pro/kucoin.js +0 -6
  701. package/js/src/pro/kucoinfutures.js +0 -6
  702. package/js/src/pro/lbank.js +0 -6
  703. package/js/src/pro/luno.js +0 -6
  704. package/js/src/pro/mexc.js +0 -6
  705. package/js/src/pro/modetrade.js +0 -6
  706. package/js/src/pro/myokx.js +0 -6
  707. package/js/src/pro/ndax.js +0 -6
  708. package/js/src/pro/okcoin.js +0 -6
  709. package/js/src/pro/okx.js +0 -6
  710. package/js/src/pro/okxus.js +0 -6
  711. package/js/src/pro/onetrading.js +0 -6
  712. package/js/src/pro/oxfun.js +0 -6
  713. package/js/src/pro/p2b.js +0 -6
  714. package/js/src/pro/paradex.js +0 -6
  715. package/js/src/pro/phemex.js +0 -6
  716. package/js/src/pro/poloniex.js +0 -6
  717. package/js/src/pro/probit.js +0 -6
  718. package/js/src/pro/tradeogre.js +0 -6
  719. package/js/src/pro/upbit.js +0 -6
  720. package/js/src/pro/whitebit.js +0 -6
  721. package/js/src/pro/woo.js +0 -6
  722. package/js/src/pro/woofipro.js +0 -6
  723. package/js/src/pro/xt.js +0 -6
  724. package/js/src/probit.js +0 -6
  725. package/js/src/protobuf/mexc/compiled.cjs +0 -6
  726. package/js/src/static_dependencies/ethers/abi-coder.js +0 -6
  727. package/js/src/static_dependencies/ethers/address/address.js +0 -6
  728. package/js/src/static_dependencies/ethers/address/checks.js +0 -6
  729. package/js/src/static_dependencies/ethers/address/contract-address.js +0 -6
  730. package/js/src/static_dependencies/ethers/address/index.js +0 -6
  731. package/js/src/static_dependencies/ethers/bytes32.js +0 -6
  732. package/js/src/static_dependencies/ethers/coders/abstract-coder.js +0 -6
  733. package/js/src/static_dependencies/ethers/coders/address.js +0 -6
  734. package/js/src/static_dependencies/ethers/coders/anonymous.js +0 -6
  735. package/js/src/static_dependencies/ethers/coders/array.js +0 -6
  736. package/js/src/static_dependencies/ethers/coders/boolean.js +0 -6
  737. package/js/src/static_dependencies/ethers/coders/bytes.js +0 -6
  738. package/js/src/static_dependencies/ethers/coders/fixed-bytes.js +0 -6
  739. package/js/src/static_dependencies/ethers/coders/null.js +0 -6
  740. package/js/src/static_dependencies/ethers/coders/number.js +0 -6
  741. package/js/src/static_dependencies/ethers/coders/string.js +0 -6
  742. package/js/src/static_dependencies/ethers/coders/tuple.js +0 -6
  743. package/js/src/static_dependencies/ethers/fragments.js +0 -6
  744. package/js/src/static_dependencies/ethers/hash/index.js +0 -6
  745. package/js/src/static_dependencies/ethers/hash/solidity.js +0 -6
  746. package/js/src/static_dependencies/ethers/hash/typed-data.js +0 -6
  747. package/js/src/static_dependencies/ethers/index.js +0 -6
  748. package/js/src/static_dependencies/ethers/interface.js +0 -6
  749. package/js/src/static_dependencies/ethers/typed.js +0 -6
  750. package/js/src/static_dependencies/ethers/utils/base58.js +0 -6
  751. package/js/src/static_dependencies/ethers/utils/base64-browser.js +0 -6
  752. package/js/src/static_dependencies/ethers/utils/base64.js +0 -6
  753. package/js/src/static_dependencies/ethers/utils/data.js +0 -6
  754. package/js/src/static_dependencies/ethers/utils/errors.js +0 -6
  755. package/js/src/static_dependencies/ethers/utils/events.js +0 -6
  756. package/js/src/static_dependencies/ethers/utils/fixednumber.js +0 -6
  757. package/js/src/static_dependencies/ethers/utils/index.js +0 -6
  758. package/js/src/static_dependencies/ethers/utils/maths.js +0 -6
  759. package/js/src/static_dependencies/ethers/utils/properties.js +0 -6
  760. package/js/src/static_dependencies/ethers/utils/rlp-decode.js +0 -6
  761. package/js/src/static_dependencies/ethers/utils/rlp-encode.js +0 -6
  762. package/js/src/static_dependencies/ethers/utils/rlp.js +0 -6
  763. package/js/src/static_dependencies/ethers/utils/units.js +0 -6
  764. package/js/src/static_dependencies/ethers/utils/utf8.js +0 -6
  765. package/js/src/static_dependencies/ethers/utils/uuid.js +0 -6
  766. package/js/src/static_dependencies/fflake/browser.js +0 -6
  767. package/js/src/static_dependencies/jsencrypt/JSEncrypt.js +0 -6
  768. package/js/src/static_dependencies/jsencrypt/JSEncryptRSAKey.js +0 -6
  769. package/js/src/static_dependencies/jsencrypt/index.js +0 -6
  770. package/js/src/static_dependencies/jsencrypt/lib/asn1js/asn1.js +0 -6
  771. package/js/src/static_dependencies/jsencrypt/lib/asn1js/base64.js +0 -6
  772. package/js/src/static_dependencies/jsencrypt/lib/asn1js/hex.js +0 -6
  773. package/js/src/static_dependencies/jsencrypt/lib/asn1js/int10.js +0 -6
  774. package/js/src/static_dependencies/jsencrypt/lib/asn1js/oids.js +0 -6
  775. package/js/src/static_dependencies/jsencrypt/lib/jsbn/base64.js +0 -6
  776. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.js +0 -6
  777. package/js/src/static_dependencies/jsencrypt/lib/jsbn/prng4.js +0 -6
  778. package/js/src/static_dependencies/jsencrypt/lib/jsbn/rng.js +0 -6
  779. package/js/src/static_dependencies/jsencrypt/lib/jsbn/rsa.js +0 -6
  780. package/js/src/static_dependencies/jsencrypt/lib/jsbn/util.js +0 -6
  781. package/js/src/static_dependencies/jsencrypt/lib/jsrsasign/asn1-1.0.js +0 -6
  782. package/js/src/static_dependencies/jsencrypt/lib/jsrsasign/yahoo.js +0 -6
  783. package/js/src/static_dependencies/messagepack/msgpack.js +0 -6
  784. package/js/src/static_dependencies/noble-curves/_shortw_utils.js +0 -6
  785. package/js/src/static_dependencies/noble-curves/abstract/curve.js +0 -6
  786. package/js/src/static_dependencies/noble-curves/abstract/edwards.js +0 -6
  787. package/js/src/static_dependencies/noble-curves/abstract/hash-to-curve.js +0 -6
  788. package/js/src/static_dependencies/noble-curves/abstract/modular.js +0 -6
  789. package/js/src/static_dependencies/noble-curves/abstract/montgomery.js +0 -6
  790. package/js/src/static_dependencies/noble-curves/abstract/poseidon.js +0 -6
  791. package/js/src/static_dependencies/noble-curves/abstract/utils.js +0 -6
  792. package/js/src/static_dependencies/noble-curves/abstract/weierstrass.js +0 -6
  793. package/js/src/static_dependencies/noble-curves/bn.js +0 -6
  794. package/js/src/static_dependencies/noble-curves/ed25519.js +0 -6
  795. package/js/src/static_dependencies/noble-curves/ed448.js +0 -6
  796. package/js/src/static_dependencies/noble-curves/index.js +0 -6
  797. package/js/src/static_dependencies/noble-curves/jubjub.js +0 -6
  798. package/js/src/static_dependencies/noble-curves/p256.js +0 -6
  799. package/js/src/static_dependencies/noble-curves/p384.js +0 -6
  800. package/js/src/static_dependencies/noble-curves/p521.js +0 -6
  801. package/js/src/static_dependencies/noble-curves/pasta.js +0 -6
  802. package/js/src/static_dependencies/noble-curves/secp256k1.js +0 -6
  803. package/js/src/static_dependencies/noble-hashes/_assert.js +0 -6
  804. package/js/src/static_dependencies/noble-hashes/_blake2.js +0 -6
  805. package/js/src/static_dependencies/noble-hashes/_sha2.js +0 -6
  806. package/js/src/static_dependencies/noble-hashes/_u64.js +0 -6
  807. package/js/src/static_dependencies/noble-hashes/argon2.js +0 -6
  808. package/js/src/static_dependencies/noble-hashes/blake2b.js +0 -6
  809. package/js/src/static_dependencies/noble-hashes/blake2s.js +0 -6
  810. package/js/src/static_dependencies/noble-hashes/blake3.js +0 -6
  811. package/js/src/static_dependencies/noble-hashes/crypto.js +0 -6
  812. package/js/src/static_dependencies/noble-hashes/cryptoNode.js +0 -6
  813. package/js/src/static_dependencies/noble-hashes/eskdf.js +0 -6
  814. package/js/src/static_dependencies/noble-hashes/hkdf.js +0 -6
  815. package/js/src/static_dependencies/noble-hashes/hmac.js +0 -6
  816. package/js/src/static_dependencies/noble-hashes/index.js +0 -6
  817. package/js/src/static_dependencies/noble-hashes/md5.js +0 -6
  818. package/js/src/static_dependencies/noble-hashes/pbkdf2.js +0 -6
  819. package/js/src/static_dependencies/noble-hashes/ripemd160.js +0 -6
  820. package/js/src/static_dependencies/noble-hashes/scrypt.js +0 -6
  821. package/js/src/static_dependencies/noble-hashes/sha1.js +0 -6
  822. package/js/src/static_dependencies/noble-hashes/sha256.js +0 -6
  823. package/js/src/static_dependencies/noble-hashes/sha3-addons.js +0 -6
  824. package/js/src/static_dependencies/noble-hashes/sha3.js +0 -6
  825. package/js/src/static_dependencies/noble-hashes/sha512.js +0 -6
  826. package/js/src/static_dependencies/noble-hashes/utils.js +0 -6
  827. package/js/src/static_dependencies/node-fetch/body.js +0 -6
  828. package/js/src/static_dependencies/node-fetch/errors/abort-error.js +0 -6
  829. package/js/src/static_dependencies/node-fetch/errors/base.js +0 -6
  830. package/js/src/static_dependencies/node-fetch/errors/fetch-error.js +0 -6
  831. package/js/src/static_dependencies/node-fetch/headers.js +0 -6
  832. package/js/src/static_dependencies/node-fetch/index.js +0 -6
  833. package/js/src/static_dependencies/node-fetch/request.js +0 -6
  834. package/js/src/static_dependencies/node-fetch/response.js +0 -6
  835. package/js/src/static_dependencies/node-fetch/utils/get-search.js +0 -6
  836. package/js/src/static_dependencies/node-fetch/utils/is-redirect.js +0 -6
  837. package/js/src/static_dependencies/node-fetch/utils/is.js +0 -6
  838. package/js/src/static_dependencies/node-fetch/utils/referrer.js +0 -6
  839. package/js/src/static_dependencies/proxies/agent-base/helpers.js +0 -6
  840. package/js/src/static_dependencies/proxies/agent-base/index.js +0 -6
  841. package/js/src/static_dependencies/proxies/http-proxy-agent/index.js +0 -6
  842. package/js/src/static_dependencies/proxies/https-proxy-agent/index.js +0 -6
  843. package/js/src/static_dependencies/proxies/https-proxy-agent/parse-proxy-response.js +0 -6
  844. package/js/src/static_dependencies/qs/formats.cjs +0 -6
  845. package/js/src/static_dependencies/qs/index.cjs +0 -6
  846. package/js/src/static_dependencies/qs/parse.cjs +0 -6
  847. package/js/src/static_dependencies/qs/stringify.cjs +0 -6
  848. package/js/src/static_dependencies/qs/utils.cjs +0 -6
  849. package/js/src/static_dependencies/scure-base/index.js +0 -6
  850. package/js/src/static_dependencies/scure-starknet/index.js +0 -6
  851. package/js/src/static_dependencies/starknet/constants.js +0 -6
  852. package/js/src/static_dependencies/starknet/index.js +0 -6
  853. package/js/src/static_dependencies/starknet/types/cairoEnum.js +0 -6
  854. package/js/src/static_dependencies/starknet/types/calldata.js +0 -6
  855. package/js/src/static_dependencies/starknet/types/index.js +0 -6
  856. package/js/src/static_dependencies/starknet/types/lib/contract/abi.js +0 -6
  857. package/js/src/static_dependencies/starknet/types/lib/contract/index.js +0 -6
  858. package/js/src/static_dependencies/starknet/types/lib/contract/legacy.js +0 -6
  859. package/js/src/static_dependencies/starknet/types/lib/contract/sierra.js +0 -6
  860. package/js/src/static_dependencies/starknet/types/lib/index.js +0 -6
  861. package/js/src/static_dependencies/starknet/types/typedData.js +0 -6
  862. package/js/src/static_dependencies/starknet/utils/address.js +0 -6
  863. package/js/src/static_dependencies/starknet/utils/assert.js +0 -6
  864. package/js/src/static_dependencies/starknet/utils/cairoDataTypes/felt.js +0 -6
  865. package/js/src/static_dependencies/starknet/utils/cairoDataTypes/uint256.js +0 -6
  866. package/js/src/static_dependencies/starknet/utils/cairoDataTypes/uint512.js +0 -6
  867. package/js/src/static_dependencies/starknet/utils/calldata/byteArray.js +0 -6
  868. package/js/src/static_dependencies/starknet/utils/calldata/cairo.js +0 -6
  869. package/js/src/static_dependencies/starknet/utils/calldata/enum/CairoCustomEnum.js +0 -6
  870. package/js/src/static_dependencies/starknet/utils/calldata/enum/CairoOption.js +0 -6
  871. package/js/src/static_dependencies/starknet/utils/calldata/enum/CairoResult.js +0 -6
  872. package/js/src/static_dependencies/starknet/utils/calldata/enum/index.js +0 -6
  873. package/js/src/static_dependencies/starknet/utils/calldata/formatter.js +0 -6
  874. package/js/src/static_dependencies/starknet/utils/calldata/index.js +0 -6
  875. package/js/src/static_dependencies/starknet/utils/calldata/parser/index.js +0 -6
  876. package/js/src/static_dependencies/starknet/utils/calldata/parser/interface.js +0 -6
  877. package/js/src/static_dependencies/starknet/utils/calldata/parser/parser-0-1.1.0.js +0 -6
  878. package/js/src/static_dependencies/starknet/utils/calldata/parser/parser-2.0.0.js +0 -6
  879. package/js/src/static_dependencies/starknet/utils/calldata/propertyOrder.js +0 -6
  880. package/js/src/static_dependencies/starknet/utils/calldata/requestParser.js +0 -6
  881. package/js/src/static_dependencies/starknet/utils/calldata/responseParser.js +0 -6
  882. package/js/src/static_dependencies/starknet/utils/calldata/tuple.js +0 -6
  883. package/js/src/static_dependencies/starknet/utils/calldata/validate.js +0 -6
  884. package/js/src/static_dependencies/starknet/utils/encode.js +0 -6
  885. package/js/src/static_dependencies/starknet/utils/hash/classHash.js +0 -6
  886. package/js/src/static_dependencies/starknet/utils/hash/index.js +0 -6
  887. package/js/src/static_dependencies/starknet/utils/merkle.js +0 -6
  888. package/js/src/static_dependencies/starknet/utils/num.js +0 -6
  889. package/js/src/static_dependencies/starknet/utils/selector.js +0 -6
  890. package/js/src/static_dependencies/starknet/utils/shortString.js +0 -6
  891. package/js/src/static_dependencies/starknet/utils/starknetId.js +0 -6
  892. package/js/src/static_dependencies/starknet/utils/typedData.js +0 -6
  893. package/js/src/static_dependencies/starknet/utils/uint256.js +0 -6
  894. package/js/src/static_dependencies/starknet/utils/url.js +0 -6
  895. package/js/src/static_dependencies/watchable/src/index.js +0 -6
  896. package/js/src/static_dependencies/watchable/src/types.js +0 -6
  897. package/js/src/static_dependencies/watchable/src/unpromise.js +0 -6
  898. package/js/src/static_dependencies/zklink/zklink-sdk-web.js +0 -6
  899. package/js/src/timex.js +0 -6
  900. package/js/src/tokocrypto.js +0 -6
  901. package/js/src/tradeogre.js +0 -6
  902. package/js/src/upbit.js +0 -6
  903. package/js/src/wavesexchange.js +0 -6
  904. package/js/src/whitebit.js +0 -6
  905. package/js/src/woo.js +0 -6
  906. package/js/src/woofipro.js +0 -6
  907. package/js/src/xt.d.ts +1 -0
  908. package/js/src/xt.js +9 -6
  909. package/js/src/yobit.js +9 -6
  910. package/js/src/zaif.js +0 -6
  911. package/js/src/zonda.js +0 -6
  912. package/package.json +1 -1
@@ -0,0 +1,2280 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var backpack$1 = require('./abstract/backpack.js');
6
+ var errors = require('./base/errors.js');
7
+ var number = require('./base/functions/number.js');
8
+ var Precise = require('./base/Precise.js');
9
+ var ed25519 = require('./static_dependencies/noble-curves/ed25519.js');
10
+ var crypto = require('./base/functions/crypto.js');
11
+
12
+ // ---------------------------------------------------------------------------
13
+ // ---------------------------------------------------------------------------
14
+ /**
15
+ * @class backpack
16
+ * @augments Exchange
17
+ */
18
+ class backpack extends backpack$1["default"] {
19
+ describe() {
20
+ return this.deepExtend(super.describe(), {
21
+ 'id': 'backpack',
22
+ 'name': 'Backpack',
23
+ 'countries': ['JP'],
24
+ 'rateLimit': 50,
25
+ 'version': 'v1',
26
+ 'certified': false,
27
+ 'pro': true,
28
+ 'has': {
29
+ 'CORS': undefined,
30
+ 'spot': true,
31
+ 'margin': true,
32
+ 'swap': true,
33
+ 'future': false,
34
+ 'option': false,
35
+ 'addMargin': false,
36
+ 'cancelAllOrders': true,
37
+ 'cancelAllOrdersAfter': false,
38
+ 'cancelOrder': true,
39
+ 'cancelOrders': false,
40
+ 'cancelWithdraw': false,
41
+ 'closePosition': false,
42
+ 'createConvertTrade': false,
43
+ 'createDepositAddress': false,
44
+ 'createLimitBuyOrder': true,
45
+ 'createLimitOrder': true,
46
+ 'createLimitSellOrder': true,
47
+ 'createMarketBuyOrder': true,
48
+ 'createMarketBuyOrderWithCost': true,
49
+ 'createMarketOrder': true,
50
+ 'createMarketOrderWithCost': true,
51
+ 'createMarketSellOrder': true,
52
+ 'createMarketSellOrderWithCost': true,
53
+ 'createOrder': true,
54
+ 'createOrders': true,
55
+ 'createOrderWithTakeProfitAndStopLoss': true,
56
+ 'createPostOnlyOrder': true,
57
+ 'createReduceOnlyOrder': true,
58
+ 'createStopLossOrder': false,
59
+ 'createTakeProfitOrder': false,
60
+ 'createTrailingAmountOrder': false,
61
+ 'createTrailingPercentOrder': false,
62
+ 'createTriggerOrder': true,
63
+ 'fetchAccounts': false,
64
+ 'fetchBalance': true,
65
+ 'fetchCanceledAndClosedOrders': false,
66
+ 'fetchCanceledOrders': false,
67
+ 'fetchClosedOrder': false,
68
+ 'fetchClosedOrders': false,
69
+ 'fetchConvertCurrencies': false,
70
+ 'fetchConvertQuote': false,
71
+ 'fetchConvertTrade': false,
72
+ 'fetchConvertTradeHistory': false,
73
+ 'fetchCurrencies': true,
74
+ 'fetchDepositAddress': true,
75
+ 'fetchDeposits': true,
76
+ 'fetchDepositsWithdrawals': false,
77
+ 'fetchDepositWithdrawFees': false,
78
+ 'fetchFundingHistory': true,
79
+ 'fetchFundingRate': true,
80
+ 'fetchFundingRateHistory': true,
81
+ 'fetchFundingRates': false,
82
+ 'fetchIndexOHLCV': true,
83
+ 'fetchLedger': false,
84
+ 'fetchLeverage': false,
85
+ 'fetchLeverageTiers': false,
86
+ 'fetchMarginAdjustmentHistory': false,
87
+ 'fetchMarginMode': false,
88
+ 'fetchMarkets': true,
89
+ 'fetchMarkOHLCV': true,
90
+ 'fetchMyTrades': true,
91
+ 'fetchOHLCV': true,
92
+ 'fetchOpenInterest': true,
93
+ 'fetchOpenInterestHistory': true,
94
+ 'fetchOpenOrder': true,
95
+ 'fetchOpenOrders': true,
96
+ 'fetchOrder': false,
97
+ 'fetchOrderBook': true,
98
+ 'fetchOrders': true,
99
+ 'fetchOrderTrades': false,
100
+ 'fetchPosition': false,
101
+ 'fetchPositionHistory': false,
102
+ 'fetchPositionMode': false,
103
+ 'fetchPositions': true,
104
+ 'fetchPositionsForSymbol': false,
105
+ 'fetchPositionsHistory': false,
106
+ 'fetchPremiumIndexOHLCV': false,
107
+ 'fetchStatus': true,
108
+ 'fetchTicker': true,
109
+ 'fetchTickers': true,
110
+ 'fetchTime': true,
111
+ 'fetchTrades': true,
112
+ 'fetchTradingFee': false,
113
+ 'fetchTradingFees': false,
114
+ 'fetchTransactions': false,
115
+ 'fetchTransfers': false,
116
+ 'fetchWithdrawals': true,
117
+ 'reduceMargin': false,
118
+ 'sandbox': false,
119
+ 'setLeverage': false,
120
+ 'setMargin': false,
121
+ 'setMarginMode': false,
122
+ 'setPositionMode': false,
123
+ 'transfer': false,
124
+ 'withdraw': true,
125
+ },
126
+ 'timeframes': {
127
+ '1m': '1m',
128
+ '3m': '3m',
129
+ '5m': '5m',
130
+ '15': '15m',
131
+ '30': '30m',
132
+ '1h': '1h',
133
+ '2h': '2h',
134
+ '4h': '4h',
135
+ '6h': '6h',
136
+ '8h': '8h',
137
+ '12h': '12h',
138
+ '1d': '1d',
139
+ '3d': '3d',
140
+ '1w': '1w',
141
+ '1M': '1month',
142
+ },
143
+ 'urls': {
144
+ 'logo': 'https://github.com/user-attachments/assets/cc04c278-679f-4554-9f72-930dd632b80f',
145
+ 'api': {
146
+ 'public': 'https://api.backpack.exchange',
147
+ 'private': 'https://api.backpack.exchange',
148
+ },
149
+ 'www': 'https://backpack.exchange/',
150
+ 'doc': 'https://docs.backpack.exchange/',
151
+ 'referral': 'https://backpack.exchange/join/ib8qxwyl',
152
+ },
153
+ 'api': {
154
+ 'public': {
155
+ 'get': {
156
+ 'api/v1/assets': 1,
157
+ 'api/v1/collateral': 1,
158
+ 'api/v1/borrowLend/markets': 1,
159
+ 'api/v1/borrowLend/markets/history': 1,
160
+ 'api/v1/markets': 1,
161
+ 'api/v1/market': 1,
162
+ 'api/v1/ticker': 1,
163
+ 'api/v1/tickers': 1,
164
+ 'api/v1/depth': 1,
165
+ 'api/v1/klines': 1,
166
+ 'api/v1/markPrices': 1,
167
+ 'api/v1/openInterest': 1,
168
+ 'api/v1/fundingRates': 1,
169
+ 'api/v1/status': 1,
170
+ 'api/v1/ping': 1,
171
+ 'api/v1/time': 1,
172
+ 'api/v1/wallets': 1,
173
+ 'api/v1/trades': 1,
174
+ 'api/v1/trades/history': 1, // done
175
+ },
176
+ },
177
+ 'private': {
178
+ 'get': {
179
+ 'api/v1/account': 1,
180
+ 'api/v1/account/limits/borrow': 1,
181
+ 'api/v1/account/limits/order': 1,
182
+ 'api/v1/account/limits/withdrawal': 1,
183
+ 'api/v1/borrowLend/positions': 1,
184
+ 'api/v1/capital': 1,
185
+ 'api/v1/capital/collateral': 1,
186
+ 'wapi/v1/capital/deposits': 1,
187
+ 'wapi/v1/capital/deposit/address': 1,
188
+ 'wapi/v1/capital/withdrawals': 1,
189
+ 'api/v1/position': 1,
190
+ 'wapi/v1/history/borrowLend': 1,
191
+ 'wapi/v1/history/interest': 1,
192
+ 'wapi/v1/history/borrowLend/positions': 1,
193
+ 'wapi/v1/history/dust': 1,
194
+ 'wapi/v1/history/fills': 1,
195
+ 'wapi/v1/history/funding': 1,
196
+ 'wapi/v1/history/orders': 1,
197
+ 'wapi/v1/history/rfq': 1,
198
+ 'wapi/v1/history/quote': 1,
199
+ 'wapi/v1/history/settlement': 1,
200
+ 'wapi/v1/history/strategies': 1,
201
+ 'api/v1/order': 1,
202
+ 'api/v1/orders': 1, // done
203
+ },
204
+ 'post': {
205
+ 'api/v1/account/convertDust': 1,
206
+ 'api/v1/borrowLend': 1,
207
+ 'wapi/v1/capital/withdrawals': 1,
208
+ 'api/v1/order': 1,
209
+ 'api/v1/orders': 1,
210
+ 'api/v1/rfq': 1,
211
+ 'api/v1/rfq/accept': 1,
212
+ 'api/v1/rfq/refresh': 1,
213
+ 'api/v1/rfq/cancel': 1,
214
+ 'api/v1/rfq/quote': 1,
215
+ },
216
+ 'delete': {
217
+ 'api/v1/order': 1,
218
+ 'api/v1/orders': 1, // done
219
+ },
220
+ 'patch': {
221
+ 'api/v1/account': 1,
222
+ },
223
+ },
224
+ },
225
+ 'features': {
226
+ 'default': {
227
+ 'sandbox': false,
228
+ 'createOrder': {
229
+ 'marginMode': false,
230
+ 'triggerPrice': true,
231
+ 'triggerPriceType': undefined,
232
+ 'triggerDirection': false,
233
+ 'stopLossPrice': true,
234
+ 'takeProfitPrice': true,
235
+ 'attachedStopLossTakeProfit': undefined,
236
+ 'timeInForce': {
237
+ 'GTC': true,
238
+ 'IOC': true,
239
+ 'FOK': true,
240
+ 'PO': true,
241
+ 'GTD': false,
242
+ },
243
+ 'hedged': false,
244
+ 'trailing': false,
245
+ 'leverage': false,
246
+ 'marketBuyByCost': true,
247
+ 'marketBuyRequiresPrice': true,
248
+ 'selfTradePrevention': false,
249
+ 'iceberg': false,
250
+ },
251
+ 'createOrders': {
252
+ 'max': 20,
253
+ },
254
+ 'fetchMyTrades': {
255
+ 'marginMode': false,
256
+ 'limit': 1000,
257
+ 'daysBack': undefined,
258
+ 'untilDays': undefined,
259
+ 'symbolRequired': false,
260
+ },
261
+ 'fetchOrder': undefined,
262
+ 'fetchOpenOrders': {
263
+ 'marginMode': false,
264
+ 'limit': 1000,
265
+ 'trigger': true,
266
+ 'trailing': false,
267
+ 'symbolRequired': false,
268
+ },
269
+ 'fetchOrders': {
270
+ 'marginMode': false,
271
+ 'limit': 1000,
272
+ 'daysBack': undefined,
273
+ 'untilDays': undefined,
274
+ 'trigger': true,
275
+ 'trailing': false,
276
+ 'symbolRequired': true,
277
+ },
278
+ 'fetchClosedOrders': undefined,
279
+ 'fetchOHLCV': {
280
+ 'paginate': false,
281
+ 'limit': 1000,
282
+ },
283
+ },
284
+ 'spot': {
285
+ 'extends': 'default',
286
+ },
287
+ 'swap': {
288
+ 'linear': undefined,
289
+ 'inverse': undefined,
290
+ },
291
+ 'future': {
292
+ 'linear': undefined,
293
+ 'inverse': undefined,
294
+ },
295
+ },
296
+ 'requiredCredentials': {
297
+ 'apiKey': true,
298
+ 'secret': true,
299
+ },
300
+ 'precisionMode': number.TICK_SIZE,
301
+ 'options': {
302
+ 'instructions': {
303
+ 'api/v1/account': {
304
+ 'GET': 'accountQuery',
305
+ 'PATCH': 'accountUpdate',
306
+ },
307
+ 'api/v1/capital': {
308
+ 'GET': 'balanceQuery',
309
+ },
310
+ 'api/v1/account/limits/borrow': {
311
+ 'GET': 'maxBorrowQuantity',
312
+ },
313
+ 'api/v1/account/limits/order': {
314
+ 'GET': 'maxOrderQuantity',
315
+ },
316
+ 'api/v1/account/limits/withdrawal': {
317
+ 'GET': 'maxWithdrawalQuantity',
318
+ },
319
+ 'api/v1/borrowLend/positions': {
320
+ 'GET': 'borrowLendPositionQuery',
321
+ },
322
+ 'api/v1/borrowLend': {
323
+ 'POST': 'borrowLendExecute',
324
+ },
325
+ 'wapi/v1/history/borrowLend/positions': {
326
+ 'GET': 'borrowPositionHistoryQueryAll',
327
+ },
328
+ 'wapi/v1/history/borrowLend': {
329
+ 'GET': 'borrowHistoryQueryAll',
330
+ },
331
+ 'wapi/v1/history/dust': {
332
+ 'GET': 'dustHistoryQueryAll',
333
+ },
334
+ 'api/v1/capital/collateral': {
335
+ 'GET': 'collateralQuery',
336
+ },
337
+ 'wapi/v1/capital/deposit/address': {
338
+ 'GET': 'depositAddressQuery',
339
+ },
340
+ 'wapi/v1/capital/deposits': {
341
+ 'GET': 'depositQueryAll',
342
+ },
343
+ 'wapi/v1/history/fills': {
344
+ 'GET': 'fillHistoryQueryAll',
345
+ },
346
+ 'wapi/v1/history/funding': {
347
+ 'GET': 'fundingHistoryQueryAll',
348
+ },
349
+ 'wapi/v1/history/interest': {
350
+ 'GET': 'interestHistoryQueryAll',
351
+ },
352
+ 'api/v1/order': {
353
+ 'GET': 'orderQuery',
354
+ 'POST': 'orderExecute',
355
+ 'DELETE': 'orderCancel',
356
+ },
357
+ 'api/v1/orders': {
358
+ 'GET': 'orderQueryAll',
359
+ 'POST': 'orderExecute',
360
+ 'DELETE': 'orderCancelAll',
361
+ },
362
+ 'wapi/v1/history/orders': {
363
+ 'GET': 'orderHistoryQueryAll',
364
+ },
365
+ 'wapi/v1/history/pnl': {
366
+ 'GET': 'pnlHistoryQueryAll',
367
+ },
368
+ 'wapi/v1/history/rfq': {
369
+ 'GET': 'rfqHistoryQueryAll',
370
+ },
371
+ 'wapi/v1/history/quote': {
372
+ 'GET': 'quoteHistoryQueryAll',
373
+ },
374
+ 'wapi/v1/history/settlement': {
375
+ 'GET': 'settlementHistoryQueryAll',
376
+ },
377
+ 'api/v1/position': {
378
+ 'GET': 'positionQuery',
379
+ },
380
+ 'api/v1/rfq/quote': {
381
+ 'POST': 'quoteSubmit',
382
+ },
383
+ 'wapi/v1/history/strategies': {
384
+ 'GET': 'strategyHistoryQueryAll',
385
+ },
386
+ 'wapi/v1/capital/withdrawals': {
387
+ 'GET': 'withdrawalQueryAll',
388
+ 'POST': 'withdraw',
389
+ },
390
+ },
391
+ 'recvWindow': 5000,
392
+ 'brokerId': '',
393
+ 'currencyIdsListForParseMarket': undefined,
394
+ 'broker': '',
395
+ 'timeDifference': 0,
396
+ 'adjustForTimeDifference': false,
397
+ 'networks': {
398
+ 'APT': 'Aptos',
399
+ 'ARB': 'Arbitrum',
400
+ 'AVAX': 'Avalanche',
401
+ 'BASE': 'Base',
402
+ 'BERA': 'Berachain',
403
+ 'BTC': 'Bitcoin',
404
+ 'BCH': 'BitcoinCash',
405
+ 'BSC': 'Bsc',
406
+ 'ADA': 'Cardano',
407
+ 'DOGE': 'Dogecoin',
408
+ 'ECLIPSE': 'Eclipse',
409
+ 'EQUALSMONEY': 'EqualsMoney',
410
+ 'ERC20': 'Ethereum',
411
+ 'HYP': 'Hyperliquid',
412
+ 'LTC': 'Litecoin',
413
+ 'OPTIMISM': 'Optimism',
414
+ 'MATIC': 'Polygon',
415
+ 'SEI': 'Sei',
416
+ 'SUI': 'Sui',
417
+ 'SOL': 'Solana',
418
+ 'STORY': 'Story',
419
+ 'TRC20': 'Tron',
420
+ 'XRP': 'XRP',
421
+ },
422
+ 'networksById': {
423
+ 'aptos': 'APT',
424
+ 'arbitrum': 'ARB',
425
+ 'avalanche': 'AVAX',
426
+ 'base': 'BASE',
427
+ 'berachain': 'BERA',
428
+ 'bitcoin': 'BTC',
429
+ 'bitcoincash': 'BCH',
430
+ 'bsc': 'BSC',
431
+ 'cardano': 'ADA',
432
+ 'dogecoin': 'DOGE',
433
+ 'eclipse': 'ECLIPSE',
434
+ 'equalsmoney': 'EQUALSMONEY',
435
+ 'ethereum': 'ERC20',
436
+ 'hyperliquid': 'HYP',
437
+ 'litecoin': 'LTC',
438
+ 'optimism': 'OPTIMISM',
439
+ 'polygon': 'MATIC',
440
+ 'sei': 'SEI',
441
+ 'sui': 'SUI',
442
+ 'solana': 'SOL',
443
+ 'story': 'STORY',
444
+ 'tron': 'TRC20',
445
+ 'xrp': 'XRP',
446
+ },
447
+ },
448
+ 'commonCurrencies': {},
449
+ 'exceptions': {
450
+ 'exact': {
451
+ 'INVALID_CLIENT_REQUEST': errors.BadRequest,
452
+ 'INVALID_ORDER': errors.InvalidOrder,
453
+ 'ACCOUNT_LIQUIDATING': errors.BadRequest,
454
+ 'BORROW_LIMIT': errors.BadRequest,
455
+ 'BORROW_REQUIRES_LEND_REDEEM': errors.BadRequest,
456
+ 'FORBIDDEN': errors.OperationRejected,
457
+ 'INSUFFICIENT_FUNDS': errors.InsufficientFunds,
458
+ 'INSUFFICIENT_MARGIN': errors.InsufficientFunds,
459
+ 'INSUFFICIENT_SUPPLY': errors.InsufficientFunds,
460
+ 'INVALID_ASSET': errors.BadRequest,
461
+ 'INVALID_MARKET': errors.BadSymbol,
462
+ 'INVALID_PRICE': errors.BadRequest,
463
+ 'INVALID_POSITION_ID': errors.BadRequest,
464
+ 'INVALID_QUANTITY': errors.BadRequest,
465
+ 'INVALID_RANGE': errors.BadRequest,
466
+ 'INVALID_SIGNATURE': errors.AuthenticationError,
467
+ 'INVALID_SOURCE': errors.BadRequest,
468
+ 'INVALID_SYMBOL': errors.BadSymbol,
469
+ 'INVALID_TWO_FACTOR_CODE': errors.BadRequest,
470
+ 'LEND_LIMIT': errors.BadRequest,
471
+ 'LEND_REQUIRES_BORROW_REPAY': errors.BadRequest,
472
+ 'MAINTENANCE': errors.ExchangeError,
473
+ 'MAX_LEVERAGE_REACHED': errors.InsufficientFunds,
474
+ 'NOT_IMPLEMENTED': errors.OperationFailed,
475
+ 'ORDER_LIMIT': errors.OperationRejected,
476
+ 'POSITION_LIMIT': errors.OperationRejected,
477
+ 'PRECONDITION_FAILED': errors.OperationFailed,
478
+ 'RESOURCE_NOT_FOUND': errors.ExchangeNotAvailable,
479
+ 'SERVER_ERROR': errors.NetworkError,
480
+ 'TIMEOUT': errors.RequestTimeout,
481
+ 'TOO_MANY_REQUESTS': errors.RateLimitExceeded,
482
+ 'TRADING_PAUSED': errors.ExchangeNotAvailable,
483
+ 'UNAUTHORIZED': errors.AuthenticationError,
484
+ },
485
+ // Bad Request parse request payload error: failed to parse "MarketSymbol": Invalid market symbol (occurred while parsing "OrderExecutePayload")
486
+ // failed to parse parameter `interval`: failed to parse "KlineInterval": Expect a valid enumeration value.
487
+ 'broad': {},
488
+ },
489
+ });
490
+ }
491
+ /**
492
+ * @method
493
+ * @name backpack#fetchCurrencies
494
+ * @description fetches all available currencies on an exchange
495
+ * @see https://docs.backpack.exchange/#tag/Assets
496
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
497
+ * @returns {object} an associative dictionary of currencies
498
+ */
499
+ async fetchCurrencies(params = {}) {
500
+ const response = await this.publicGetApiV1Assets(params);
501
+ //
502
+ // [
503
+ // {
504
+ // "coingeckoId": "jito-governance-token",
505
+ // "displayName": "Jito",
506
+ // "symbol": "JTO",
507
+ // "tokens": [
508
+ // {
509
+ // "blockchain": "Solana",
510
+ // "contractAddress": "jtojtomepa8beP8AuQc6eXt5FriJwfFMwQx2v2f9mCL",
511
+ // "depositEnabled": true,
512
+ // "displayName": "Jito",
513
+ // "maximumWithdrawal": null,
514
+ // "minimumDeposit": "0.29",
515
+ // "minimumWithdrawal": "0.58",
516
+ // "withdrawEnabled": true,
517
+ // "withdrawalFee": "0.29"
518
+ // }
519
+ // ]
520
+ // }
521
+ // ...
522
+ // ]
523
+ //
524
+ const result = {};
525
+ for (let i = 0; i < response.length; i++) {
526
+ const currecy = response[i];
527
+ const currencyId = this.safeString(currecy, 'symbol');
528
+ const code = this.safeCurrencyCode(currencyId);
529
+ const networks = this.safeList(currecy, 'tokens', []);
530
+ const parsedNetworks = {};
531
+ for (let j = 0; j < networks.length; j++) {
532
+ const network = networks[j];
533
+ const networkId = this.safeString(network, 'blockchain');
534
+ const networkIdLowerCase = this.safeStringLower(network, 'blockchain');
535
+ const networkCode = this.networkIdToCode(networkIdLowerCase);
536
+ parsedNetworks[networkCode] = {
537
+ 'id': networkId,
538
+ 'network': networkCode,
539
+ 'limits': {
540
+ 'withdraw': {
541
+ 'min': this.safeNumber(network, 'minimumWithdrawal'),
542
+ 'max': this.parseNumber(this.omitZero(this.safeString(network, 'maximumWithdrawal'))),
543
+ },
544
+ 'deposit': {
545
+ 'min': this.safeNumber(network, 'minimumDeposit'),
546
+ 'max': undefined,
547
+ },
548
+ },
549
+ 'active': undefined,
550
+ 'deposit': this.safeBool(network, 'depositEnabled'),
551
+ 'withdraw': this.safeBool(network, 'withdrawEnabled'),
552
+ 'fee': this.safeNumber(network, 'withdrawalFee'),
553
+ 'precision': undefined,
554
+ 'info': network,
555
+ };
556
+ }
557
+ let active = undefined;
558
+ let deposit = undefined;
559
+ let withdraw = undefined;
560
+ if (this.isEmpty(parsedNetworks)) { // if networks are not provided
561
+ active = false;
562
+ deposit = false;
563
+ withdraw = false;
564
+ }
565
+ result[code] = this.safeCurrencyStructure({
566
+ 'id': currencyId,
567
+ 'code': code,
568
+ 'precision': undefined,
569
+ 'type': 'crypto',
570
+ 'name': this.safeString(currecy, 'displayName'),
571
+ 'active': active,
572
+ 'deposit': deposit,
573
+ 'withdraw': withdraw,
574
+ 'fee': undefined,
575
+ 'limits': {
576
+ 'deposit': {
577
+ 'min': undefined,
578
+ 'max': undefined,
579
+ },
580
+ 'withdraw': {
581
+ 'min': undefined,
582
+ 'max': undefined,
583
+ },
584
+ },
585
+ 'networks': parsedNetworks,
586
+ 'info': currecy,
587
+ });
588
+ }
589
+ return result;
590
+ }
591
+ /**
592
+ * @method
593
+ * @name backpack#fetchMarkets
594
+ * @description retrieves data on all markets for bitbank
595
+ * @see https://docs.backpack.exchange/#tag/Markets/operation/get_markets
596
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
597
+ * @returns {object[]} an array of objects representing market data
598
+ */
599
+ async fetchMarkets(params = {}) {
600
+ if (this.options['adjustForTimeDifference']) {
601
+ await this.loadTimeDifference();
602
+ }
603
+ const response = await this.publicGetApiV1Markets(params);
604
+ return this.parseMarkets(response);
605
+ }
606
+ parseMarket(market) {
607
+ //
608
+ // [
609
+ // {
610
+ // "baseSymbol": "SOL",
611
+ // "createdAt": "2025-01-21T06:34:54.691858",
612
+ // "filters": {
613
+ // "price": {
614
+ // "borrowmarketFeeMaxMultiplier": null,
615
+ // "borrowmarketFeeMinMultiplier": null,
616
+ // "maxImpactMultiplier": "1.03",
617
+ // "maxMultiplier": "1.25",
618
+ // "maxPrice": null,
619
+ // "meanMarkPriceBand": {
620
+ // "maxMultiplier": "1.15",
621
+ // "minMultiplier": "0.9"
622
+ // },
623
+ // "meanPremiumBand": null,
624
+ // "minImpactMultiplier": "0.97",
625
+ // "minMultiplier": "0.75",
626
+ // "minPrice": "0.01",
627
+ // "tickSize": "0.01"
628
+ // },
629
+ // "quantity": {
630
+ // "maxQuantity": null,
631
+ // "minQuantity": "0.01",
632
+ // "stepSize": "0.01"
633
+ // }
634
+ // },
635
+ // "fundingInterval": 28800000,
636
+ // "fundingRateLowerBound": null,
637
+ // "fundingRateUpperBound": null,
638
+ // "imfFunction": null,
639
+ // "marketType": "SPOT",
640
+ // "mmfFunction": null,
641
+ // "openInterestLimit": "0",
642
+ // "orderBookState": "Open",
643
+ // "quoteSymbol": "USDC",
644
+ // "symbol": "SOL_USDC"
645
+ // },
646
+ // {
647
+ // "baseSymbol": "SOL",
648
+ // "createdAt": "2025-01-21T06:34:54.691858",
649
+ // "filters": {
650
+ // "price": {
651
+ // "borrowEntryFeeMaxMultiplier": null,
652
+ // "borrowEntryFeeMinMultiplier": null,
653
+ // "maxImpactMultiplier": "1.03",
654
+ // "maxMultiplier": "1.25",
655
+ // "maxPrice": "1000",
656
+ // "meanMarkPriceBand": {
657
+ // "maxMultiplier": "1.1",
658
+ // "minMultiplier": "0.9"
659
+ // },
660
+ // "meanPremiumBand": {
661
+ // "tolerancePct": "0.05"
662
+ // },
663
+ // "minImpactMultiplier": "0.97",
664
+ // "minMultiplier": "0.75",
665
+ // "minPrice": "0.01",
666
+ // "tickSize": "0.01"
667
+ // },
668
+ // "quantity": {
669
+ // "maxQuantity": null,
670
+ // "minQuantity": "0.01",
671
+ // "stepSize": "0.01"
672
+ // }
673
+ // },
674
+ // "fundingInterval": "28800000",
675
+ // "fundingRateLowerBound": "-100",
676
+ // "fundingRateUpperBound": "100",
677
+ // "imfFunction": {
678
+ // "base": "0.02",
679
+ // "factor": "0.0001275",
680
+ // "type": "sqrt"
681
+ // },
682
+ // "marketType": "PERP",
683
+ // "mmfFunction": {
684
+ // "base": "0.0125",
685
+ // "factor": "0.0000765",
686
+ // "type": "sqrt"
687
+ // },
688
+ // "openInterestLimit": "4000000",
689
+ // "orderBookState": "Open",
690
+ // "quoteSymbol": "USDC",
691
+ // "symbol": "SOL_USDC_PERP"
692
+ // }
693
+ // ]
694
+ //
695
+ const id = this.safeString(market, 'symbol');
696
+ const baseId = this.safeString(market, 'baseSymbol');
697
+ const quoteId = this.safeString(market, 'quoteSymbol');
698
+ const base = this.safeCurrencyCode(baseId);
699
+ const quote = this.safeCurrencyCode(quoteId);
700
+ let symbol = base + '/' + quote;
701
+ const filters = this.safeDict(market, 'filters', {});
702
+ const priceFilter = this.safeDict(filters, 'price', {});
703
+ const maxPrice = this.safeNumber(priceFilter, 'maxPrice');
704
+ const minPrice = this.safeNumber(priceFilter, 'minPrice');
705
+ const pricePrecision = this.safeNumber(priceFilter, 'tickSize');
706
+ const quantityFilter = this.safeDict(filters, 'quantity', {});
707
+ const maxQuantity = this.safeNumber(quantityFilter, 'maxQuantity');
708
+ const minQuantity = this.safeNumber(quantityFilter, 'minQuantity');
709
+ const amountPrecision = this.safeNumber(quantityFilter, 'stepSize');
710
+ let type;
711
+ const typeOfMarket = this.parseMarketType(this.safeString(market, 'marketType'));
712
+ let linear = undefined;
713
+ let inverse = undefined;
714
+ let settle = undefined;
715
+ let settleId = undefined;
716
+ let contractSize = undefined;
717
+ if (typeOfMarket === 'spot') {
718
+ type = 'spot';
719
+ }
720
+ else if (typeOfMarket === 'swap') {
721
+ type = 'swap';
722
+ linear = true;
723
+ inverse = false;
724
+ settleId = this.safeString(market, 'quoteSymbol');
725
+ settle = this.safeCurrencyCode(settleId);
726
+ symbol += ':' + settle;
727
+ contractSize = 1;
728
+ }
729
+ const orderBookState = this.safeString(market, 'orderBookState');
730
+ return this.safeMarketStructure({
731
+ 'id': id,
732
+ 'symbol': symbol,
733
+ 'base': base,
734
+ 'quote': quote,
735
+ 'settle': settle,
736
+ 'baseId': baseId,
737
+ 'quoteId': quoteId,
738
+ 'settleId': settleId,
739
+ 'type': type,
740
+ 'spot': type === 'spot',
741
+ 'margin': type === 'spot',
742
+ 'swap': type === 'swap',
743
+ 'future': false,
744
+ 'option': false,
745
+ 'active': orderBookState === 'Open',
746
+ 'contract': type !== 'spot',
747
+ 'linear': linear,
748
+ 'inverse': inverse,
749
+ 'taker': undefined,
750
+ 'maker': undefined,
751
+ 'contractSize': contractSize,
752
+ 'expiry': undefined,
753
+ 'expiryDatetime': undefined,
754
+ 'strike': undefined,
755
+ 'optionType': undefined,
756
+ 'precision': {
757
+ 'amount': amountPrecision,
758
+ 'price': pricePrecision,
759
+ },
760
+ 'limits': {
761
+ 'leverage': {
762
+ 'min': undefined,
763
+ 'max': undefined,
764
+ },
765
+ 'amount': {
766
+ 'min': minQuantity,
767
+ 'max': maxQuantity,
768
+ },
769
+ 'price': {
770
+ 'min': minPrice,
771
+ 'max': maxPrice,
772
+ },
773
+ 'cost': {
774
+ 'min': undefined,
775
+ 'max': undefined,
776
+ },
777
+ },
778
+ 'created': this.parse8601(this.safeString(market, 'createdAt')),
779
+ 'info': market,
780
+ });
781
+ }
782
+ parseMarketType(type) {
783
+ const types = {
784
+ 'SPOT': 'spot',
785
+ 'PERP': 'swap',
786
+ // current types are described in the docs, but the exchange returns only 'SPOT' and 'PERP'
787
+ // 'IPERP': 'swap',
788
+ // 'DATED': 'swap',
789
+ // 'PREDICTION': 'swap',
790
+ // 'RFQ': 'swap',
791
+ };
792
+ return this.safeString(types, type, type);
793
+ }
794
+ /**
795
+ * @method
796
+ * @name backpack#fetchTickers
797
+ * @see https://docs.backpack.exchange/#tag/Markets/operation/get_tickers
798
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
799
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
800
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
801
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
802
+ */
803
+ async fetchTickers(symbols = undefined, params = {}) {
804
+ await this.loadMarkets();
805
+ const request = {};
806
+ const response = await this.publicGetApiV1Tickers(this.extend(request, params));
807
+ const tickers = this.parseTickers(response);
808
+ return this.filterByArrayTickers(tickers, 'symbol', symbols);
809
+ }
810
+ /**
811
+ * @method
812
+ * @name backpack#fetchTicker
813
+ * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
814
+ * @see https://docs.backpack.exchange/#tag/Markets/operation/get_ticker
815
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
816
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
817
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
818
+ */
819
+ async fetchTicker(symbol, params = {}) {
820
+ await this.loadMarkets();
821
+ const market = this.market(symbol);
822
+ const request = {
823
+ 'symbol': market['id'],
824
+ };
825
+ const response = await this.publicGetApiV1Ticker(this.extend(request, params));
826
+ return this.parseTicker(response, market);
827
+ }
828
+ parseTicker(ticker, market = undefined) {
829
+ //
830
+ // fetchTicker/fetchTickers
831
+ //
832
+ // {
833
+ // "firstPrice": "327.38",
834
+ // "high": "337.99",
835
+ // "lastPrice": "317.14",
836
+ // "low": "300.01",
837
+ // "priceChange": "-10.24",
838
+ // "priceChangePercent": "-0.031279",
839
+ // "quoteVolume": "21584.32278",
840
+ // "symbol": "AAVE_USDC",
841
+ // "trades": "245",
842
+ // "volume": "65.823"
843
+ // }, ...
844
+ //
845
+ const marketId = this.safeString(ticker, 'symbol');
846
+ market = this.safeMarket(marketId, market);
847
+ const symbol = this.safeSymbol(marketId, market);
848
+ const open = this.safeString(ticker, 'firstPrice');
849
+ const last = this.safeString(ticker, 'lastPrice');
850
+ const high = this.safeString(ticker, 'high');
851
+ const low = this.safeString(ticker, 'low');
852
+ const baseVolume = this.safeString(ticker, 'volume');
853
+ const quoteVolume = this.safeString(ticker, 'quoteVolume');
854
+ const percentage = this.safeString(ticker, 'priceChangePercent');
855
+ const change = this.safeString(ticker, 'priceChange');
856
+ return this.safeTicker({
857
+ 'symbol': symbol,
858
+ 'timestamp': undefined,
859
+ 'datetime': undefined,
860
+ 'high': high,
861
+ 'low': low,
862
+ 'bid': undefined,
863
+ 'bidVolume': undefined,
864
+ 'ask': undefined,
865
+ 'askVolume': undefined,
866
+ 'vwap': undefined,
867
+ 'open': open,
868
+ 'close': last,
869
+ 'last': last,
870
+ 'previousClose': undefined,
871
+ 'change': change,
872
+ 'percentage': percentage,
873
+ 'average': undefined,
874
+ 'baseVolume': baseVolume,
875
+ 'quoteVolume': quoteVolume,
876
+ 'markPrice': undefined,
877
+ 'indexPrice': undefined,
878
+ 'info': ticker,
879
+ }, market);
880
+ }
881
+ /**
882
+ * @method
883
+ * @name backpack#fetchOrderBook
884
+ * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
885
+ * @see https://docs.backpack.exchange/#tag/Markets/operation/get_depth
886
+ * @param {string} symbol unified symbol of the market to fetch the order book for
887
+ * @param {int} [limit] the maximum amount of order book entries to return (default 100, max 200)
888
+ * @param {object} [params] extra parameters specific to the bitteam api endpoint
889
+ * @returns {object} A dictionary of [order book structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-book-structure} indexed by market symbols
890
+ */
891
+ async fetchOrderBook(symbol, limit = undefined, params = {}) {
892
+ await this.loadMarkets();
893
+ const market = this.market(symbol);
894
+ const request = {
895
+ 'symbol': market['id'],
896
+ };
897
+ const response = await this.publicGetApiV1Depth(this.extend(request, params));
898
+ //
899
+ // {
900
+ // "asks": [
901
+ // ["118318.3","0.00633"],
902
+ // ["118567.2","0.08450"]
903
+ // ],
904
+ // "bids": [
905
+ // ["1.0","0.38647"],
906
+ // ["12.9","1.00000"]
907
+ // ],
908
+ // "lastUpdateId":"1504999670",
909
+ // "timestamp":1753102447307501
910
+ // }
911
+ //
912
+ const microseconds = this.safeInteger(response, 'timestamp');
913
+ const timestamp = this.parseToInt(microseconds / 1000);
914
+ const orderbook = this.parseOrderBook(response, symbol, timestamp);
915
+ orderbook['nonce'] = this.safeInteger(response, 'lastUpdateId');
916
+ return orderbook;
917
+ }
918
+ /**
919
+ * @method
920
+ * @name backpack#fetchOHLCV
921
+ * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
922
+ * @see https://docs.backpack.exchange/#tag/Markets/operation/get_klines
923
+ * @param {string} symbol unified symbol of the market to fetch OHLCV data for
924
+ * @param {string} timeframe the length of time each candle represents
925
+ * @param {int} [since] timestamp in seconds of the earliest candle to fetch
926
+ * @param {int} [limit] the maximum amount of candles to fetch (default 100)
927
+ * @param {object} [params] extra parameters specific to the bitteam api endpoint
928
+ * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
929
+ */
930
+ async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
931
+ await this.loadMarkets();
932
+ const market = this.market(symbol);
933
+ const interval = this.safeString(this.timeframes, timeframe, timeframe);
934
+ const request = {
935
+ 'symbol': market['id'],
936
+ 'interval': interval,
937
+ };
938
+ let until = undefined;
939
+ [until, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'until');
940
+ if (until !== undefined) {
941
+ request['endTime'] = this.parseToInt(until / 1000); // convert milliseconds to seconds
942
+ }
943
+ const defaultLimit = 100;
944
+ if (since === undefined) {
945
+ if (limit === undefined) {
946
+ limit = defaultLimit;
947
+ }
948
+ const duration = this.parseTimeframe(timeframe);
949
+ const endTime = until ? this.parseToInt(until / 1000) : this.seconds();
950
+ const startTime = endTime - (limit * duration);
951
+ request['startTime'] = startTime;
952
+ }
953
+ else {
954
+ request['startTime'] = this.parseToInt(since / 1000); // convert milliseconds to seconds
955
+ }
956
+ const price = this.safeString(params, 'price');
957
+ if (price !== undefined) {
958
+ request['priceType'] = this.capitalize(price);
959
+ params = this.omit(params, 'price');
960
+ }
961
+ const response = await this.publicGetApiV1Klines(this.extend(request, params));
962
+ return this.parseOHLCVs(response, market, timeframe, since, limit);
963
+ }
964
+ parseOHLCV(ohlcv, market = undefined) {
965
+ //
966
+ // [
967
+ // {
968
+ // "close": "118294.6",
969
+ // "end": "2025-07-19 13:12:00",
970
+ // "high": "118297.6",
971
+ // "low": "118237.5",
972
+ // "open": "118238",
973
+ // "quoteVolume": "4106.558156",
974
+ // "start": "2025-07-19 13:09:00",
975
+ // "trades": "12",
976
+ // "volume": "0.03473"
977
+ // },
978
+ // ...
979
+ // ]
980
+ //
981
+ return [
982
+ this.parse8601(this.safeString(ohlcv, 'start')),
983
+ this.safeNumber(ohlcv, 'open'),
984
+ this.safeNumber(ohlcv, 'high'),
985
+ this.safeNumber(ohlcv, 'low'),
986
+ this.safeNumber(ohlcv, 'close'),
987
+ this.safeNumber(ohlcv, 'volume'),
988
+ ];
989
+ }
990
+ /**
991
+ * @method
992
+ * @name backpack#fetchFundingRate
993
+ * @description fetch the current funding rate
994
+ * @see https://docs.backpack.exchange/#tag/Markets/operation/get_mark_prices
995
+ * @param {string} symbol unified market symbol
996
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
997
+ * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
998
+ */
999
+ async fetchFundingRate(symbol, params = {}) {
1000
+ await this.loadMarkets();
1001
+ const market = this.market(symbol);
1002
+ if (market['spot']) {
1003
+ throw new errors.BadRequest(this.id + ' fetchFundingRate() symbol does not support market ' + symbol);
1004
+ }
1005
+ const request = {
1006
+ 'symbol': market['id'],
1007
+ };
1008
+ const response = await this.publicGetApiV1MarkPrices(this.extend(request, params));
1009
+ const data = this.safeDict(response, 0, {});
1010
+ return this.parseFundingRate(data, market);
1011
+ }
1012
+ parseFundingRate(contract, market = undefined) {
1013
+ //
1014
+ // {
1015
+ // "fundingRate": "0.0001",
1016
+ // "indexPrice": "118333.18643195",
1017
+ // "markPrice": "118343.51853741",
1018
+ // "nextFundingTimestamp": 1753113600000,
1019
+ // "symbol": "BTC_USDC_PERP"
1020
+ // }
1021
+ //
1022
+ const marketId = this.safeString(contract, 'symbol');
1023
+ market = this.safeMarket(marketId, market);
1024
+ const symbol = this.safeSymbol(marketId, market);
1025
+ const nextFundingTimestamp = this.safeInteger(contract, 'nextFundingTimestamp');
1026
+ return {
1027
+ 'info': contract,
1028
+ 'symbol': symbol,
1029
+ 'markPrice': this.safeNumber(contract, 'markPrice'),
1030
+ 'indexPrice': this.safeNumber(contract, 'indexPrice'),
1031
+ 'interestRate': undefined,
1032
+ 'estimatedSettlePrice': undefined,
1033
+ 'timestamp': undefined,
1034
+ 'datetime': undefined,
1035
+ 'fundingRate': this.safeNumber(contract, 'fundingRate'),
1036
+ 'fundingTimestamp': undefined,
1037
+ 'fundingDatetime': undefined,
1038
+ 'nextFundingRate': undefined,
1039
+ 'nextFundingTimestamp': nextFundingTimestamp,
1040
+ 'nextFundingDatetime': this.iso8601(nextFundingTimestamp),
1041
+ 'previousFundingRate': undefined,
1042
+ 'previousFundingTimestamp': undefined,
1043
+ 'previousFundingDatetime': undefined,
1044
+ 'interval': '1h',
1045
+ };
1046
+ }
1047
+ /**
1048
+ * @method
1049
+ * @name backpack#fetchOpenInterest
1050
+ * @description Retrieves the open interest of a derivative trading pair
1051
+ * @see https://docs.backpack.exchange/#tag/Markets/operation/get_open_interest
1052
+ * @param {string} symbol Unified CCXT market symbol
1053
+ * @param {object} [params] exchange specific parameters
1054
+ * @returns {object} an open interest structure{@link https://docs.ccxt.com/#/?id=interest-history-structure}
1055
+ */
1056
+ async fetchOpenInterest(symbol, params = {}) {
1057
+ await this.loadMarkets();
1058
+ const market = this.market(symbol);
1059
+ if (market['spot']) {
1060
+ throw new errors.BadRequest(this.id + ' fetchOpenInterest() symbol does not support market ' + symbol);
1061
+ }
1062
+ const request = {
1063
+ 'symbol': market['id'],
1064
+ };
1065
+ const response = await this.publicGetApiV1OpenInterest(this.extend(request, params));
1066
+ const interest = this.safeDict(response, 0, {});
1067
+ return this.parseOpenInterest(interest, market);
1068
+ }
1069
+ parseOpenInterest(interest, market = undefined) {
1070
+ //
1071
+ // [
1072
+ // {
1073
+ // "openInterest": "1273.85214",
1074
+ // "symbol": "BTC_USDC_PERP",
1075
+ // "timestamp":1753105735301
1076
+ // }
1077
+ // ]
1078
+ //
1079
+ const timestamp = this.safeInteger(interest, 'timestamp');
1080
+ const openInterest = this.safeNumber(interest, 'openInterest');
1081
+ return this.safeOpenInterest({
1082
+ 'symbol': market['symbol'],
1083
+ 'openInterestAmount': undefined,
1084
+ 'openInterestValue': openInterest,
1085
+ 'timestamp': timestamp,
1086
+ 'datetime': this.iso8601(timestamp),
1087
+ 'info': interest,
1088
+ }, market);
1089
+ }
1090
+ /**
1091
+ * @method
1092
+ * @name backpack#fetchFundingRateHistory
1093
+ * @description fetches historical funding rate prices
1094
+ * @see https://docs.backpack.exchange/#tag/Markets/operation/get_funding_interval_rates
1095
+ * @param {string} symbol unified symbol of the market to fetch the funding rate history for
1096
+ * @param {int} [since] timestamp in ms of the earliest funding rate to fetch
1097
+ * @param {int} [limit] the maximum amount of funding rate structures
1098
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1099
+ * @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure}
1100
+ */
1101
+ async fetchFundingRateHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1102
+ if (symbol === undefined) {
1103
+ throw new errors.ArgumentsRequired(this.id + ' fetchFundingRateHistory() requires a symbol argument');
1104
+ }
1105
+ await this.loadMarkets();
1106
+ const market = this.market(symbol);
1107
+ const request = {
1108
+ 'symbol': market['id'],
1109
+ };
1110
+ if (limit !== undefined) {
1111
+ request['limit'] = Math.min(limit, 1000); // api maximum 1000
1112
+ }
1113
+ const response = await this.publicGetApiV1FundingRates(this.extend(request, params));
1114
+ //
1115
+ // [
1116
+ // {
1117
+ // "fundingRate": "0.0001",
1118
+ // "intervalEndTimestamp": "2025-07-22T00:00:00",
1119
+ // "symbol": "BTC_USDC_PERP"
1120
+ // }
1121
+ // ]
1122
+ //
1123
+ const rates = [];
1124
+ for (let i = 0; i < response.length; i++) {
1125
+ const rate = response[i];
1126
+ const datetime = this.safeString(rate, 'intervalEndTimestamp');
1127
+ const timestamp = this.parse8601(datetime);
1128
+ rates.push({
1129
+ 'info': rate,
1130
+ 'symbol': market['symbol'],
1131
+ 'fundingRate': this.safeNumber(rate, 'fundingRate'),
1132
+ 'timestamp': timestamp,
1133
+ 'datetime': datetime,
1134
+ });
1135
+ }
1136
+ const sorted = this.sortBy(rates, 'timestamp');
1137
+ return this.filterBySymbolSinceLimit(sorted, market['symbol'], since, limit);
1138
+ }
1139
+ /**
1140
+ * @method
1141
+ * @name backpack#fetchTrades
1142
+ * @description get the list of most recent trades for a particular symbol
1143
+ * @see https://docs.backpack.exchange/#tag/Trades/operation/get_recent_trades
1144
+ * @see https://docs.backpack.exchange/#tag/Trades/operation/get_historical_trades
1145
+ * @param {string} symbol unified symbol of the market to fetch trades for
1146
+ * @param {int} [since] timestamp in ms of the earliest trade to fetch
1147
+ * @param {int} [limit] the maximum amount of trades to fetch
1148
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1149
+ * @param {int} [params.offset] the number of trades to skip, default is 0
1150
+ * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
1151
+ */
1152
+ async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
1153
+ await this.loadMarkets();
1154
+ const market = this.market(symbol);
1155
+ const request = {
1156
+ 'symbol': market['id'],
1157
+ };
1158
+ if (limit !== undefined) {
1159
+ request['limit'] = Math.min(limit, 1000); // api maximum 1000
1160
+ }
1161
+ let response = undefined;
1162
+ const offset = this.safeInteger(params, 'offset');
1163
+ if (offset !== undefined) {
1164
+ response = await this.publicGetApiV1TradesHistory(this.extend(request, params));
1165
+ }
1166
+ else {
1167
+ response = await this.publicGetApiV1Trades(this.extend(request, params));
1168
+ }
1169
+ return this.parseTrades(response, market, since, limit);
1170
+ }
1171
+ /**
1172
+ * @method
1173
+ * @name backpack#fetchMyTrades
1174
+ * @description fetch all trades made by the user
1175
+ * @see https://docs.backpack.exchange/#tag/History/operation/get_fills
1176
+ * @param {string} symbol unified market symbol
1177
+ * @param {int} [since] the earliest time in ms to fetch trades for
1178
+ * @param {int} [limit] the maximum number of trades structures to retrieve (default 100, max 1000)
1179
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1180
+ * @param {int} [params.until] the latest time in ms to fetch trades for
1181
+ * @param {string} [params.fillType] 'User' (default) 'BookLiquidation' or 'Adl' or 'Backstop' or 'Liquidation' or 'AllLiquidation' or 'CollateralConversion' or 'CollateralConversionAndSpotLiquidation'
1182
+ * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
1183
+ */
1184
+ async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1185
+ await this.loadMarkets();
1186
+ const request = {};
1187
+ let market = undefined;
1188
+ if (symbol !== undefined) {
1189
+ market = this.market(symbol);
1190
+ request['symbol'] = market['id'];
1191
+ }
1192
+ if (since !== undefined) {
1193
+ request['from'] = since;
1194
+ }
1195
+ if (limit !== undefined) {
1196
+ request['limit'] = limit;
1197
+ }
1198
+ const until = this.safeInteger(params, 'until');
1199
+ if (until !== undefined) {
1200
+ params = this.omit(params, ['until']);
1201
+ request['to'] = until;
1202
+ }
1203
+ const fillType = this.safeString(params, 'fillType');
1204
+ if (fillType === undefined) {
1205
+ request['fillType'] = 'User'; // default
1206
+ }
1207
+ const response = await this.privateGetWapiV1HistoryFills(this.extend(request, params));
1208
+ return this.parseTrades(response, market, since, limit);
1209
+ }
1210
+ parseTrade(trade, market = undefined) {
1211
+ //
1212
+ // fetchTrades
1213
+ // {
1214
+ // "id": 8721564,
1215
+ // "isBuyerMaker": false,
1216
+ // "price": "117427.6",
1217
+ // "quantity": "0.00016",
1218
+ // "quoteQuantity": "18.788416",
1219
+ // "timestamp": 1753123916818
1220
+ // }
1221
+ //
1222
+ // fetchMyTrades
1223
+ // {
1224
+ // "clientId": null,
1225
+ // "fee": "0.004974",
1226
+ // "feeSymbol": "USDC",
1227
+ // "isMaker": false,
1228
+ // "orderId": "4238907375",
1229
+ // "price": "3826.15",
1230
+ // "quantity": "0.0026",
1231
+ // "side": "Bid",
1232
+ // "symbol": "ETH_USDC_PERP",
1233
+ // "systemOrderType": null,
1234
+ // "timestamp": "2025-07-27T17:39:00.092",
1235
+ // "tradeId": 9748827
1236
+ // }
1237
+ //
1238
+ const id = this.safeString2(trade, 'id', 'tradeId');
1239
+ const marketId = this.safeString(trade, 'symbol');
1240
+ market = this.safeMarket(marketId, market);
1241
+ const price = this.safeString(trade, 'price');
1242
+ const amount = this.safeString(trade, 'quantity');
1243
+ const isMaker = this.safeBool(trade, 'isMaker');
1244
+ const takerOrMaker = isMaker ? 'maker' : 'taker';
1245
+ const orderId = this.safeString(trade, 'orderId');
1246
+ const side = this.parseOrderSide(this.safeString(trade, 'side'));
1247
+ let fee = undefined;
1248
+ const feeAmount = this.safeString(trade, 'fee');
1249
+ let timestamp = this.safeInteger(trade, 'timestamp');
1250
+ if (feeAmount !== undefined) {
1251
+ // if fetchMyTrades
1252
+ const datetime = this.safeString(trade, 'timestamp');
1253
+ timestamp = this.parse8601(datetime);
1254
+ }
1255
+ const feeSymbol = this.safeCurrencyCode(this.safeString(trade, 'feeSymbol'));
1256
+ if (feeAmount !== undefined) {
1257
+ fee = {
1258
+ 'cost': feeAmount,
1259
+ 'currency': feeSymbol,
1260
+ 'rate': undefined,
1261
+ };
1262
+ }
1263
+ return this.safeTrade({
1264
+ 'info': trade,
1265
+ 'timestamp': timestamp,
1266
+ 'datetime': this.iso8601(timestamp),
1267
+ 'symbol': market['symbol'],
1268
+ 'id': id,
1269
+ 'order': orderId,
1270
+ 'type': undefined,
1271
+ 'side': side,
1272
+ 'takerOrMaker': takerOrMaker,
1273
+ 'price': price,
1274
+ 'amount': amount,
1275
+ 'cost': undefined,
1276
+ 'fee': fee,
1277
+ }, market);
1278
+ }
1279
+ /**
1280
+ * @method
1281
+ * @name backpack#fetchStatus
1282
+ * @description the latest known information on the availability of the exchange API
1283
+ * @see https://docs.backpack.exchange/#tag/System/operation/get_status
1284
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1285
+ * @returns {object} a [status structure]{@link https://docs.ccxt.com/#/?id=exchange-status-structure}
1286
+ */
1287
+ async fetchStatus(params = {}) {
1288
+ const response = await this.publicGetApiV1Status(params);
1289
+ //
1290
+ // {
1291
+ // "message":null,
1292
+ // "status":"Ok"
1293
+ // }
1294
+ //
1295
+ const status = this.safeString(response, 'status');
1296
+ return {
1297
+ 'status': status.toLowerCase(),
1298
+ 'updated': undefined,
1299
+ 'eta': undefined,
1300
+ 'url': undefined,
1301
+ 'info': response,
1302
+ };
1303
+ }
1304
+ /**
1305
+ * @method
1306
+ * @name backpack#fetchTime
1307
+ * @description fetches the current integer timestamp in milliseconds from the exchange server
1308
+ * @see https://developer-pro.bitmart.com/en/spot/#get-system-time
1309
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1310
+ * @returns {int} the current integer timestamp in milliseconds from the exchange server
1311
+ */
1312
+ async fetchTime(params = {}) {
1313
+ const response = await this.publicGetApiV1Time(params);
1314
+ //
1315
+ // 1753131712992
1316
+ //
1317
+ return this.safeInteger(response, 0, this.milliseconds());
1318
+ }
1319
+ /**
1320
+ * @method
1321
+ * @name backpack#fetchBalance
1322
+ * @description query for balance and get the amount of funds available for trading or funds locked in orders
1323
+ * @see https://docs.backpack.exchange/#tag/Capital/operation/get_balances
1324
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1325
+ * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
1326
+ */
1327
+ async fetchBalance(params = {}) {
1328
+ await this.loadMarkets();
1329
+ const response = await this.privateGetApiV1Capital(params);
1330
+ return this.parseBalance(response);
1331
+ }
1332
+ parseBalance(response) {
1333
+ //
1334
+ // {
1335
+ // "USDC": {
1336
+ // "available": "120",
1337
+ // "locked": "0",
1338
+ // "staked": "0"
1339
+ // }
1340
+ // }
1341
+ //
1342
+ const balanceKeys = Object.keys(response);
1343
+ const result = {};
1344
+ for (let i = 0; i < balanceKeys.length; i++) {
1345
+ const id = balanceKeys[i];
1346
+ const code = this.safeCurrencyCode(id);
1347
+ const balance = response[id];
1348
+ const account = this.account();
1349
+ const locked = this.safeString(balance, 'locked');
1350
+ const staked = this.safeString(balance, 'staked');
1351
+ const used = Precise["default"].stringAdd(locked, staked);
1352
+ account['free'] = this.safeString(balance, 'available');
1353
+ account['used'] = used;
1354
+ result[code] = account;
1355
+ }
1356
+ return this.safeBalance(result);
1357
+ }
1358
+ /**
1359
+ * @method
1360
+ * @name backpack#fetchDeposits
1361
+ * @description fetch all deposits made to an account
1362
+ * @see https://docs.backpack.exchange/#tag/Capital/operation/get_deposits
1363
+ * @param {string} code unified currency code
1364
+ * @param {int} [since] the earliest time in ms to fetch deposits for
1365
+ * @param {int} [limit] the maximum number of deposits structures to retrieve
1366
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1367
+ * @param {int} [params.until] the latest time in ms to fetch entries for
1368
+ * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
1369
+ */
1370
+ async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
1371
+ await this.loadMarkets();
1372
+ const request = {};
1373
+ let currency = undefined;
1374
+ if (code !== undefined) {
1375
+ currency = this.currency(code);
1376
+ }
1377
+ if (since !== undefined) {
1378
+ request['from'] = since;
1379
+ }
1380
+ if (limit !== undefined) {
1381
+ request['limit'] = limit; // default 100, max 1000
1382
+ }
1383
+ let until = undefined;
1384
+ [until, params] = this.handleOptionAndParams(params, 'fetchDeposits', 'until');
1385
+ if (until !== undefined) {
1386
+ request['endTime'] = until;
1387
+ }
1388
+ const response = await this.privateGetWapiV1CapitalDeposits(this.extend(request, params));
1389
+ return this.parseTransactions(response, currency, since, limit);
1390
+ }
1391
+ /**
1392
+ * @method
1393
+ * @name backpack#fetchWithdrawals
1394
+ * @description fetch all withdrawals made from an account
1395
+ * @see https://docs.backpack.exchange/#tag/Capital/operation/get_withdrawals
1396
+ * @param {string} code unified currency code of the currency transferred
1397
+ * @param {int} [since] the earliest time in ms to fetch transfers for (default 24 hours ago)
1398
+ * @param {int} [limit] the maximum number of transfer structures to retrieve (default 50, max 200)
1399
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1400
+ * @param {int} [params.until] the latest time in ms to fetch transfers for (default time now)
1401
+ * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
1402
+ */
1403
+ async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
1404
+ await this.loadMarkets();
1405
+ const request = {};
1406
+ let currency = undefined;
1407
+ if (code !== undefined) {
1408
+ currency = this.currency(code);
1409
+ }
1410
+ if (since !== undefined) {
1411
+ request['from'] = since;
1412
+ }
1413
+ if (limit !== undefined) {
1414
+ request['limit'] = limit;
1415
+ }
1416
+ let until = undefined;
1417
+ [until, params] = this.handleOptionAndParams(params, 'fetchWithdrawals', 'until');
1418
+ if (until !== undefined) {
1419
+ request['to'] = until;
1420
+ }
1421
+ const response = await this.privateGetWapiV1CapitalWithdrawals(this.extend(request, params));
1422
+ return this.parseTransactions(response, currency, since, limit);
1423
+ }
1424
+ /**
1425
+ * @method
1426
+ * @name backpack#withdraw
1427
+ * @description make a withdrawal
1428
+ * @see https://docs.backpack.exchange/#tag/Capital/operation/request_withdrawal
1429
+ * @param {string} code unified currency code
1430
+ * @param {float} amount the amount to withdraw
1431
+ * @param {string} address the address to withdraw to
1432
+ * @param {string} tag
1433
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1434
+ * @param {string} [params.network] the network to withdraw on (mandatory)
1435
+ * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
1436
+ */
1437
+ async withdraw(code, amount, address, tag = undefined, params = {}) {
1438
+ await this.loadMarkets();
1439
+ const currency = this.currency(code);
1440
+ const request = {
1441
+ 'symbol': currency['id'],
1442
+ 'amount': this.numberToString(amount),
1443
+ 'address': address,
1444
+ };
1445
+ if (tag !== undefined) {
1446
+ request['clientId'] = tag; // memo or tag
1447
+ }
1448
+ const [networkCode, query] = this.handleNetworkCodeAndParams(params);
1449
+ const networkId = this.networkCodeToId(networkCode);
1450
+ if (networkId === undefined) {
1451
+ throw new errors.BadRequest(this.id + ' withdraw() requires a network parameter');
1452
+ }
1453
+ request['blockchain'] = networkId;
1454
+ const response = await this.privatePostWapiV1CapitalWithdrawals(this.extend(request, query));
1455
+ return this.parseTransaction(response, currency);
1456
+ }
1457
+ parseTransaction(transaction, currency = undefined) {
1458
+ //
1459
+ // fetchDeposits
1460
+ // [
1461
+ // {
1462
+ // "createdAt": "2025-07-23T13:55:54.267",
1463
+ // "fiatAmount": null,
1464
+ // "fiatCurrency": null,
1465
+ // "fromAddress": "0x2e3ab3e88a7dbdc763aadf5b28c18fb085af420a",
1466
+ // "id": 6695353,
1467
+ // "institutionBic": null,
1468
+ // "platformMemo": null,
1469
+ // "quantity": "120",
1470
+ // "source": "ethereum",
1471
+ // "status": "confirmed",
1472
+ // "symbol": "USDC",
1473
+ // "toAddress": "0xfBe7CbfCde93c8a4204a4be6B56732Eb32690170",
1474
+ // "transactionHash": "0x58edaac415398d617b34c6673fffcaf0024990d5700565030119db5cbf3765d1"
1475
+ // }
1476
+ // ]
1477
+ //
1478
+ // withdraw
1479
+ // {
1480
+ // "accountIdentifier": null,
1481
+ // "bankIdentifier": null,
1482
+ // "bankName": null,
1483
+ // "blockchain": "Ethereum",
1484
+ // "clientId": null,
1485
+ // "createdAt": "2025-08-13T19:27:13.817",
1486
+ // "fee": "3",
1487
+ // "fiatFee": null,
1488
+ // "fiatState": null,
1489
+ // "fiatSymbol": null,
1490
+ // "id": 5479929,
1491
+ // "identifier": null,
1492
+ // "isInternal": false,
1493
+ // "providerId": null,
1494
+ // "quantity": "10",
1495
+ // "status": "pending",
1496
+ // "subaccountId": null,
1497
+ // "symbol": "USDC",
1498
+ // "toAddress": "0x0ad42b8e602c2d3d475ae52d678cf63d84ab2749",
1499
+ // "transactionHash": null,
1500
+ // "triggerAt": null
1501
+ // }
1502
+ //
1503
+ // fetchWithdrawals
1504
+ // [
1505
+ // {
1506
+ // "accountIdentifier": null,
1507
+ // "bankIdentifier": null,
1508
+ // "bankName": null,
1509
+ // "blockchain": "Ethereum",
1510
+ // "clientId": null,
1511
+ // "createdAt": "2025-08-13T19:27:13.817",
1512
+ // "fee": "3",
1513
+ // "fiatFee": null,
1514
+ // "fiatState": null,
1515
+ // "fiatSymbol": null,
1516
+ // "id": 5479929,
1517
+ // "identifier": null,
1518
+ // "isInternal": false,
1519
+ // "providerId": null,
1520
+ // "quantity": "10",
1521
+ // "status": "confirmed",
1522
+ // "subaccountId": null,
1523
+ // "symbol": "USDC",
1524
+ // "toAddress": "0x0ad42b8e602c2d3d475ae52d678cf63d84ab2749",
1525
+ // "transactionHash": "0x658b6d082af4afa0d3cf85caf344ff7c19d980117726bf193b00d8850f8746a1",
1526
+ // "triggerAt": null
1527
+ // }
1528
+ // ]
1529
+ //
1530
+ const status = this.parseTransactionStatus(this.safeString(transaction, 'status'));
1531
+ const id = this.safeString(transaction, 'id');
1532
+ const txid = this.safeString(transaction, 'transactionHash');
1533
+ const coin = this.safeString(transaction, 'symbol');
1534
+ const code = this.safeCurrencyCode(coin, currency);
1535
+ const timestamp = this.parse8601(this.safeString(transaction, 'createdAt'));
1536
+ const amount = this.safeNumber(transaction, 'quantity');
1537
+ const networkId = this.safeStringLower2(transaction, 'source', 'blockchain');
1538
+ const network = this.networkIdToCode(networkId);
1539
+ const addressTo = this.safeString(transaction, 'toAddress');
1540
+ const addressFrom = this.safeString(transaction, 'fromAddress');
1541
+ const tag = this.safeString(transaction, 'platformMemo');
1542
+ const feeCost = this.safeNumber(transaction, 'fee');
1543
+ const internal = this.safeBool(transaction, 'isInternal', false);
1544
+ let fee = undefined;
1545
+ if (feeCost !== undefined) {
1546
+ fee = {
1547
+ 'cost': feeCost,
1548
+ 'currency': code,
1549
+ };
1550
+ }
1551
+ return {
1552
+ 'info': transaction,
1553
+ 'id': id,
1554
+ 'txid': txid,
1555
+ 'timestamp': timestamp,
1556
+ 'datetime': this.iso8601(timestamp),
1557
+ 'network': network,
1558
+ 'address': undefined,
1559
+ 'addressTo': addressTo,
1560
+ 'addressFrom': addressFrom,
1561
+ 'tag': tag,
1562
+ 'tagTo': undefined,
1563
+ 'tagFrom': undefined,
1564
+ 'type': undefined,
1565
+ 'amount': amount,
1566
+ 'currency': code,
1567
+ 'status': status,
1568
+ 'updated': undefined,
1569
+ 'internal': internal,
1570
+ 'comment': undefined,
1571
+ 'fee': fee,
1572
+ };
1573
+ }
1574
+ parseTransactionStatus(status) {
1575
+ const statuses = {
1576
+ 'cancelled': 'cancelled',
1577
+ 'confirmed': 'ok',
1578
+ 'declined': 'declined',
1579
+ 'expired': 'expired',
1580
+ 'initiated': 'initiated',
1581
+ 'pending': 'pending',
1582
+ 'refunded': 'refunded',
1583
+ 'information required': 'pending',
1584
+ };
1585
+ return this.safeString(statuses, status, status);
1586
+ }
1587
+ /**
1588
+ * @method
1589
+ * @name backpack#fetchDepositAddress
1590
+ * @description fetch the deposit address for a currency associated with this account
1591
+ * @see https://docs.backpack.exchange/#tag/Capital/operation/get_deposit_address
1592
+ * @param {string} code unified currency code
1593
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1594
+ * @param {string} [params.networkCode] the network to fetch the deposit address (mandatory)
1595
+ * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
1596
+ */
1597
+ async fetchDepositAddress(code, params = {}) {
1598
+ await this.loadMarkets();
1599
+ let networkCode = undefined;
1600
+ [networkCode, params] = this.handleNetworkCodeAndParams(params);
1601
+ if (networkCode === undefined) {
1602
+ throw new errors.ArgumentsRequired(this.id + ' fetchDepositAddress() requires a network parameter, see https://docs.ccxt.com/#/?id=network-codes');
1603
+ }
1604
+ const currency = this.currency(code);
1605
+ const request = {
1606
+ 'blockchain': this.networkCodeToId(networkCode),
1607
+ };
1608
+ const response = await this.privateGetWapiV1CapitalDepositAddress(this.extend(request, params));
1609
+ return this.parseDepositAddress(response, currency);
1610
+ }
1611
+ parseDepositAddress(depositAddress, currency = undefined) {
1612
+ //
1613
+ // {
1614
+ // "address": "0xfBe7CbfCde93c8a4204a4be6B56732Eb32690170"
1615
+ // }
1616
+ //
1617
+ const address = this.safeString(depositAddress, 'address');
1618
+ const currencyId = this.safeString(depositAddress, 'currency');
1619
+ currency = this.safeCurrency(currencyId, currency);
1620
+ return {
1621
+ 'info': depositAddress,
1622
+ 'currency': currency['code'],
1623
+ 'network': undefined,
1624
+ 'address': address,
1625
+ 'tag': undefined,
1626
+ };
1627
+ }
1628
+ /**
1629
+ * @method
1630
+ * @name backpack#createOrder
1631
+ * @description create a trade order
1632
+ * @see https://docs.backpack.exchange/#tag/Order/operation/execute_order
1633
+ * @param {string} symbol unified symbol of the market to create an order in
1634
+ * @param {string} type 'market' or 'limit'
1635
+ * @param {string} side 'buy' or 'sell'
1636
+ * @param {float} amount how much of currency you want to trade in units of base currency
1637
+ * @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
1638
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1639
+ * @param {float} [params.cost] *market orders only* the cost of the order in units of the quote currency (could be used instead of amount)
1640
+ * @param {int} [params.clientOrderId] a unique id for the order
1641
+ * @param {boolean} [params.postOnly] true to place a post only order
1642
+ * @param {string} [params.timeInForce] 'GTC', 'IOC', 'FOK' or 'PO'
1643
+ * @param {bool} [params.reduceOnly] *contract only* Indicates if this order is to reduce the size of a position
1644
+ * @param {string} [params.selfTradePrevention] 'RejectTaker', 'RejectMaker' or 'RejectBoth'
1645
+ * @param {bool} [params.autoLend] *spot margin only* if true then the order can lend
1646
+ * @param {bool} [params.autoLendRedeem] *spot margin only* if true then the order can redeem a lend if required
1647
+ * @param {bool} [params.autoBorrow] *spot margin only* if true then the order can borrow
1648
+ * @param {bool} [params.autoBorrowRepay] *spot margin only* if true then the order can repay a borrow
1649
+ * @param {float} [params.triggerPrice] the price that a trigger order is triggered at
1650
+ * @param {object} [params.takeProfit] *swap markets only - takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered
1651
+ * @param {float} [params.takeProfit.triggerPrice] take profit trigger price
1652
+ * @param {float} [params.takeProfit.price] take profit order price (if not provided the order will be a market order)
1653
+ * @param {object} [params.stopLoss] *swap markets only - stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered
1654
+ * @param {float} [params.stopLoss.triggerPrice] stop loss trigger price
1655
+ * @param {float} [params.stopLoss.price] stop loss order price (if not provided the order will be a market order)
1656
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1657
+ */
1658
+ async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
1659
+ await this.loadMarkets();
1660
+ const market = this.market(symbol);
1661
+ const orderRequest = this.createOrderRequest(symbol, type, side, amount, price, params);
1662
+ const response = await this.privatePostApiV1Order(orderRequest);
1663
+ return this.parseOrder(response, market);
1664
+ }
1665
+ /**
1666
+ * @method
1667
+ * @name backpack#createOrders
1668
+ * @description create a list of trade orders
1669
+ * @see https://docs.backpack.exchange/#tag/Order/operation/execute_order_batch
1670
+ * @param {Array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
1671
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1672
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1673
+ */
1674
+ async createOrders(orders, params = {}) {
1675
+ await this.loadMarkets();
1676
+ const ordersRequests = [];
1677
+ for (let i = 0; i < orders.length; i++) {
1678
+ const rawOrder = orders[i];
1679
+ const marketId = this.safeString(rawOrder, 'symbol');
1680
+ const type = this.safeString(rawOrder, 'type');
1681
+ const side = this.safeString(rawOrder, 'side');
1682
+ const amount = this.safeNumber(rawOrder, 'amount');
1683
+ const price = this.safeNumber(rawOrder, 'price');
1684
+ const orderParams = this.safeDict(rawOrder, 'params', {});
1685
+ const extendedParams = this.extend(orderParams, params); // the request does not accept extra params since it's a list, so we're extending each order with the common params
1686
+ const orderRequest = this.createOrderRequest(marketId, type, side, amount, price, extendedParams);
1687
+ ordersRequests.push(orderRequest);
1688
+ }
1689
+ const response = await this.privatePostApiV1Orders(ordersRequests);
1690
+ return this.parseOrders(response);
1691
+ }
1692
+ createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
1693
+ const market = this.market(symbol);
1694
+ const request = {
1695
+ 'symbol': market['id'],
1696
+ 'side': this.encodeOrderSide(side),
1697
+ 'orderType': this.capitalize(type),
1698
+ };
1699
+ const triggerPrice = this.safeString(params, 'triggerPrice');
1700
+ const isTriggerOrder = triggerPrice !== undefined;
1701
+ const quantityKey = isTriggerOrder ? 'triggerQuantity' : 'quantity';
1702
+ // handle basic limit/market order types
1703
+ if (type === 'limit') {
1704
+ request['price'] = this.priceToPrecision(symbol, price);
1705
+ request[quantityKey] = this.amountToPrecision(symbol, amount);
1706
+ }
1707
+ else if (type === 'market') {
1708
+ const cost = this.safeString2(params, 'cost', 'quoteQuantity');
1709
+ if (cost !== undefined) {
1710
+ request['quoteQuantity'] = this.costToPrecision(symbol, cost);
1711
+ params = this.omit(params, ['cost', 'quoteQuantity']);
1712
+ }
1713
+ else {
1714
+ request[quantityKey] = this.amountToPrecision(symbol, amount);
1715
+ }
1716
+ }
1717
+ // trigger orders
1718
+ if (isTriggerOrder) {
1719
+ request['triggerPrice'] = this.priceToPrecision(symbol, triggerPrice);
1720
+ params = this.omit(params, 'triggerPrice');
1721
+ }
1722
+ const clientOrderId = this.safeInteger(params, 'clientOrderId'); // the exchange requires uint
1723
+ if (clientOrderId !== undefined) {
1724
+ request['clientId'] = clientOrderId;
1725
+ params = this.omit(params, 'clientOrderId');
1726
+ }
1727
+ let postOnly = false;
1728
+ [postOnly, params] = this.handlePostOnly(type === 'market', false, params);
1729
+ if (postOnly) {
1730
+ params['postOnly'] = true;
1731
+ }
1732
+ const takeProfit = this.safeDict(params, 'takeProfit');
1733
+ if (takeProfit !== undefined) {
1734
+ const takeProfitTriggerPrice = this.safeString(takeProfit, 'triggerPrice');
1735
+ if (takeProfitTriggerPrice !== undefined) {
1736
+ request['takeProfitTriggerPrice'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
1737
+ }
1738
+ const takeProfitPrice = this.safeString(takeProfit, 'price');
1739
+ if (takeProfitPrice !== undefined) {
1740
+ request['takeProfitLimitPrice'] = this.priceToPrecision(symbol, takeProfitPrice);
1741
+ }
1742
+ params = this.omit(params, 'takeProfit');
1743
+ }
1744
+ const stopLoss = this.safeDict(params, 'stopLoss');
1745
+ if (stopLoss !== undefined) {
1746
+ const stopLossTriggerPrice = this.safeString(stopLoss, 'triggerPrice');
1747
+ if (stopLossTriggerPrice !== undefined) {
1748
+ request['stopLossTriggerPrice'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
1749
+ }
1750
+ const stopLossPrice = this.safeString(stopLoss, 'price');
1751
+ if (stopLossPrice !== undefined) {
1752
+ request['stopLossLimitPrice'] = this.priceToPrecision(symbol, stopLossPrice);
1753
+ }
1754
+ params = this.omit(params, 'stopLoss');
1755
+ }
1756
+ return this.extend(request, params);
1757
+ }
1758
+ encodeOrderSide(side) {
1759
+ const sides = {
1760
+ 'buy': 'Bid',
1761
+ 'sell': 'Ask',
1762
+ };
1763
+ return this.safeString(sides, side, side);
1764
+ }
1765
+ /**
1766
+ * @method
1767
+ * @name backpack#fetchOpenOrders
1768
+ * @description fetch all unfilled currently open orders
1769
+ * @see https://docs.backpack.exchange/#tag/Order/operation/get_open_orders
1770
+ * @param {string} symbol unified market symbol
1771
+ * @param {int} [since] the earliest time in ms to fetch open orders for
1772
+ * @param {int} [limit] the maximum number of open orders structures to retrieve
1773
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1774
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1775
+ */
1776
+ async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1777
+ await this.loadMarkets();
1778
+ const request = {};
1779
+ let market = undefined;
1780
+ if (symbol !== undefined) {
1781
+ market = this.market(symbol);
1782
+ request['symbol'] = market['id'];
1783
+ }
1784
+ const response = await this.privateGetApiV1Orders(this.extend(request, params));
1785
+ return this.parseOrders(response, market, since, limit);
1786
+ }
1787
+ /**
1788
+ * @method
1789
+ * @name backpack#fetchOpenOrder
1790
+ * @description fetch an open order by it's id
1791
+ * @see https://docs.backpack.exchange/#tag/Order/operation/get_order
1792
+ * @param {string} id order id
1793
+ * @param {string} symbol not used by hollaex fetchOpenOrder ()
1794
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1795
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1796
+ */
1797
+ async fetchOpenOrder(id, symbol = undefined, params = {}) {
1798
+ await this.loadMarkets();
1799
+ if (symbol === undefined) {
1800
+ throw new errors.ArgumentsRequired(this.id + ' fetchOpenOrder() requires a symbol argument');
1801
+ }
1802
+ const market = this.market(symbol);
1803
+ const request = {
1804
+ 'symbol': market['id'],
1805
+ 'orderId': id,
1806
+ };
1807
+ const response = await this.privateGetApiV1Order(this.extend(request, params));
1808
+ return this.parseOrder(response);
1809
+ }
1810
+ /**
1811
+ * @method
1812
+ * @name backpack#cancelOrder
1813
+ * @description cancels an open order
1814
+ * @see https://docs.backpack.exchange/#tag/Order/operation/cancel_order
1815
+ * @param {string} id order id
1816
+ * @param {string} symbol unified symbol of the market the order was made in
1817
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1818
+ * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1819
+ */
1820
+ async cancelOrder(id, symbol = undefined, params = {}) {
1821
+ await this.loadMarkets();
1822
+ if (symbol === undefined) {
1823
+ throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
1824
+ }
1825
+ const market = this.market(symbol);
1826
+ const request = {
1827
+ 'orderId': id,
1828
+ 'symbol': market['id'],
1829
+ };
1830
+ const response = await this.privateDeleteApiV1Order(this.extend(request, params));
1831
+ return this.parseOrder(response);
1832
+ }
1833
+ /**
1834
+ * @method
1835
+ * @name backpack#cancelAllOrders
1836
+ * @description cancel all open orders
1837
+ * @see https://docs.backpack.exchange/#tag/Order/operation/cancel_open_orders
1838
+ * @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
1839
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1840
+ * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1841
+ */
1842
+ async cancelAllOrders(symbol = undefined, params = {}) {
1843
+ await this.loadMarkets();
1844
+ if (symbol === undefined) {
1845
+ throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
1846
+ }
1847
+ const market = this.market(symbol);
1848
+ const request = {
1849
+ 'symbol': market['id'],
1850
+ };
1851
+ const response = await this.privateDeleteApiV1Orders(this.extend(request, params));
1852
+ return this.parseOrders(response, market);
1853
+ }
1854
+ /**
1855
+ * @method
1856
+ * @name backpack#fetchOrders
1857
+ * @description fetches information on multiple orders made by the user
1858
+ * @see https://docs.backpack.exchange/#tag/History/operation/get_order_history
1859
+ * @param {string} symbol unified market symbol of the market orders were made in
1860
+ * @param {int} [since] the earliest time in ms to fetch orders for
1861
+ * @param {int} [limit] the maximum number of orde structures to retrieve (default 100, max 1000)
1862
+ * @param {object} [params] extra parameters specific to the bitteam api endpoint
1863
+ * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
1864
+ */
1865
+ async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1866
+ await this.loadMarkets();
1867
+ const request = {};
1868
+ let market = undefined;
1869
+ if (symbol !== undefined) {
1870
+ market = this.market(symbol);
1871
+ request['symbol'] = market['id'];
1872
+ }
1873
+ if (limit !== undefined) {
1874
+ request['limit'] = limit;
1875
+ }
1876
+ const response = await this.privateGetWapiV1HistoryOrders(this.extend(request, params));
1877
+ return this.parseOrders(response, market, since, limit);
1878
+ }
1879
+ parseOrder(order, market = undefined) {
1880
+ //
1881
+ // {
1882
+ // "clientId": null,
1883
+ // "createdAt": 1753624283415,
1884
+ // "executedQuantity": "0.001",
1885
+ // "executedQuoteQuantity": "3.81428",
1886
+ // "id": "4227701917",
1887
+ // "orderType": "Market",
1888
+ // "quantity": "0.001",
1889
+ // "quoteQuantity": "3.82",
1890
+ // "reduceOnly": null,
1891
+ // "relatedOrderId": null,
1892
+ // "selfTradePrevention": "RejectTaker",
1893
+ // "side": "Bid",
1894
+ // "status": "Filled",
1895
+ // "stopLossLimitPrice": null,
1896
+ // "stopLossTriggerBy": null,
1897
+ // "stopLossTriggerPrice": null,
1898
+ // "strategyId": null,
1899
+ // "symbol": "ETH_USDC",
1900
+ // "takeProfitLimitPrice": null,
1901
+ // "takeProfitTriggerBy": null,
1902
+ // "takeProfitTriggerPrice": null,
1903
+ // "timeInForce": "GTC",
1904
+ // "triggerBy": null,
1905
+ // "triggerPrice": null,
1906
+ // "triggerQuantity": null,
1907
+ // "triggeredAt": null
1908
+ // }
1909
+ //
1910
+ // fetchOpenOrders
1911
+ // {
1912
+ // "clientId": 123456789,
1913
+ // "createdAt": 1753626206762,
1914
+ // "executedQuantity": "0",
1915
+ // "executedQuoteQuantity": "0",
1916
+ // "id": "4228978330",
1917
+ // "orderType": "Limit",
1918
+ // "postOnly": true,
1919
+ // "price": "3000",
1920
+ // "quantity": "0.001",
1921
+ // "reduceOnly": null,
1922
+ // "relatedOrderId": null,
1923
+ // "selfTradePrevention": "RejectTaker",
1924
+ // "side": "Bid",
1925
+ // "status": "New",
1926
+ // "stopLossLimitPrice": null,
1927
+ // "stopLossTriggerBy": null,
1928
+ // "stopLossTriggerPrice": null,
1929
+ // "strategyId": null,
1930
+ // "symbol": "ETH_USDC",
1931
+ // "takeProfitLimitPrice": null,
1932
+ // "takeProfitTriggerBy": null,
1933
+ // "takeProfitTriggerPrice": null,
1934
+ // "timeInForce": "GTC",
1935
+ // "triggerBy": null,
1936
+ // "triggerPrice": null,
1937
+ // "triggerQuantity": null,
1938
+ // "triggeredAt": null
1939
+ // }
1940
+ //
1941
+ // fetchOrders
1942
+ // {
1943
+ // "clientId": null,
1944
+ // "createdAt": "2025-07-27T18:05:40.897",
1945
+ // "executedQuantity": "0",
1946
+ // "executedQuoteQuantity": "0",
1947
+ // "expiryReason": null,
1948
+ // "id": "4239996998",
1949
+ // "orderType": "Limit",
1950
+ // "postOnly": false,
1951
+ // "price": "4500",
1952
+ // "quantity": null,
1953
+ // "quoteQuantity": null,
1954
+ // "selfTradePrevention": "RejectTaker",
1955
+ // "side": "Ask",
1956
+ // "status": "Cancelled",
1957
+ // "stopLossLimitPrice": null,
1958
+ // "stopLossTriggerBy": null,
1959
+ // "stopLossTriggerPrice": null,
1960
+ // "strategyId": null,
1961
+ // "symbol": "ETH_USDC",
1962
+ // "systemOrderType": null,
1963
+ // "takeProfitLimitPrice": null,
1964
+ // "takeProfitTriggerBy": null,
1965
+ // "takeProfitTriggerPrice": null,
1966
+ // "timeInForce": "GTC",
1967
+ // "triggerBy": null,
1968
+ // "triggerPrice": "4300",
1969
+ // "triggerQuantity": "0.001"
1970
+ // }
1971
+ //
1972
+ let timestamp = this.safeInteger(order, 'createdAt');
1973
+ const timestamp2 = this.parse8601(this.safeString(order, 'createdAt'));
1974
+ if (timestamp2 !== undefined) {
1975
+ timestamp = timestamp2;
1976
+ }
1977
+ const id = this.safeString(order, 'id');
1978
+ const clientOrderId = this.safeString(order, 'clientId');
1979
+ const symbol = this.safeSymbol(this.safeString(order, 'symbol'), market);
1980
+ const type = this.safeStringLower(order, 'orderType');
1981
+ const timeInForce = this.safeString(order, 'timeInForce');
1982
+ const side = this.parseOrderSide(this.safeString(order, 'side'));
1983
+ const amount = this.safeString2(order, 'quantity', 'triggerQuantity');
1984
+ const price = this.safeString(order, 'price');
1985
+ const cost = this.safeString(order, 'executedQuoteQuantity');
1986
+ const status = this.parseOrderStatus(this.safeString(order, 'status'));
1987
+ const triggerPrice = this.safeString(order, 'triggerPrice');
1988
+ const filled = this.safeString(order, 'executedQuantity');
1989
+ const reduceOnly = this.safeBool(order, 'reduceOnly');
1990
+ const postOnly = this.safeBool(order, 'postOnly');
1991
+ const stopLossPrice = this.safeString2(order, 'stopLossLimitPrice', 'stopLossTriggerPrice');
1992
+ const takeProfitPrice = this.safeString2(order, 'takeProfitLimitPrice', 'takeProfitTriggerPrice');
1993
+ return this.safeOrder({
1994
+ 'info': order,
1995
+ 'id': id,
1996
+ 'clientOrderId': clientOrderId,
1997
+ 'timestamp': timestamp,
1998
+ 'datetime': this.iso8601(timestamp),
1999
+ 'lastTradeTimestamp': undefined,
2000
+ 'symbol': symbol,
2001
+ 'type': type,
2002
+ 'timeInForce': timeInForce,
2003
+ 'postOnly': postOnly,
2004
+ 'reduceOnly': reduceOnly,
2005
+ 'side': side,
2006
+ 'price': price,
2007
+ 'triggerPrice': triggerPrice,
2008
+ 'stopLossPrice': stopLossPrice,
2009
+ 'takeProfitPrice': takeProfitPrice,
2010
+ 'amount': amount,
2011
+ 'cost': cost,
2012
+ 'average': undefined,
2013
+ 'filled': filled,
2014
+ 'remaining': undefined,
2015
+ 'status': status,
2016
+ 'fee': undefined,
2017
+ 'trades': undefined,
2018
+ }, market);
2019
+ }
2020
+ parseOrderStatus(status) {
2021
+ const statuses = {
2022
+ 'New': 'open',
2023
+ 'Filled': 'closed',
2024
+ 'Cancelled': 'canceled',
2025
+ 'Expired': 'canceled',
2026
+ 'PartiallyFilled': 'open',
2027
+ 'TriggerPending': 'open',
2028
+ 'TriggerFailed': 'rejected',
2029
+ };
2030
+ return this.safeString(statuses, status, status);
2031
+ }
2032
+ parseOrderSide(side) {
2033
+ const sides = {
2034
+ 'Bid': 'buy',
2035
+ 'Ask': 'sell',
2036
+ };
2037
+ return this.safeString(sides, side, side);
2038
+ }
2039
+ /**
2040
+ * @method
2041
+ * @name backpack#fetchPositions
2042
+ * @description fetch all open positions
2043
+ * @see https://docs.backpack.exchange/#tag/Futures/operation/get_positions
2044
+ * @param {string[]|undefined} symbols list of unified market symbols
2045
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2046
+ * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
2047
+ */
2048
+ async fetchPositions(symbols = undefined, params = {}) {
2049
+ await this.loadMarkets();
2050
+ const response = await this.privateGetApiV1Position(params);
2051
+ const positions = this.parsePositions(response);
2052
+ if (this.isEmpty(symbols)) {
2053
+ return positions;
2054
+ }
2055
+ symbols = this.marketSymbols(symbols);
2056
+ return this.filterByArrayPositions(positions, 'symbol', symbols, false);
2057
+ }
2058
+ parsePosition(position, market = undefined) {
2059
+ //
2060
+ // fetchPositions
2061
+ // {
2062
+ // "breakEvenPrice": "3831.3630555555555555555555556",
2063
+ // "cumulativeFundingPayment": "-0.009218",
2064
+ // "cumulativeInterest": "0",
2065
+ // "entryPrice": "3826.8888888888888888888888889",
2066
+ // "estLiquidationPrice": "0",
2067
+ // "imf": "0.02",
2068
+ // "imfFunction": {
2069
+ // "base": "0.02",
2070
+ // "factor": "0.0000935",
2071
+ // "type": "sqrt"
2072
+ // },
2073
+ // "markPrice": "3787.46813304",
2074
+ // "mmf": "0.0125",
2075
+ // "mmfFunction": {
2076
+ // "base": "0.0125",
2077
+ // "factor": "0.0000561",
2078
+ // "type": "sqrt"
2079
+ // },
2080
+ // "netCost": "13.7768",
2081
+ // "netExposureNotional": "13.634885278944",
2082
+ // "netExposureQuantity": "0.0036",
2083
+ // "netQuantity": "0.0036",
2084
+ // "pnlRealized": "0",
2085
+ // "pnlUnrealized": "-0.141914",
2086
+ // "positionId": "4238420454",
2087
+ // "subaccountId": null,
2088
+ // "symbol": "ETH_USDC_PERP",
2089
+ // "userId":1813870
2090
+ // }
2091
+ //
2092
+ //
2093
+ const id = this.safeString(position, 'positionId');
2094
+ const marketId = this.safeString(position, 'symbol');
2095
+ market = this.safeMarket(marketId, market);
2096
+ const symbol = market['symbol'];
2097
+ const entryPrice = this.safeString(position, 'entryPrice');
2098
+ const markPrice = this.safeString(position, 'markPrice');
2099
+ const netCost = this.safeString(position, 'netCost');
2100
+ let hedged = false;
2101
+ let side = 'long';
2102
+ if (Precise["default"].stringLt(netCost, '0')) {
2103
+ side = 'short';
2104
+ }
2105
+ if (netCost === undefined) {
2106
+ hedged = undefined;
2107
+ side = undefined;
2108
+ }
2109
+ const unrealizedPnl = this.safeString(position, 'pnlUnrealized');
2110
+ const realizedPnl = this.safeString(position, 'pnlRealized');
2111
+ const liquidationPrice = this.safeString(position, 'estLiquidationPrice');
2112
+ return this.safePosition({
2113
+ 'info': position,
2114
+ 'id': id,
2115
+ 'symbol': symbol,
2116
+ 'timestamp': this.parse8601(this.safeString(position, 'timestamp')),
2117
+ 'datetime': this.iso8601(this.parse8601(this.safeString(position, 'timestamp'))),
2118
+ 'lastUpdateTimestamp': undefined,
2119
+ 'hedged': hedged,
2120
+ 'side': side,
2121
+ 'contracts': this.safeString(position, 'netExposureQuantity'),
2122
+ 'contractSize': undefined,
2123
+ 'entryPrice': entryPrice,
2124
+ 'markPrice': markPrice,
2125
+ 'lastPrice': undefined,
2126
+ 'notional': Precise["default"].stringAbs(netCost),
2127
+ 'leverage': undefined,
2128
+ 'collateral': undefined,
2129
+ 'initialMargin': undefined,
2130
+ 'initialMarginPercentage': this.safeString(position, 'imf'),
2131
+ 'maintenanceMargin': undefined,
2132
+ 'maintenanceMarginPercentage': this.safeString(position, 'mmf'),
2133
+ 'realizedPnl': realizedPnl,
2134
+ 'unrealizedPnl': unrealizedPnl,
2135
+ 'liquidationPrice': liquidationPrice,
2136
+ 'marginMode': undefined,
2137
+ 'marginRatio': undefined,
2138
+ 'percentage': undefined,
2139
+ 'stopLossPrice': undefined,
2140
+ 'takeProfitPrice': undefined,
2141
+ });
2142
+ }
2143
+ /**
2144
+ * @method
2145
+ * @name backpack#fetchFundingHistory
2146
+ * @description fetches the history of funding payments
2147
+ * @see https://docs.backpack.exchange/#tag/History/operation/get_funding_payments
2148
+ * @param {string} symbol unified symbol of the market to fetch trades for
2149
+ * @param {int} [since] timestamp in ms of the earliest trade to fetch (default 24 hours ago)
2150
+ * @param {int} [limit] the maximum amount of trades to fetch (default 200, max 500)
2151
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2152
+ * @param {int} [params.until] timestamp in ms of the latest trade to fetch (default now)
2153
+ * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
2154
+ */
2155
+ async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
2156
+ await this.loadMarkets();
2157
+ const request = {};
2158
+ let market = undefined;
2159
+ if (symbol !== undefined) {
2160
+ market = this.market(symbol);
2161
+ request['symbol'] = market['id'];
2162
+ }
2163
+ if (limit !== undefined) {
2164
+ request['limit'] = limit;
2165
+ }
2166
+ const response = await this.privateGetWapiV1HistoryFunding(this.extend(request, params));
2167
+ return this.parseIncomes(response, market, since, limit);
2168
+ }
2169
+ parseIncome(income, market = undefined) {
2170
+ //
2171
+ // {
2172
+ // "fundingRate": "0.0001",
2173
+ // "intervalEndTimestamp": "2025-08-01T16:00:00",
2174
+ // "quantity": "-0.001301",
2175
+ // "subaccountId": 0,
2176
+ // "symbol": "ETH_USDC_PERP",
2177
+ // "userId": 1813870
2178
+ // }
2179
+ //
2180
+ const marketId = this.safeString(income, 'symbol');
2181
+ const symbol = this.safeSymbol(marketId, market);
2182
+ const amount = this.safeNumber(income, 'quantity');
2183
+ const id = this.safeString(income, 'userId');
2184
+ const timestamp = this.parse8601(this.safeString(income, 'intervalEndTimestamp'));
2185
+ const rate = this.safeNumber(income, 'fundingRate');
2186
+ return {
2187
+ 'info': income,
2188
+ 'symbol': symbol,
2189
+ 'code': undefined,
2190
+ 'timestamp': timestamp,
2191
+ 'datetime': this.iso8601(timestamp),
2192
+ 'id': id,
2193
+ 'amount': amount,
2194
+ 'rate': rate,
2195
+ };
2196
+ }
2197
+ nonce() {
2198
+ return this.milliseconds() - this.options['timeDifference'];
2199
+ }
2200
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
2201
+ let endpoint = '/' + path;
2202
+ let url = this.urls['api'][api];
2203
+ const sortedParams = Array.isArray(params) ? params : this.keysort(params);
2204
+ if (api === 'private') {
2205
+ this.checkRequiredCredentials();
2206
+ const ts = this.nonce().toString();
2207
+ const recvWindow = this.safeString2(this.options, 'recvWindow', 'X-Window', '5000');
2208
+ const optionInstructions = this.safeDict(this.options, 'instructions', {});
2209
+ const optionPathInstructions = this.safeDict(optionInstructions, path, {});
2210
+ const instruction = this.safeString(optionPathInstructions, method, '');
2211
+ let payload = '';
2212
+ if ((path === 'api/v1/orders') && (method === 'POST')) { // for createOrders
2213
+ payload = this.generateBatchPayload(sortedParams, ts, recvWindow, instruction);
2214
+ }
2215
+ else {
2216
+ let queryString = this.urlencode(sortedParams);
2217
+ if (queryString.length > 0) {
2218
+ queryString += '&';
2219
+ }
2220
+ payload = 'instruction=' + instruction + '&' + queryString + 'timestamp=' + ts + '&window=' + recvWindow;
2221
+ }
2222
+ const secretBytes = this.base64ToBinary(this.secret);
2223
+ const seed = this.arraySlice(secretBytes, 0, 32);
2224
+ const signature = crypto.eddsa(this.encode(payload), seed, ed25519.ed25519);
2225
+ headers = {
2226
+ 'X-Timestamp': ts,
2227
+ 'X-Window': recvWindow,
2228
+ 'X-API-Key': this.apiKey,
2229
+ 'X-Signature': signature,
2230
+ 'X-Broker-Id': '1400',
2231
+ };
2232
+ if (method !== 'GET') {
2233
+ body = this.json(sortedParams);
2234
+ headers['Content-Type'] = 'application/json';
2235
+ }
2236
+ }
2237
+ if (method === 'GET') {
2238
+ const query = this.urlencode(sortedParams);
2239
+ if (query.length !== 0) {
2240
+ endpoint += '?' + query;
2241
+ }
2242
+ }
2243
+ url += endpoint;
2244
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
2245
+ }
2246
+ generateBatchPayload(params, ts, recvWindow, instruction) {
2247
+ let payload = '';
2248
+ for (let i = 0; i < params.length; i++) {
2249
+ const order = this.safeDict(params, i, {});
2250
+ const sortedOrder = this.keysort(order);
2251
+ const orderQuery = this.urlencode(sortedOrder);
2252
+ payload += 'instruction=' + instruction + '&' + orderQuery + '&';
2253
+ if (i === (params.length - 1)) {
2254
+ payload += 'timestamp=' + ts + '&window=' + recvWindow;
2255
+ }
2256
+ }
2257
+ return payload;
2258
+ }
2259
+ handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
2260
+ if (response === undefined) {
2261
+ return undefined; // fallback to default error handler
2262
+ }
2263
+ //
2264
+ // {"code":"INVALID_ORDER","message":"Invalid order"}
2265
+ // {"code":"INVALID_CLIENT_REQUEST","message":"Must specify both `triggerPrice` and `triggerQuantity` or neither"}
2266
+ //
2267
+ const errorCode = this.safeString(response, 'code');
2268
+ const message = this.safeString(response, 'message');
2269
+ if (errorCode !== undefined) {
2270
+ const feedback = this.id + ' ' + body;
2271
+ this.throwExactlyMatchedException(this.exceptions['exact'], errorCode, feedback);
2272
+ this.throwExactlyMatchedException(this.exceptions['exact'], message, feedback);
2273
+ this.throwBroadlyMatchedException(this.exceptions['broad'], message, feedback);
2274
+ throw new errors.ExchangeError(feedback); // unknown message
2275
+ }
2276
+ return undefined;
2277
+ }
2278
+ }
2279
+
2280
+ exports["default"] = backpack;