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