ccxt-ir 4.3.46.0.3__py2.py3-none-any.whl → 4.5.1__py2.py3-none-any.whl

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 (529) hide show
  1. ccxt/__init__.py +39 -35
  2. ccxt/abantether.py +8 -8
  3. ccxt/abstract/alpaca.py +4 -0
  4. ccxt/abstract/apex.py +31 -0
  5. ccxt/abstract/bigone.py +1 -1
  6. ccxt/abstract/binance.py +106 -48
  7. ccxt/abstract/binancecoinm.py +106 -48
  8. ccxt/abstract/binanceus.py +141 -83
  9. ccxt/abstract/binanceusdm.py +106 -48
  10. ccxt/abstract/bingx.py +50 -1
  11. ccxt/abstract/bitbank.py +5 -0
  12. ccxt/abstract/bitfinex.py +136 -65
  13. ccxt/abstract/bitflyer.py +1 -0
  14. ccxt/abstract/bitget.py +67 -0
  15. ccxt/abstract/bitmart.py +19 -1
  16. ccxt/abstract/bitopro.py +1 -0
  17. ccxt/abstract/bitrue.py +68 -68
  18. ccxt/abstract/bitstamp.py +1 -0
  19. ccxt/abstract/blofin.py +30 -0
  20. ccxt/abstract/btcbox.py +2 -0
  21. ccxt/abstract/bybit.py +28 -13
  22. ccxt/abstract/cex.py +28 -29
  23. ccxt/abstract/coinbaseexchange.py +1 -0
  24. ccxt/abstract/coinbaseinternational.py +1 -1
  25. ccxt/abstract/cryptocom.py +16 -0
  26. ccxt/abstract/cryptomus.py +20 -0
  27. ccxt/abstract/defx.py +69 -0
  28. ccxt/abstract/deribit.py +1 -0
  29. ccxt/abstract/derive.py +117 -0
  30. ccxt/abstract/digifinex.py +1 -0
  31. ccxt/abstract/ellipx.py +25 -0
  32. ccxt/abstract/foxbit.py +26 -0
  33. ccxt/abstract/gate.py +19 -0
  34. ccxt/abstract/gateio.py +19 -0
  35. ccxt/abstract/gemini.py +1 -0
  36. ccxt/abstract/hibachi.py +26 -0
  37. ccxt/abstract/hyperliquid.py +1 -1
  38. ccxt/abstract/independentreserve.py +6 -0
  39. ccxt/abstract/kraken.py +1 -0
  40. ccxt/abstract/krakenfutures.py +4 -0
  41. ccxt/abstract/kucoin.py +10 -0
  42. ccxt/abstract/kucoinfutures.py +18 -0
  43. ccxt/abstract/lbank.py +2 -1
  44. ccxt/abstract/luno.py +1 -0
  45. ccxt/abstract/mexc.py +2 -0
  46. ccxt/abstract/modetrade.py +119 -0
  47. ccxt/abstract/myokx.py +349 -0
  48. ccxt/abstract/oceanex.py +5 -0
  49. ccxt/abstract/okx.py +25 -0
  50. ccxt/abstract/okxus.py +349 -0
  51. ccxt/abstract/onetrading.py +0 -12
  52. ccxt/abstract/paradex.py +23 -0
  53. ccxt/abstract/phemex.py +2 -0
  54. ccxt/abstract/poloniex.py +36 -0
  55. ccxt/abstract/tradeogre.py +3 -1
  56. ccxt/abstract/upbit.py +51 -34
  57. ccxt/abstract/whitebit.py +16 -0
  58. ccxt/abstract/woo.py +64 -6
  59. ccxt/abstract/xt.py +10 -5
  60. ccxt/afratether.py +8 -8
  61. ccxt/alpaca.py +828 -51
  62. ccxt/apex.py +1875 -0
  63. ccxt/arzinja.py +7 -7
  64. ccxt/arzplus.py +9 -9
  65. ccxt/ascendex.py +501 -306
  66. ccxt/async_support/__init__.py +39 -35
  67. ccxt/async_support/abantether.py +8 -8
  68. ccxt/async_support/afratether.py +10 -10
  69. ccxt/async_support/alpaca.py +828 -51
  70. ccxt/async_support/apex.py +1875 -0
  71. ccxt/async_support/arzinja.py +10 -10
  72. ccxt/async_support/arzplus.py +12 -12
  73. ccxt/async_support/ascendex.py +502 -306
  74. ccxt/async_support/base/exchange.py +303 -89
  75. ccxt/async_support/base/ws/cache.py +9 -3
  76. ccxt/async_support/base/ws/client.py +173 -38
  77. ccxt/async_support/base/ws/future.py +25 -37
  78. ccxt/async_support/bequant.py +5 -3
  79. ccxt/async_support/bigone.py +279 -144
  80. ccxt/async_support/binance.py +2347 -1158
  81. ccxt/async_support/binancecoinm.py +9 -3
  82. ccxt/async_support/binanceus.py +17 -3
  83. ccxt/async_support/binanceusdm.py +9 -4
  84. ccxt/async_support/bingx.py +2962 -920
  85. ccxt/async_support/bit2c.py +147 -27
  86. ccxt/async_support/bitbank.py +151 -23
  87. ccxt/async_support/bitbns.py +104 -30
  88. ccxt/async_support/bitfinex.py +3291 -1113
  89. ccxt/async_support/bitflyer.py +202 -27
  90. ccxt/async_support/bitget.py +3683 -1538
  91. ccxt/async_support/bithumb.py +195 -38
  92. ccxt/async_support/bitimen.py +12 -12
  93. ccxt/async_support/bitir.py +38 -38
  94. ccxt/async_support/bitmart.py +1288 -350
  95. ccxt/async_support/bitmex.py +260 -75
  96. ccxt/async_support/bitopro.py +262 -62
  97. ccxt/async_support/bitpin.py +17 -16
  98. ccxt/async_support/bitrue.py +459 -290
  99. ccxt/async_support/bitso.py +199 -54
  100. ccxt/async_support/bitstamp.py +230 -96
  101. ccxt/async_support/bitteam.py +167 -25
  102. ccxt/async_support/{huobijp.py → bittrade.py} +158 -30
  103. ccxt/async_support/bitvavo.py +213 -49
  104. ccxt/async_support/blockchaincom.py +160 -46
  105. ccxt/async_support/blofin.py +502 -120
  106. ccxt/async_support/btcalpha.py +169 -31
  107. ccxt/async_support/btcbox.py +292 -23
  108. ccxt/async_support/btcmarkets.py +211 -58
  109. ccxt/async_support/btcturk.py +161 -38
  110. ccxt/async_support/bybit.py +1775 -1030
  111. ccxt/async_support/cex.py +1440 -1303
  112. ccxt/async_support/coinbase.py +724 -212
  113. ccxt/async_support/coinbaseadvanced.py +2 -1
  114. ccxt/async_support/coinbaseexchange.py +388 -89
  115. ccxt/async_support/coinbaseinternational.py +412 -57
  116. ccxt/async_support/coincatch.py +177 -78
  117. ccxt/async_support/coincheck.py +135 -19
  118. ccxt/async_support/coinex.py +606 -232
  119. ccxt/async_support/coinmate.py +189 -63
  120. ccxt/async_support/coinmetro.py +195 -54
  121. ccxt/async_support/coinone.py +158 -51
  122. ccxt/async_support/coinsph.py +336 -61
  123. ccxt/async_support/coinspot.py +151 -52
  124. ccxt/async_support/cryptocom.py +661 -111
  125. ccxt/async_support/cryptomus.py +1137 -0
  126. ccxt/async_support/defx.py +2071 -0
  127. ccxt/async_support/delta.py +299 -99
  128. ccxt/async_support/deribit.py +348 -126
  129. ccxt/async_support/derive.py +2572 -0
  130. ccxt/async_support/digifinex.py +430 -214
  131. ccxt/async_support/ellipx.py +2029 -0
  132. ccxt/async_support/eterex.py +10 -10
  133. ccxt/async_support/excoino.py +31 -31
  134. ccxt/async_support/exir.py +14 -14
  135. ccxt/async_support/exmo.py +344 -131
  136. ccxt/async_support/exnovin.py +10 -10
  137. ccxt/async_support/farhadexchange.py +12 -12
  138. ccxt/async_support/fmfwio.py +2 -1
  139. ccxt/async_support/foxbit.py +1935 -0
  140. ccxt/async_support/gate.py +1351 -529
  141. ccxt/async_support/gateio.py +2 -1
  142. ccxt/async_support/gemini.py +144 -39
  143. ccxt/async_support/hashkey.py +152 -109
  144. ccxt/async_support/hibachi.py +2080 -0
  145. ccxt/async_support/hitbtc.py +395 -167
  146. ccxt/async_support/hitobit.py +12 -12
  147. ccxt/async_support/hollaex.py +307 -119
  148. ccxt/async_support/htx.py +851 -383
  149. ccxt/async_support/huobi.py +2 -1
  150. ccxt/async_support/hyperliquid.py +1848 -536
  151. ccxt/async_support/independentreserve.py +288 -15
  152. ccxt/async_support/indodax.py +190 -33
  153. ccxt/async_support/jibitex.py +12 -12
  154. ccxt/async_support/kraken.py +795 -351
  155. ccxt/async_support/krakenfutures.py +214 -62
  156. ccxt/async_support/kucoin.py +715 -396
  157. ccxt/async_support/kucoinfutures.py +652 -89
  158. ccxt/async_support/latoken.py +217 -113
  159. ccxt/async_support/lbank.py +425 -97
  160. ccxt/async_support/luno.py +382 -35
  161. ccxt/async_support/mercado.py +113 -6
  162. ccxt/async_support/mexc.py +874 -437
  163. ccxt/async_support/modetrade.py +2818 -0
  164. ccxt/async_support/myokx.py +54 -0
  165. ccxt/async_support/ndax.py +221 -64
  166. ccxt/async_support/nobitex.py +32 -38
  167. ccxt/async_support/novadax.py +190 -34
  168. ccxt/async_support/oceanex.py +217 -28
  169. ccxt/async_support/okcoin.py +253 -145
  170. ccxt/async_support/okexchange.py +11 -11
  171. ccxt/async_support/okx.py +1088 -351
  172. ccxt/async_support/okxus.py +54 -0
  173. ccxt/async_support/ompfinex.py +32 -27
  174. ccxt/async_support/onetrading.py +213 -392
  175. ccxt/async_support/oxfun.py +245 -166
  176. ccxt/async_support/p2b.py +151 -29
  177. ccxt/async_support/paradex.py +562 -49
  178. ccxt/async_support/paymium.py +82 -19
  179. ccxt/async_support/phemex.py +713 -172
  180. ccxt/async_support/poloniex.py +1602 -283
  181. ccxt/async_support/probit.py +224 -95
  182. ccxt/async_support/ramzinex.py +34 -30
  183. ccxt/async_support/sarmayex.py +9 -9
  184. ccxt/async_support/sarrafex.py +13 -13
  185. ccxt/async_support/tabdeal.py +15 -14
  186. ccxt/async_support/tetherland.py +9 -9
  187. ccxt/async_support/timex.py +210 -51
  188. ccxt/async_support/tokocrypto.py +167 -47
  189. ccxt/async_support/tradeogre.py +266 -31
  190. ccxt/async_support/twox.py +9 -9
  191. ccxt/async_support/ubitex.py +12 -12
  192. ccxt/async_support/upbit.py +568 -165
  193. ccxt/async_support/vertex.py +160 -32
  194. ccxt/async_support/wallex.py +12 -12
  195. ccxt/async_support/wavesexchange.py +165 -30
  196. ccxt/async_support/whitebit.py +975 -127
  197. ccxt/async_support/woo.py +1918 -1016
  198. ccxt/async_support/woofipro.py +433 -141
  199. ccxt/async_support/xt.py +649 -193
  200. ccxt/async_support/yobit.py +195 -70
  201. ccxt/async_support/zaif.py +91 -15
  202. ccxt/async_support/zonda.py +151 -36
  203. ccxt/base/decimal_to_precision.py +14 -10
  204. ccxt/base/errors.py +49 -18
  205. ccxt/base/exchange.py +1556 -450
  206. ccxt/base/precise.py +10 -0
  207. ccxt/base/types.py +114 -6
  208. ccxt/bequant.py +5 -3
  209. ccxt/bigone.py +279 -144
  210. ccxt/binance.py +2347 -1158
  211. ccxt/binancecoinm.py +9 -3
  212. ccxt/binanceus.py +17 -3
  213. ccxt/binanceusdm.py +9 -4
  214. ccxt/bingx.py +2962 -920
  215. ccxt/bit2c.py +147 -27
  216. ccxt/bitbank.py +151 -23
  217. ccxt/bitbns.py +104 -30
  218. ccxt/bitfinex.py +3290 -1113
  219. ccxt/bitflyer.py +202 -27
  220. ccxt/bitget.py +3683 -1538
  221. ccxt/bithumb.py +194 -38
  222. ccxt/bitimen.py +9 -9
  223. ccxt/bitir.py +35 -35
  224. ccxt/bitmart.py +1288 -350
  225. ccxt/bitmex.py +260 -75
  226. ccxt/bitopro.py +262 -62
  227. ccxt/bitpin.py +15 -14
  228. ccxt/bitrue.py +459 -290
  229. ccxt/bitso.py +199 -54
  230. ccxt/bitstamp.py +230 -96
  231. ccxt/bitteam.py +167 -25
  232. ccxt/{huobijp.py → bittrade.py} +158 -30
  233. ccxt/bitvavo.py +213 -49
  234. ccxt/blockchaincom.py +160 -46
  235. ccxt/blofin.py +502 -120
  236. ccxt/btcalpha.py +169 -31
  237. ccxt/btcbox.py +291 -23
  238. ccxt/btcmarkets.py +211 -58
  239. ccxt/btcturk.py +161 -38
  240. ccxt/bybit.py +1775 -1030
  241. ccxt/cex.py +1439 -1303
  242. ccxt/coinbase.py +724 -212
  243. ccxt/coinbaseadvanced.py +2 -1
  244. ccxt/coinbaseexchange.py +388 -89
  245. ccxt/coinbaseinternational.py +412 -57
  246. ccxt/coincatch.py +177 -78
  247. ccxt/coincheck.py +135 -19
  248. ccxt/coinex.py +606 -232
  249. ccxt/coinmate.py +189 -63
  250. ccxt/coinmetro.py +194 -54
  251. ccxt/coinone.py +158 -51
  252. ccxt/coinsph.py +336 -61
  253. ccxt/coinspot.py +151 -52
  254. ccxt/cryptocom.py +661 -111
  255. ccxt/cryptomus.py +1137 -0
  256. ccxt/defx.py +2070 -0
  257. ccxt/delta.py +299 -99
  258. ccxt/deribit.py +348 -126
  259. ccxt/derive.py +2571 -0
  260. ccxt/digifinex.py +430 -214
  261. ccxt/ellipx.py +2029 -0
  262. ccxt/eterex.py +7 -7
  263. ccxt/excoino.py +29 -29
  264. ccxt/exir.py +11 -11
  265. ccxt/exmo.py +343 -131
  266. ccxt/exnovin.py +8 -8
  267. ccxt/farhadexchange.py +10 -10
  268. ccxt/fmfwio.py +2 -1
  269. ccxt/foxbit.py +1935 -0
  270. ccxt/gate.py +1351 -529
  271. ccxt/gateio.py +2 -1
  272. ccxt/gemini.py +144 -39
  273. ccxt/hashkey.py +152 -109
  274. ccxt/hibachi.py +2079 -0
  275. ccxt/hitbtc.py +395 -167
  276. ccxt/hitobit.py +9 -9
  277. ccxt/hollaex.py +307 -119
  278. ccxt/htx.py +851 -383
  279. ccxt/huobi.py +2 -1
  280. ccxt/hyperliquid.py +1848 -536
  281. ccxt/independentreserve.py +287 -15
  282. ccxt/indodax.py +190 -33
  283. ccxt/jibitex.py +9 -9
  284. ccxt/kraken.py +794 -351
  285. ccxt/krakenfutures.py +214 -62
  286. ccxt/kucoin.py +715 -396
  287. ccxt/kucoinfutures.py +652 -89
  288. ccxt/latoken.py +217 -113
  289. ccxt/lbank.py +425 -97
  290. ccxt/luno.py +382 -35
  291. ccxt/mercado.py +113 -6
  292. ccxt/mexc.py +873 -437
  293. ccxt/modetrade.py +2818 -0
  294. ccxt/myokx.py +54 -0
  295. ccxt/ndax.py +221 -64
  296. ccxt/nobitex.py +30 -36
  297. ccxt/novadax.py +190 -34
  298. ccxt/oceanex.py +217 -28
  299. ccxt/okcoin.py +253 -145
  300. ccxt/okexchange.py +9 -9
  301. ccxt/okx.py +1088 -351
  302. ccxt/okxus.py +54 -0
  303. ccxt/ompfinex.py +29 -24
  304. ccxt/onetrading.py +213 -392
  305. ccxt/oxfun.py +245 -166
  306. ccxt/p2b.py +151 -29
  307. ccxt/paradex.py +562 -49
  308. ccxt/paymium.py +82 -19
  309. ccxt/phemex.py +712 -172
  310. ccxt/poloniex.py +1601 -283
  311. ccxt/pro/__init__.py +76 -17
  312. ccxt/pro/alpaca.py +21 -6
  313. ccxt/pro/apex.py +984 -0
  314. ccxt/pro/ascendex.py +58 -10
  315. ccxt/pro/bequant.py +6 -1
  316. ccxt/pro/binance.py +728 -156
  317. ccxt/pro/binancecoinm.py +6 -2
  318. ccxt/pro/binanceus.py +8 -4
  319. ccxt/pro/binanceusdm.py +7 -2
  320. ccxt/pro/bingx.py +333 -142
  321. ccxt/pro/bitfinex.py +727 -262
  322. ccxt/pro/bitget.py +570 -79
  323. ccxt/pro/bithumb.py +20 -6
  324. ccxt/pro/bitmart.py +216 -87
  325. ccxt/pro/bitmex.py +47 -9
  326. ccxt/pro/bitopro.py +26 -14
  327. ccxt/pro/bitrue.py +22 -22
  328. ccxt/pro/bitstamp.py +54 -21
  329. ccxt/pro/{huobijp.py → bittrade.py} +7 -6
  330. ccxt/pro/bitvavo.py +191 -67
  331. ccxt/pro/blockchaincom.py +21 -8
  332. ccxt/pro/blofin.py +9 -1
  333. ccxt/pro/bybit.py +632 -245
  334. ccxt/pro/cex.py +59 -24
  335. ccxt/pro/coinbase.py +102 -73
  336. ccxt/pro/coinbaseadvanced.py +2 -1
  337. ccxt/pro/coinbaseexchange.py +8 -8
  338. ccxt/pro/coinbaseinternational.py +181 -25
  339. ccxt/pro/coincatch.py +6 -7
  340. ccxt/pro/coincheck.py +11 -6
  341. ccxt/pro/coinex.py +967 -665
  342. ccxt/pro/coinone.py +16 -9
  343. ccxt/pro/cryptocom.py +448 -45
  344. ccxt/pro/defx.py +831 -0
  345. ccxt/pro/deribit.py +150 -14
  346. ccxt/pro/derive.py +704 -0
  347. ccxt/pro/exmo.py +239 -6
  348. ccxt/pro/gate.py +623 -65
  349. ccxt/pro/gateio.py +2 -1
  350. ccxt/pro/gemini.py +27 -11
  351. ccxt/pro/hashkey.py +2 -2
  352. ccxt/pro/hitbtc.py +196 -91
  353. ccxt/pro/hollaex.py +23 -7
  354. ccxt/pro/htx.py +51 -14
  355. ccxt/pro/huobi.py +2 -1
  356. ccxt/pro/hyperliquid.py +591 -27
  357. ccxt/pro/independentreserve.py +9 -6
  358. ccxt/pro/kraken.py +640 -320
  359. ccxt/pro/krakenfutures.py +62 -35
  360. ccxt/pro/kucoin.py +267 -46
  361. ccxt/pro/kucoinfutures.py +165 -21
  362. ccxt/pro/lbank.py +102 -21
  363. ccxt/pro/luno.py +12 -8
  364. ccxt/pro/mexc.py +877 -111
  365. ccxt/pro/modetrade.py +1271 -0
  366. ccxt/pro/myokx.py +38 -0
  367. ccxt/pro/ndax.py +15 -2
  368. ccxt/pro/okcoin.py +23 -4
  369. ccxt/pro/okx.py +573 -98
  370. ccxt/pro/okxus.py +38 -0
  371. ccxt/pro/onetrading.py +30 -13
  372. ccxt/pro/oxfun.py +131 -27
  373. ccxt/pro/p2b.py +88 -22
  374. ccxt/pro/paradex.py +3 -3
  375. ccxt/pro/phemex.py +75 -21
  376. ccxt/pro/poloniex.py +124 -41
  377. ccxt/pro/probit.py +87 -80
  378. ccxt/pro/tradeogre.py +272 -0
  379. ccxt/pro/upbit.py +152 -12
  380. ccxt/pro/vertex.py +8 -3
  381. ccxt/pro/whitebit.py +58 -5
  382. ccxt/pro/woo.py +228 -37
  383. ccxt/pro/woofipro.py +106 -18
  384. ccxt/pro/xt.py +111 -5
  385. ccxt/probit.py +224 -95
  386. ccxt/protobuf/__init__.py +0 -0
  387. ccxt/protobuf/mexc/PrivateAccountV3Api_pb2.py +37 -0
  388. ccxt/protobuf/mexc/PrivateDealsV3Api_pb2.py +37 -0
  389. ccxt/protobuf/mexc/PrivateOrdersV3Api_pb2.py +37 -0
  390. ccxt/protobuf/mexc/PublicAggreBookTickerV3Api_pb2.py +37 -0
  391. ccxt/protobuf/mexc/PublicAggreDealsV3Api_pb2.py +39 -0
  392. ccxt/protobuf/mexc/PublicAggreDepthsV3Api_pb2.py +39 -0
  393. ccxt/protobuf/mexc/PublicBookTickerBatchV3Api_pb2.py +38 -0
  394. ccxt/protobuf/mexc/PublicBookTickerV3Api_pb2.py +37 -0
  395. ccxt/protobuf/mexc/PublicDealsV3Api_pb2.py +39 -0
  396. ccxt/protobuf/mexc/PublicIncreaseDepthsBatchV3Api_pb2.py +38 -0
  397. ccxt/protobuf/mexc/PublicIncreaseDepthsV3Api_pb2.py +39 -0
  398. ccxt/protobuf/mexc/PublicLimitDepthsV3Api_pb2.py +39 -0
  399. ccxt/protobuf/mexc/PublicMiniTickerV3Api_pb2.py +37 -0
  400. ccxt/protobuf/mexc/PublicMiniTickersV3Api_pb2.py +38 -0
  401. ccxt/protobuf/mexc/PublicSpotKlineV3Api_pb2.py +37 -0
  402. ccxt/protobuf/mexc/PushDataV3ApiWrapper_pb2.py +52 -0
  403. ccxt/protobuf/mexc/__init__.py +0 -0
  404. ccxt/ramzinex.py +32 -28
  405. ccxt/sarmayex.py +7 -7
  406. ccxt/sarrafex.py +10 -10
  407. ccxt/static_dependencies/__init__.py +1 -1
  408. ccxt/static_dependencies/lark/py.typed +0 -0
  409. ccxt/static_dependencies/marshmallow/py.typed +0 -0
  410. ccxt/static_dependencies/marshmallow_dataclass/py.typed +0 -0
  411. ccxt/static_dependencies/marshmallow_oneofschema/py.typed +0 -0
  412. ccxt/tabdeal.py +13 -12
  413. ccxt/test/tests_async.py +261 -57
  414. ccxt/test/tests_helpers.py +1 -3
  415. ccxt/test/tests_init.py +4 -3
  416. ccxt/test/tests_sync.py +261 -57
  417. ccxt/tetherland.py +7 -7
  418. ccxt/timex.py +210 -51
  419. ccxt/tokocrypto.py +167 -47
  420. ccxt/tradeogre.py +266 -31
  421. ccxt/twox.py +7 -7
  422. ccxt/ubitex.py +9 -9
  423. ccxt/upbit.py +568 -165
  424. ccxt/vertex.py +160 -32
  425. ccxt/wallex.py +9 -9
  426. ccxt/wavesexchange.py +165 -30
  427. ccxt/whitebit.py +975 -127
  428. ccxt/woo.py +1917 -1016
  429. ccxt/woofipro.py +432 -141
  430. ccxt/xt.py +649 -193
  431. ccxt/yobit.py +194 -70
  432. ccxt/zaif.py +91 -15
  433. ccxt/zonda.py +151 -36
  434. {ccxt_ir-4.3.46.0.3.dist-info → ccxt_ir-4.5.1.dist-info}/METADATA +225 -73
  435. ccxt_ir-4.5.1.dist-info/RECORD +743 -0
  436. {ccxt_ir-4.3.46.0.3.dist-info → ccxt_ir-4.5.1.dist-info}/WHEEL +1 -1
  437. ccxt/__test__.py +0 -7
  438. ccxt/abstract/ace.py +0 -15
  439. ccxt/abstract/bitbay.py +0 -53
  440. ccxt/abstract/bitcoincom.py +0 -115
  441. ccxt/abstract/bitfinex2.py +0 -139
  442. ccxt/abstract/bitpanda.py +0 -35
  443. ccxt/abstract/bl3p.py +0 -19
  444. ccxt/abstract/coinlist.py +0 -54
  445. ccxt/abstract/currencycom.py +0 -68
  446. ccxt/abstract/hitbtc3.py +0 -115
  447. ccxt/abstract/idex.py +0 -26
  448. ccxt/abstract/kuna.py +0 -182
  449. ccxt/abstract/lykke.py +0 -29
  450. ccxt/abstract/poloniexfutures.py +0 -48
  451. ccxt/abstract/wazirx.py +0 -30
  452. ccxt/ace.py +0 -1012
  453. ccxt/async_support/ace.py +0 -1012
  454. ccxt/async_support/base/ws/aiohttp_client.py +0 -125
  455. ccxt/async_support/base/ws/fast_client.py +0 -96
  456. ccxt/async_support/bitbay.py +0 -17
  457. ccxt/async_support/bitcoincom.py +0 -17
  458. ccxt/async_support/bitfinex2.py +0 -3552
  459. ccxt/async_support/bitpanda.py +0 -16
  460. ccxt/async_support/bl3p.py +0 -485
  461. ccxt/async_support/coinlist.py +0 -2243
  462. ccxt/async_support/currencycom.py +0 -1950
  463. ccxt/async_support/hitbtc3.py +0 -16
  464. ccxt/async_support/idex.py +0 -1766
  465. ccxt/async_support/kuna.py +0 -1841
  466. ccxt/async_support/lykke.py +0 -1270
  467. ccxt/async_support/poloniexfutures.py +0 -1717
  468. ccxt/async_support/wazirx.py +0 -1224
  469. ccxt/bitbay.py +0 -17
  470. ccxt/bitcoincom.py +0 -17
  471. ccxt/bitfinex2.py +0 -3552
  472. ccxt/bitpanda.py +0 -16
  473. ccxt/bl3p.py +0 -485
  474. ccxt/coinlist.py +0 -2243
  475. ccxt/currencycom.py +0 -1950
  476. ccxt/hitbtc3.py +0 -16
  477. ccxt/idex.py +0 -1766
  478. ccxt/kuna.py +0 -1841
  479. ccxt/lykke.py +0 -1270
  480. ccxt/poloniexfutures.py +0 -1717
  481. ccxt/pro/bitcoincom.py +0 -34
  482. ccxt/pro/bitfinex2.py +0 -1083
  483. ccxt/pro/bitpanda.py +0 -15
  484. ccxt/pro/currencycom.py +0 -536
  485. ccxt/pro/idex.py +0 -672
  486. ccxt/pro/poloniexfutures.py +0 -990
  487. ccxt/pro/wazirx.py +0 -749
  488. ccxt/test/base/__init__.py +0 -29
  489. ccxt/test/base/test_account.py +0 -26
  490. ccxt/test/base/test_balance.py +0 -56
  491. ccxt/test/base/test_borrow_interest.py +0 -35
  492. ccxt/test/base/test_borrow_rate.py +0 -32
  493. ccxt/test/base/test_calculate_fee.py +0 -51
  494. ccxt/test/base/test_crypto.py +0 -127
  495. ccxt/test/base/test_currency.py +0 -76
  496. ccxt/test/base/test_datetime.py +0 -109
  497. ccxt/test/base/test_decimal_to_precision.py +0 -392
  498. ccxt/test/base/test_deep_extend.py +0 -68
  499. ccxt/test/base/test_deposit_withdrawal.py +0 -50
  500. ccxt/test/base/test_exchange_datetime_functions.py +0 -76
  501. ccxt/test/base/test_funding_rate_history.py +0 -29
  502. ccxt/test/base/test_last_price.py +0 -31
  503. ccxt/test/base/test_ledger_entry.py +0 -45
  504. ccxt/test/base/test_ledger_item.py +0 -48
  505. ccxt/test/base/test_leverage_tier.py +0 -33
  506. ccxt/test/base/test_liquidation.py +0 -50
  507. ccxt/test/base/test_margin_mode.py +0 -24
  508. ccxt/test/base/test_margin_modification.py +0 -35
  509. ccxt/test/base/test_market.py +0 -193
  510. ccxt/test/base/test_number.py +0 -411
  511. ccxt/test/base/test_ohlcv.py +0 -33
  512. ccxt/test/base/test_open_interest.py +0 -32
  513. ccxt/test/base/test_order.py +0 -64
  514. ccxt/test/base/test_order_book.py +0 -69
  515. ccxt/test/base/test_position.py +0 -60
  516. ccxt/test/base/test_shared_methods.py +0 -353
  517. ccxt/test/base/test_status.py +0 -24
  518. ccxt/test/base/test_throttle.py +0 -126
  519. ccxt/test/base/test_ticker.py +0 -92
  520. ccxt/test/base/test_trade.py +0 -47
  521. ccxt/test/base/test_trading_fee.py +0 -26
  522. ccxt/test/base/test_transaction.py +0 -39
  523. ccxt/test/test_async.py +0 -1649
  524. ccxt/test/test_sync.py +0 -1648
  525. ccxt/wazirx.py +0 -1224
  526. ccxt_ir-4.3.46.0.3.dist-info/RECORD +0 -773
  527. /ccxt/abstract/{huobijp.py → bittrade.py} +0 -0
  528. {ccxt_ir-4.3.46.0.3.dist-info → ccxt_ir-4.5.1.dist-info/licenses}/LICENSE.txt +0 -0
  529. {ccxt_ir-4.3.46.0.3.dist-info → ccxt_ir-4.5.1.dist-info}/top_level.txt +0 -0
ccxt/woofipro.py CHANGED
@@ -5,9 +5,8 @@
5
5
 
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.woofipro import ImplicitAPI
8
- from ccxt.base.types import Balances, Currencies, Currency, Int, Leverage, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Trade, TradingFees, Transaction
8
+ from ccxt.base.types import Any, Balances, Currencies, Currency, Int, LedgerEntry, Leverage, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, FundingRate, FundingRates, Trade, TradingFees, Transaction
9
9
  from typing import List
10
- from typing import Any
11
10
  from ccxt.base.errors import ExchangeError
12
11
  from ccxt.base.errors import AuthenticationError
13
12
  from ccxt.base.errors import ArgumentsRequired
@@ -23,7 +22,7 @@ from ccxt.base.precise import Precise
23
22
 
24
23
  class woofipro(Exchange, ImplicitAPI):
25
24
 
26
- def describe(self):
25
+ def describe(self) -> Any:
27
26
  return self.deep_extend(super(woofipro, self).describe(), {
28
27
  'id': 'woofipro',
29
28
  'name': 'WOOFI PRO',
@@ -77,6 +76,8 @@ class woofipro(Exchange, ImplicitAPI):
77
76
  'fetchDeposits': True,
78
77
  'fetchDepositsWithdrawals': True,
79
78
  'fetchFundingHistory': True,
79
+ 'fetchFundingInterval': True,
80
+ 'fetchFundingIntervals': False,
80
81
  'fetchFundingRate': True,
81
82
  'fetchFundingRateHistory': True,
82
83
  'fetchFundingRates': True,
@@ -131,7 +132,7 @@ class woofipro(Exchange, ImplicitAPI):
131
132
  '1y': '1y',
132
133
  },
133
134
  'urls': {
134
- 'logo': 'https://github.com/ccxt/ccxt/assets/43336371/b1e7b348-a0fc-4605-8b7f-91176958fd69',
135
+ 'logo': 'https://github.com/user-attachments/assets/9ba21b8a-a9c7-4770-b7f1-ce3bcbde68c1',
135
136
  'api': {
136
137
  'public': 'https://api-evm.orderly.org',
137
138
  'private': 'https://api-evm.orderly.org',
@@ -306,6 +307,95 @@ class woofipro(Exchange, ImplicitAPI):
306
307
  'brokerId': 'CCXT',
307
308
  'verifyingContractAddress': '0x6F7a338F2aA472838dEFD3283eB360d4Dff5D203',
308
309
  },
310
+ 'features': {
311
+ 'default': {
312
+ 'sandbox': True,
313
+ 'createOrder': {
314
+ 'marginMode': False,
315
+ 'triggerPrice': True,
316
+ 'triggerPriceType': None,
317
+ 'triggerDirection': False,
318
+ 'stopLossPrice': False, # todo by triggerPrice
319
+ 'takeProfitPrice': False, # todo by triggerPrice
320
+ 'attachedStopLossTakeProfit': None,
321
+ 'timeInForce': {
322
+ 'IOC': True,
323
+ 'FOK': True,
324
+ 'PO': True,
325
+ 'GTD': False,
326
+ },
327
+ 'hedged': False,
328
+ 'trailing': True,
329
+ 'leverage': True, # todo implement
330
+ 'marketBuyByCost': False,
331
+ 'marketBuyRequiresPrice': False,
332
+ 'selfTradePrevention': False,
333
+ 'iceberg': True, # todo implement
334
+ },
335
+ 'createOrders': {
336
+ 'max': 10,
337
+ },
338
+ 'fetchMyTrades': {
339
+ 'marginMode': False,
340
+ 'limit': 500,
341
+ 'daysBack': None,
342
+ 'untilDays': 100000,
343
+ 'symbolRequired': False,
344
+ },
345
+ 'fetchOrder': {
346
+ 'marginMode': False,
347
+ 'trigger': True,
348
+ 'trailing': False,
349
+ 'symbolRequired': False,
350
+ },
351
+ 'fetchOpenOrders': {
352
+ 'marginMode': False,
353
+ 'limit': 500,
354
+ 'trigger': True,
355
+ 'trailing': False,
356
+ 'symbolRequired': False,
357
+ },
358
+ 'fetchOrders': None,
359
+ 'fetchClosedOrders': {
360
+ 'marginMode': False,
361
+ 'limit': 500,
362
+ 'daysBack': None,
363
+ 'daysBackCanceled': None,
364
+ 'untilDays': 100000,
365
+ 'trigger': True,
366
+ 'trailing': False,
367
+ 'symbolRequired': False,
368
+ },
369
+ 'fetchOHLCV': {
370
+ 'limit': 1000,
371
+ },
372
+ },
373
+ 'spot': {
374
+ 'extends': 'default',
375
+ },
376
+ 'forDerivatives': {
377
+ 'extends': 'default',
378
+ 'createOrder': {
379
+ # todo: implementation needs unification
380
+ 'triggerPriceType': None,
381
+ 'attachedStopLossTakeProfit': {
382
+ # todo: implementation needs unification
383
+ 'triggerPriceType': None,
384
+ 'price': False,
385
+ },
386
+ },
387
+ },
388
+ 'swap': {
389
+ 'linear': {
390
+ 'extends': 'forDerivatives',
391
+ },
392
+ 'inverse': None,
393
+ },
394
+ 'future': {
395
+ 'linear': None,
396
+ 'inverse': None,
397
+ },
398
+ },
309
399
  'commonCurrencies': {},
310
400
  'exceptions': {
311
401
  'exact': {
@@ -347,7 +437,9 @@ class woofipro(Exchange, ImplicitAPI):
347
437
  def fetch_status(self, params={}):
348
438
  """
349
439
  the latest known information on the availability of the exchange API
350
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-system-maintenance-status
440
+
441
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-system-maintenance-status
442
+
351
443
  :param dict [params]: extra parameters specific to the exchange API endpoint
352
444
  :returns dict: a `status structure <https://docs.ccxt.com/#/?id=exchange-status-structure>`
353
445
  """
@@ -378,10 +470,12 @@ class woofipro(Exchange, ImplicitAPI):
378
470
  'info': response,
379
471
  }
380
472
 
381
- def fetch_time(self, params={}):
473
+ def fetch_time(self, params={}) -> Int:
382
474
  """
383
475
  fetches the current integer timestamp in milliseconds from the exchange server
384
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-system-maintenance-status
476
+
477
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-system-maintenance-status
478
+
385
479
  :param dict [params]: extra parameters specific to the exchange API endpoint
386
480
  :returns int: the current integer timestamp in milliseconds from the exchange server
387
481
  """
@@ -454,7 +548,7 @@ class woofipro(Exchange, ImplicitAPI):
454
548
  'active': None,
455
549
  'contract': True,
456
550
  'linear': True,
457
- 'inverse': None,
551
+ 'inverse': False,
458
552
  'contractSize': self.parse_number('1'),
459
553
  'expiry': None,
460
554
  'expiryDatetime': None,
@@ -489,7 +583,9 @@ class woofipro(Exchange, ImplicitAPI):
489
583
  def fetch_markets(self, params={}) -> List[Market]:
490
584
  """
491
585
  retrieves data on all markets for woofipro
492
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-available-symbols
586
+
587
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-available-symbols
588
+
493
589
  :param dict [params]: extra parameters specific to the exchange API endpoint
494
590
  :returns dict[]: an array of objects representing market data
495
591
  """
@@ -536,12 +632,15 @@ class woofipro(Exchange, ImplicitAPI):
536
632
  def fetch_currencies(self, params={}) -> Currencies:
537
633
  """
538
634
  fetches all available currencies on an exchange
539
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-token-info
635
+
636
+ https://orderly.network/docs/build-on-omnichain/evm-api/restful-api/public/get-supported-collateral-info#get-supported-collateral-info
637
+ https://orderly.network/docs/build-on-omnichain/evm-api/restful-api/public/get-supported-chains-per-builder#get-supported-chains-per-builder
638
+
540
639
  :param dict [params]: extra parameters specific to the exchange API endpoint
541
640
  :returns dict: an associative dictionary of currencies
542
641
  """
543
642
  result: dict = {}
544
- response = self.v1PublicGetPublicToken(params)
643
+ tokenPromise = self.v1PublicGetPublicToken(params)
545
644
  #
546
645
  # {
547
646
  # "success": True,
@@ -564,25 +663,28 @@ class woofipro(Exchange, ImplicitAPI):
564
663
  # }
565
664
  # }
566
665
  #
567
- data = self.safe_dict(response, 'data', {})
568
- tokenRows = self.safe_list(data, 'rows', [])
666
+ chainPromise = self.v1PublicGetPublicChainInfo(params)
667
+ tokenResponse, chainResponse = [tokenPromise, chainPromise]
668
+ tokenData = self.safe_dict(tokenResponse, 'data', {})
669
+ tokenRows = self.safe_list(tokenData, 'rows', [])
670
+ chainData = self.safe_dict(chainResponse, 'data', {})
671
+ chainRows = self.safe_list(chainData, 'rows', [])
672
+ indexedChains = self.index_by(chainRows, 'chain_id')
569
673
  for i in range(0, len(tokenRows)):
570
674
  token = tokenRows[i]
571
675
  currencyId = self.safe_string(token, 'token')
572
676
  networks = self.safe_list(token, 'chain_details')
573
677
  code = self.safe_currency_code(currencyId)
574
- minPrecision = None
575
678
  resultingNetworks: dict = {}
576
679
  for j in range(0, len(networks)):
577
- network = networks[j]
578
- # TODO: transform chain id to human readable name
579
- networkId = self.safe_string(network, 'chain_id')
580
- precision = self.parse_precision(self.safe_string(network, 'decimals'))
581
- if precision is not None:
582
- minPrecision = precision if (minPrecision is None) else Precise.string_min(precision, minPrecision)
583
- resultingNetworks[networkId] = {
680
+ networkEntry = networks[j]
681
+ networkId = self.safe_string(networkEntry, 'chain_id')
682
+ networkRow = self.safe_dict(indexedChains, networkId)
683
+ networkName = self.safe_string(networkRow, 'name')
684
+ networkCode = self.network_id_to_code(networkName, code)
685
+ resultingNetworks[networkCode] = {
584
686
  'id': networkId,
585
- 'network': networkId,
687
+ 'network': networkCode,
586
688
  'limits': {
587
689
  'withdraw': {
588
690
  'min': None,
@@ -596,15 +698,15 @@ class woofipro(Exchange, ImplicitAPI):
596
698
  'active': None,
597
699
  'deposit': None,
598
700
  'withdraw': None,
599
- 'fee': self.safe_number(network, 'withdrawal_fee'),
600
- 'precision': self.parse_number(precision),
601
- 'info': network,
701
+ 'fee': self.safe_number(networkEntry, 'withdrawal_fee'),
702
+ 'precision': self.parse_number(self.parse_precision(self.safe_string(networkEntry, 'decimals'))),
703
+ 'info': [networkEntry, networkRow],
602
704
  }
603
- result[code] = {
705
+ result[code] = self.safe_currency_structure({
604
706
  'id': currencyId,
605
- 'name': currencyId,
707
+ 'name': None,
606
708
  'code': code,
607
- 'precision': self.parse_number(minPrecision),
709
+ 'precision': None,
608
710
  'active': None,
609
711
  'fee': None,
610
712
  'networks': resultingNetworks,
@@ -621,7 +723,7 @@ class woofipro(Exchange, ImplicitAPI):
621
723
  },
622
724
  },
623
725
  'info': token,
624
- }
726
+ })
625
727
  return result
626
728
 
627
729
  def parse_token_and_fee_temp(self, item, feeTokenKey, feeAmountKey):
@@ -673,6 +775,9 @@ class woofipro(Exchange, ImplicitAPI):
673
775
  amount = self.safe_string(trade, 'executed_quantity')
674
776
  order_id = self.safe_string(trade, 'order_id')
675
777
  fee = self.parse_token_and_fee_temp(trade, 'fee_asset', 'fee')
778
+ feeCost = self.safe_string(fee, 'cost')
779
+ if feeCost is not None:
780
+ fee['cost'] = feeCost
676
781
  cost = Precise.string_mul(price, amount)
677
782
  side = self.safe_string_lower(trade, 'side')
678
783
  id = self.safe_string(trade, 'id')
@@ -699,7 +804,9 @@ class woofipro(Exchange, ImplicitAPI):
699
804
  def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
700
805
  """
701
806
  get the list of most recent trades for a particular symbol
702
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-market-trades
807
+
808
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-market-trades
809
+
703
810
  :param str symbol: unified symbol of the market to fetch trades for
704
811
  :param int [since]: timestamp in ms of the earliest trade to fetch
705
812
  :param int [limit]: the maximum amount of trades to fetch
@@ -733,7 +840,7 @@ class woofipro(Exchange, ImplicitAPI):
733
840
  rows = self.safe_list(data, 'rows', [])
734
841
  return self.parse_trades(rows, market, since, limit)
735
842
 
736
- def parse_funding_rate(self, fundingRate, market: Market = None):
843
+ def parse_funding_rate(self, fundingRate, market: Market = None) -> FundingRate:
737
844
  #
738
845
  # {
739
846
  # "symbol":"PERP_AAVE_USDT",
@@ -745,12 +852,14 @@ class woofipro(Exchange, ImplicitAPI):
745
852
  # "sum_unitary_funding": 521.367
746
853
  # }
747
854
  #
748
- #
749
855
  symbol = self.safe_string(fundingRate, 'symbol')
750
856
  market = self.market(symbol)
751
857
  nextFundingTimestamp = self.safe_integer(fundingRate, 'next_funding_time')
752
858
  estFundingRateTimestamp = self.safe_integer(fundingRate, 'est_funding_rate_timestamp')
753
859
  lastFundingRateTimestamp = self.safe_integer(fundingRate, 'last_funding_rate_timestamp')
860
+ fundingTimeString = self.safe_string(fundingRate, 'last_funding_rate_timestamp')
861
+ nextFundingTimeString = self.safe_string(fundingRate, 'next_funding_time')
862
+ millisecondsInterval = Precise.string_sub(nextFundingTimeString, fundingTimeString)
754
863
  return {
755
864
  'info': fundingRate,
756
865
  'symbol': market['symbol'],
@@ -769,12 +878,37 @@ class woofipro(Exchange, ImplicitAPI):
769
878
  'previousFundingRate': self.safe_number(fundingRate, 'last_funding_rate'),
770
879
  'previousFundingTimestamp': lastFundingRateTimestamp,
771
880
  'previousFundingDatetime': self.iso8601(lastFundingRateTimestamp),
881
+ 'interval': self.parse_funding_interval(millisecondsInterval),
882
+ }
883
+
884
+ def parse_funding_interval(self, interval):
885
+ intervals: dict = {
886
+ '3600000': '1h',
887
+ '14400000': '4h',
888
+ '28800000': '8h',
889
+ '57600000': '16h',
890
+ '86400000': '24h',
772
891
  }
892
+ return self.safe_string(intervals, interval, interval)
773
893
 
774
- def fetch_funding_rate(self, symbol: str, params={}):
894
+ def fetch_funding_interval(self, symbol: str, params={}) -> FundingRate:
895
+ """
896
+ fetch the current funding rate interval
897
+
898
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-predicted-funding-rate-for-one-market
899
+
900
+ :param str symbol: unified market symbol
901
+ :param dict [params]: extra parameters specific to the exchange API endpoint
902
+ :returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
903
+ """
904
+ return self.fetch_funding_rate(symbol, params)
905
+
906
+ def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
775
907
  """
776
908
  fetch the current funding rate
777
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-predicted-funding-rate-for-one-market
909
+
910
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-predicted-funding-rate-for-one-market
911
+
778
912
  :param str symbol: unified market symbol
779
913
  :param dict [params]: extra parameters specific to the exchange API endpoint
780
914
  :returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
@@ -803,10 +937,12 @@ class woofipro(Exchange, ImplicitAPI):
803
937
  data = self.safe_dict(response, 'data', {})
804
938
  return self.parse_funding_rate(data, market)
805
939
 
806
- def fetch_funding_rates(self, symbols: Strings = None, params={}):
940
+ def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
807
941
  """
808
- fetch the current funding rates
809
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-predicted-funding-rates-for-all-markets
942
+ fetch the current funding rate for multiple markets
943
+
944
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-predicted-funding-rates-for-all-markets
945
+
810
946
  :param str[] symbols: unified market symbols
811
947
  :param dict [params]: extra parameters specific to the exchange API endpoint
812
948
  :returns dict[]: an array of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-structure>`
@@ -833,13 +969,14 @@ class woofipro(Exchange, ImplicitAPI):
833
969
  #
834
970
  data = self.safe_dict(response, 'data', {})
835
971
  rows = self.safe_list(data, 'rows', [])
836
- result = self.parse_funding_rates(rows)
837
- return self.filter_by_array(result, 'symbol', symbols)
972
+ return self.parse_funding_rates(rows, symbols)
838
973
 
839
974
  def fetch_funding_rate_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
840
975
  """
841
976
  fetches historical funding rate prices
842
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-funding-rate-history-for-one-market
977
+
978
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-funding-rate-history-for-one-market
979
+
843
980
  :param str symbol: unified symbol of the market to fetch the funding rate history for
844
981
  :param int [since]: timestamp in ms of the earliest funding rate to fetch
845
982
  :param int [limit]: the maximum amount of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-history-structure>` to fetch
@@ -898,10 +1035,103 @@ class woofipro(Exchange, ImplicitAPI):
898
1035
  sorted = self.sort_by(rates, 'timestamp')
899
1036
  return self.filter_by_symbol_since_limit(sorted, symbol, since, limit)
900
1037
 
1038
+ def parse_income(self, income, market: Market = None):
1039
+ #
1040
+ # {
1041
+ # "symbol": "PERP_ETH_USDC",
1042
+ # "funding_rate": 0.00046875,
1043
+ # "mark_price": 2100,
1044
+ # "funding_fee": 0.000016,
1045
+ # "payment_type": "Pay",
1046
+ # "status": "Accrued",
1047
+ # "created_time": 1682235722003,
1048
+ # "updated_time": 1682235722003
1049
+ # }
1050
+ #
1051
+ marketId = self.safe_string(income, 'symbol')
1052
+ symbol = self.safe_symbol(marketId, market)
1053
+ amount = self.safe_string(income, 'funding_fee')
1054
+ code = self.safe_currency_code('USDC')
1055
+ timestamp = self.safe_integer(income, 'updated_time')
1056
+ rate = self.safe_number(income, 'funding_rate')
1057
+ paymentType = self.safe_string(income, 'payment_type')
1058
+ amount = Precise.string_neg(amount) if (paymentType == 'Pay') else amount
1059
+ return {
1060
+ 'info': income,
1061
+ 'symbol': symbol,
1062
+ 'code': code,
1063
+ 'timestamp': timestamp,
1064
+ 'datetime': self.iso8601(timestamp),
1065
+ 'id': None,
1066
+ 'amount': self.parse_number(amount),
1067
+ 'rate': rate,
1068
+ }
1069
+
1070
+ def fetch_funding_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1071
+ """
1072
+ fetch the history of funding payments paid and received on self account
1073
+
1074
+ https://orderly.network/docs/build-on-omnichain/evm-api/restful-api/private/get-funding-fee-history
1075
+
1076
+ :param str [symbol]: unified market symbol
1077
+ :param int [since]: the earliest time in ms to fetch funding history for
1078
+ :param int [limit]: the maximum number of funding history structures to retrieve
1079
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1080
+ :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
1081
+ :returns dict: a `funding history structure <https://docs.ccxt.com/#/?id=funding-history-structure>`
1082
+ """
1083
+ self.load_markets()
1084
+ paginate = False
1085
+ paginate, params = self.handle_option_and_params(params, 'fetchFundingHistory', 'paginate')
1086
+ if paginate:
1087
+ return self.fetch_paginated_call_incremental('fetchFundingHistory', symbol, since, limit, params, 'page', 500)
1088
+ request: dict = {}
1089
+ market: Market = None
1090
+ if symbol is not None:
1091
+ market = self.market(symbol)
1092
+ request['symbol'] = market['id']
1093
+ if since is not None:
1094
+ request['start_t'] = since
1095
+ until = self.safe_integer(params, 'until') # unified in milliseconds
1096
+ params = self.omit(params, ['until'])
1097
+ if until is not None:
1098
+ request['end_t'] = until
1099
+ if limit is not None:
1100
+ request['size'] = min(limit, 500)
1101
+ response = self.v1PrivateGetFundingFeeHistory(self.extend(request, params))
1102
+ #
1103
+ # {
1104
+ # "success": True,
1105
+ # "timestamp": 1702989203989,
1106
+ # "data": {
1107
+ # "meta": {
1108
+ # "total": 9,
1109
+ # "records_per_page": 25,
1110
+ # "current_page": 1
1111
+ # },
1112
+ # "rows": [{
1113
+ # "symbol": "PERP_ETH_USDC",
1114
+ # "funding_rate": 0.00046875,
1115
+ # "mark_price": 2100,
1116
+ # "funding_fee": 0.000016,
1117
+ # "payment_type": "Pay",
1118
+ # "status": "Accrued",
1119
+ # "created_time": 1682235722003,
1120
+ # "updated_time": 1682235722003
1121
+ # }]
1122
+ # }
1123
+ # }
1124
+ #
1125
+ data = self.safe_dict(response, 'data', {})
1126
+ rows = self.safe_list(data, 'rows', [])
1127
+ return self.parse_incomes(rows, market, since, limit)
1128
+
901
1129
  def fetch_trading_fees(self, params={}) -> TradingFees:
902
1130
  """
903
1131
  fetch the trading fees for multiple markets
904
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-account-information
1132
+
1133
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-account-information
1134
+
905
1135
  :param dict [params]: extra parameters specific to the exchange API endpoint
906
1136
  :returns dict: a dictionary of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>` indexed by market symbols
907
1137
  """
@@ -953,7 +1183,9 @@ class woofipro(Exchange, ImplicitAPI):
953
1183
  def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
954
1184
  """
955
1185
  fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
956
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/orderbook-snapshot
1186
+
1187
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/orderbook-snapshot
1188
+
957
1189
  :param str symbol: unified symbol of the market to fetch the order book for
958
1190
  :param int [limit]: the maximum amount of order book entries to return
959
1191
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -1001,7 +1233,9 @@ class woofipro(Exchange, ImplicitAPI):
1001
1233
 
1002
1234
  def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
1003
1235
  """
1004
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-kline
1236
+
1237
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-kline
1238
+
1005
1239
  fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
1006
1240
  :param str symbol: unified symbol of the market to fetch OHLCV data for
1007
1241
  :param str timeframe: the length of time each candle represents
@@ -1110,7 +1344,7 @@ class woofipro(Exchange, ImplicitAPI):
1110
1344
  fee = self.safe_value_2(order, 'total_fee', 'totalFee')
1111
1345
  feeCurrency = self.safe_string_2(order, 'fee_asset', 'feeAsset')
1112
1346
  transactions = self.safe_value(order, 'Transactions')
1113
- stopPrice = self.safe_number(order, 'triggerPrice')
1347
+ triggerPrice = self.safe_number(order, 'triggerPrice')
1114
1348
  takeProfitPrice: Num = None
1115
1349
  stopLossPrice: Num = None
1116
1350
  childOrders = self.safe_value(order, 'childOrders')
@@ -1139,8 +1373,7 @@ class woofipro(Exchange, ImplicitAPI):
1139
1373
  'reduceOnly': self.safe_bool(order, 'reduce_only'),
1140
1374
  'side': side,
1141
1375
  'price': price,
1142
- 'stopPrice': stopPrice,
1143
- 'triggerPrice': stopPrice,
1376
+ 'triggerPrice': triggerPrice,
1144
1377
  'takeProfitPrice': takeProfitPrice,
1145
1378
  'stopLossPrice': stopLossPrice,
1146
1379
  'average': average,
@@ -1190,13 +1423,13 @@ class woofipro(Exchange, ImplicitAPI):
1190
1423
 
1191
1424
  def create_order_request(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
1192
1425
  """
1193
- * @ignore
1426
+ @ignore
1194
1427
  helper function to build the request
1195
1428
  :param str symbol: unified symbol of the market to create an order in
1196
1429
  :param str type: 'market' or 'limit'
1197
1430
  :param str side: 'buy' or 'sell'
1198
1431
  :param float amount: how much you want to trade in units of the base currency
1199
- :param float [price]: the price that the order is to be fullfilled, in units of the quote currency, ignored in market orders
1432
+ :param float [price]: the price that the order is to be fulfilled, in units of the quote currency, ignored in market orders
1200
1433
  :param dict [params]: extra parameters specific to the exchange API endpoint
1201
1434
  :returns dict: request to be sent to the exchange
1202
1435
  """
@@ -1208,19 +1441,19 @@ class woofipro(Exchange, ImplicitAPI):
1208
1441
  'symbol': market['id'],
1209
1442
  'side': orderSide,
1210
1443
  }
1211
- stopPrice = self.safe_string_2(params, 'triggerPrice', 'stopPrice')
1444
+ triggerPrice = self.safe_string_2(params, 'triggerPrice', 'stopPrice')
1212
1445
  stopLoss = self.safe_value(params, 'stopLoss')
1213
1446
  takeProfit = self.safe_value(params, 'takeProfit')
1214
1447
  algoType = self.safe_string(params, 'algoType')
1215
- isStop = stopPrice is not None or stopLoss is not None or takeProfit is not None or (self.safe_value(params, 'childOrders') is not None)
1448
+ isConditional = triggerPrice is not None or stopLoss is not None or takeProfit is not None or (self.safe_value(params, 'childOrders') is not None)
1216
1449
  isMarket = orderType == 'MARKET'
1217
1450
  timeInForce = self.safe_string_lower(params, 'timeInForce')
1218
1451
  postOnly = self.is_post_only(isMarket, None, params)
1219
- orderQtyKey = 'quantity' if isStop else 'order_quantity'
1220
- priceKey = 'price' if isStop else 'order_price'
1221
- typeKey = 'type' if isStop else 'order_type'
1452
+ orderQtyKey = 'quantity' if isConditional else 'order_quantity'
1453
+ priceKey = 'price' if isConditional else 'order_price'
1454
+ typeKey = 'type' if isConditional else 'order_type'
1222
1455
  request[typeKey] = orderType # LIMIT/MARKET/IOC/FOK/POST_ONLY/ASK/BID
1223
- if not isStop:
1456
+ if not isConditional:
1224
1457
  if postOnly:
1225
1458
  request['order_type'] = 'POST_ONLY'
1226
1459
  elif timeInForce == 'fok':
@@ -1231,15 +1464,15 @@ class woofipro(Exchange, ImplicitAPI):
1231
1464
  request['reduce_only'] = reduceOnly
1232
1465
  if price is not None:
1233
1466
  request[priceKey] = self.price_to_precision(symbol, price)
1234
- if isMarket and not isStop:
1467
+ if isMarket and not isConditional:
1235
1468
  request[orderQtyKey] = self.amount_to_precision(symbol, amount)
1236
1469
  elif algoType != 'POSITIONAL_TP_SL':
1237
1470
  request[orderQtyKey] = self.amount_to_precision(symbol, amount)
1238
1471
  clientOrderId = self.safe_string_n(params, ['clOrdID', 'clientOrderId', 'client_order_id'])
1239
1472
  if clientOrderId is not None:
1240
1473
  request['client_order_id'] = clientOrderId
1241
- if stopPrice is not None:
1242
- request['trigger_price'] = self.price_to_precision(symbol, stopPrice)
1474
+ if triggerPrice is not None:
1475
+ request['trigger_price'] = self.price_to_precision(symbol, triggerPrice)
1243
1476
  request['algo_type'] = 'STOP'
1244
1477
  elif (stopLoss is not None) or (takeProfit is not None):
1245
1478
  request['algo_type'] = 'TP_SL'
@@ -1249,6 +1482,7 @@ class woofipro(Exchange, ImplicitAPI):
1249
1482
  'algo_type': 'POSITIONAL_TP_SL',
1250
1483
  'child_orders': [],
1251
1484
  }
1485
+ childOrders = outterOrder['child_orders']
1252
1486
  closeSide = 'SELL' if (orderSide == 'BUY') else 'BUY'
1253
1487
  if stopLoss is not None:
1254
1488
  stopLossPrice = self.safe_number_2(stopLoss, 'triggerPrice', 'price', stopLoss)
@@ -1259,7 +1493,7 @@ class woofipro(Exchange, ImplicitAPI):
1259
1493
  'type': 'LIMIT',
1260
1494
  'reduce_only': True,
1261
1495
  }
1262
- outterOrder['child_orders'].append(stopLossOrder)
1496
+ childOrders.append(stopLossOrder)
1263
1497
  if takeProfit is not None:
1264
1498
  takeProfitPrice = self.safe_number_2(takeProfit, 'triggerPrice', 'price', takeProfit)
1265
1499
  takeProfitOrder: dict = {
@@ -1269,7 +1503,7 @@ class woofipro(Exchange, ImplicitAPI):
1269
1503
  'type': 'LIMIT',
1270
1504
  'reduce_only': True,
1271
1505
  }
1272
- outterOrder['child_orders'].append(takeProfitOrder)
1506
+ outterOrder.append(takeProfitOrder)
1273
1507
  request['child_orders'] = [outterOrder]
1274
1508
  params = self.omit(params, ['reduceOnly', 'reduce_only', 'clOrdID', 'clientOrderId', 'client_order_id', 'postOnly', 'timeInForce', 'stopPrice', 'triggerPrice', 'stopLoss', 'takeProfit'])
1275
1509
  return self.extend(request, params)
@@ -1277,13 +1511,15 @@ class woofipro(Exchange, ImplicitAPI):
1277
1511
  def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
1278
1512
  """
1279
1513
  create a trade order
1280
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/create-order
1281
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/create-algo-order
1514
+
1515
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/create-order
1516
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/create-algo-order
1517
+
1282
1518
  :param str symbol: unified symbol of the market to create an order in
1283
1519
  :param str type: 'market' or 'limit'
1284
1520
  :param str side: 'buy' or 'sell'
1285
1521
  :param float amount: how much of currency you want to trade in units of base currency
1286
- :param float [price]: the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
1522
+ :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
1287
1523
  :param dict [params]: extra parameters specific to the exchange API endpoint
1288
1524
  :param float [params.triggerPrice]: The price a trigger order is triggered at
1289
1525
  :param dict [params.takeProfit]: *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered(perpetual swap markets only)
@@ -1298,12 +1534,12 @@ class woofipro(Exchange, ImplicitAPI):
1298
1534
  self.load_markets()
1299
1535
  market = self.market(symbol)
1300
1536
  request = self.create_order_request(symbol, type, side, amount, price, params)
1301
- stopPrice = self.safe_string_2(params, 'triggerPrice', 'stopPrice')
1537
+ triggerPrice = self.safe_string_2(params, 'triggerPrice', 'stopPrice')
1302
1538
  stopLoss = self.safe_value(params, 'stopLoss')
1303
1539
  takeProfit = self.safe_value(params, 'takeProfit')
1304
- isStop = stopPrice is not None or stopLoss is not None or takeProfit is not None or (self.safe_value(params, 'childOrders') is not None)
1540
+ isConditional = triggerPrice is not None or stopLoss is not None or takeProfit is not None or (self.safe_value(params, 'childOrders') is not None)
1305
1541
  response = None
1306
- if isStop:
1542
+ if isConditional:
1307
1543
  response = self.v1PrivatePostAlgoOrder(request)
1308
1544
  #
1309
1545
  # {
@@ -1343,8 +1579,11 @@ class woofipro(Exchange, ImplicitAPI):
1343
1579
  def create_orders(self, orders: List[OrderRequest], params={}):
1344
1580
  """
1345
1581
  *contract only* create a list of trade orders
1346
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/batch-create-order
1582
+
1583
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/batch-create-order
1584
+
1347
1585
  :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
1586
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1348
1587
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1349
1588
  """
1350
1589
  self.load_markets()
@@ -1357,12 +1596,12 @@ class woofipro(Exchange, ImplicitAPI):
1357
1596
  amount = self.safe_value(rawOrder, 'amount')
1358
1597
  price = self.safe_value(rawOrder, 'price')
1359
1598
  orderParams = self.safe_dict(rawOrder, 'params', {})
1360
- stopPrice = self.safe_string_2(orderParams, 'triggerPrice', 'stopPrice')
1599
+ triggerPrice = self.safe_string_2(orderParams, 'triggerPrice', 'stopPrice')
1361
1600
  stopLoss = self.safe_value(orderParams, 'stopLoss')
1362
1601
  takeProfit = self.safe_value(orderParams, 'takeProfit')
1363
- isStop = stopPrice is not None or stopLoss is not None or takeProfit is not None or (self.safe_value(orderParams, 'childOrders') is not None)
1364
- if isStop:
1365
- raise NotSupported(self.id + 'createOrders() only support non-stop order')
1602
+ isConditional = triggerPrice is not None or stopLoss is not None or takeProfit is not None or (self.safe_value(orderParams, 'childOrders') is not None)
1603
+ if isConditional:
1604
+ raise NotSupported(self.id + ' createOrders() only support non-stop order')
1366
1605
  orderRequest = self.create_order_request(marketId, type, side, amount, price, orderParams)
1367
1606
  ordersRequests.append(orderRequest)
1368
1607
  request: dict = {
@@ -1393,14 +1632,16 @@ class woofipro(Exchange, ImplicitAPI):
1393
1632
  def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
1394
1633
  """
1395
1634
  edit a trade order
1396
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/edit-order
1397
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/edit-algo-order
1635
+
1636
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/edit-order
1637
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/edit-algo-order
1638
+
1398
1639
  :param str id: order id
1399
1640
  :param str symbol: unified symbol of the market to create an order in
1400
1641
  :param str type: 'market' or 'limit'
1401
1642
  :param str side: 'buy' or 'sell'
1402
1643
  :param float amount: how much of currency you want to trade in units of base currency
1403
- :param float [price]: the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
1644
+ :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
1404
1645
  :param dict [params]: extra parameters specific to the exchange API endpoint
1405
1646
  :param float [params.triggerPrice]: The price a trigger order is triggered at
1406
1647
  :param float [params.stopLossPrice]: price to trigger stop-loss orders
@@ -1412,19 +1653,19 @@ class woofipro(Exchange, ImplicitAPI):
1412
1653
  request: dict = {
1413
1654
  'order_id': id,
1414
1655
  }
1415
- stopPrice = self.safe_string_n(params, ['triggerPrice', 'stopPrice', 'takeProfitPrice', 'stopLossPrice'])
1416
- if stopPrice is not None:
1417
- request['triggerPrice'] = self.price_to_precision(symbol, stopPrice)
1418
- isStop = (stopPrice is not None) or (self.safe_value(params, 'childOrders') is not None)
1419
- orderQtyKey = 'quantity' if isStop else 'order_quantity'
1420
- priceKey = 'price' if isStop else 'order_price'
1656
+ triggerPrice = self.safe_string_n(params, ['triggerPrice', 'stopPrice', 'takeProfitPrice', 'stopLossPrice'])
1657
+ if triggerPrice is not None:
1658
+ request['triggerPrice'] = self.price_to_precision(symbol, triggerPrice)
1659
+ isConditional = (triggerPrice is not None) or (self.safe_value(params, 'childOrders') is not None)
1660
+ orderQtyKey = 'quantity' if isConditional else 'order_quantity'
1661
+ priceKey = 'price' if isConditional else 'order_price'
1421
1662
  if price is not None:
1422
1663
  request[priceKey] = self.price_to_precision(symbol, price)
1423
1664
  if amount is not None:
1424
1665
  request[orderQtyKey] = self.amount_to_precision(symbol, amount)
1425
1666
  params = self.omit(params, ['stopPrice', 'triggerPrice', 'takeProfitPrice', 'stopLossPrice', 'trailingTriggerPrice', 'trailingAmount', 'trailingPercent'])
1426
1667
  response = None
1427
- if isStop:
1668
+ if isConditional:
1428
1669
  response = self.v1PrivatePutAlgoOrder(self.extend(request, params))
1429
1670
  else:
1430
1671
  request['symbol'] = market['id']
@@ -1463,10 +1704,12 @@ class woofipro(Exchange, ImplicitAPI):
1463
1704
 
1464
1705
  def cancel_order(self, id: str, symbol: Str = None, params={}):
1465
1706
  """
1466
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/cancel-order
1467
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/cancel-order-by-client_order_id
1468
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/cancel-algo-order
1469
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/cancel-algo-order-by-client_order_id
1707
+
1708
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/cancel-order
1709
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/cancel-order-by-client_order_id
1710
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/cancel-algo-order
1711
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/cancel-algo-order-by-client_order_id
1712
+
1470
1713
  cancels an open order
1471
1714
  :param str id: order id
1472
1715
  :param str symbol: unified symbol of the market the order was made in
@@ -1475,9 +1718,9 @@ class woofipro(Exchange, ImplicitAPI):
1475
1718
  :param str [params.clientOrderId]: a unique id for the order
1476
1719
  :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1477
1720
  """
1478
- stop = self.safe_bool_2(params, 'stop', 'trigger', False)
1721
+ trigger = self.safe_bool_2(params, 'stop', 'trigger', False)
1479
1722
  params = self.omit(params, ['stop', 'trigger'])
1480
- if not stop and (symbol is None):
1723
+ if not trigger and (symbol is None):
1481
1724
  raise ArgumentsRequired(self.id + ' cancelOrder() requires a symbol argument')
1482
1725
  self.load_markets()
1483
1726
  market: Market = None
@@ -1490,7 +1733,7 @@ class woofipro(Exchange, ImplicitAPI):
1490
1733
  clientOrderIdExchangeSpecific = self.safe_string(params, 'client_order_id', clientOrderIdUnified)
1491
1734
  isByClientOrder = clientOrderIdExchangeSpecific is not None
1492
1735
  response = None
1493
- if stop:
1736
+ if trigger:
1494
1737
  if isByClientOrder:
1495
1738
  request['client_order_id'] = clientOrderIdExchangeSpecific
1496
1739
  params = self.omit(params, ['clOrdID', 'clientOrderId', 'client_order_id'])
@@ -1526,7 +1769,7 @@ class woofipro(Exchange, ImplicitAPI):
1526
1769
  extendParams['client_order_id'] = clientOrderIdExchangeSpecific
1527
1770
  else:
1528
1771
  extendParams['id'] = id
1529
- if stop:
1772
+ if trigger:
1530
1773
  return self.extend(self.parse_order(response), extendParams)
1531
1774
  data = self.safe_dict(response, 'data', {})
1532
1775
  return self.extend(self.parse_order(data), extendParams)
@@ -1534,8 +1777,10 @@ class woofipro(Exchange, ImplicitAPI):
1534
1777
  def cancel_orders(self, ids: List[str], symbol: Str = None, params={}):
1535
1778
  """
1536
1779
  cancel multiple orders
1537
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/batch-cancel-orders
1538
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/batch-cancel-orders-by-client_order_id
1780
+
1781
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/batch-cancel-orders
1782
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/batch-cancel-orders-by-client_order_id
1783
+
1539
1784
  :param str[] ids: order ids
1540
1785
  :param str [symbol]: unified market symbol
1541
1786
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -1568,8 +1813,10 @@ class woofipro(Exchange, ImplicitAPI):
1568
1813
 
1569
1814
  def cancel_all_orders(self, symbol: Str = None, params={}):
1570
1815
  """
1571
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/cancel-all-pending-algo-orders
1572
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/cancel-orders-in-bulk
1816
+
1817
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/cancel-all-pending-algo-orders
1818
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/cancel-orders-in-bulk
1819
+
1573
1820
  cancel all open orders in a market
1574
1821
  :param str symbol: unified market symbol
1575
1822
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -1577,18 +1824,18 @@ class woofipro(Exchange, ImplicitAPI):
1577
1824
  :returns dict: an list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1578
1825
  """
1579
1826
  self.load_markets()
1580
- stop = self.safe_bool_2(params, 'stop', 'trigger')
1827
+ trigger = self.safe_bool_2(params, 'stop', 'trigger')
1581
1828
  params = self.omit(params, ['stop', 'trigger'])
1582
1829
  request: dict = {}
1583
1830
  if symbol is not None:
1584
1831
  market = self.market(symbol)
1585
1832
  request['symbol'] = market['id']
1586
1833
  response = None
1587
- if stop:
1834
+ if trigger:
1588
1835
  response = self.v1PrivateDeleteAlgoOrders(self.extend(request, params))
1589
1836
  else:
1590
1837
  response = self.v1PrivateDeleteOrders(self.extend(request, params))
1591
- # stop
1838
+ # trigger
1592
1839
  # {
1593
1840
  # "success": True,
1594
1841
  # "timestamp": 1702989203989,
@@ -1604,18 +1851,21 @@ class woofipro(Exchange, ImplicitAPI):
1604
1851
  # }
1605
1852
  #
1606
1853
  return [
1607
- {
1854
+ self.safe_order({
1608
1855
  'info': response,
1609
- },
1856
+ }),
1610
1857
  ]
1611
1858
 
1612
1859
  def fetch_order(self, id: str, symbol: Str = None, params={}):
1613
1860
  """
1614
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-order-by-order_id
1615
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-order-by-client_order_id
1616
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-algo-order-by-order_id
1617
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-algo-order-by-client_order_id
1861
+
1862
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-order-by-order_id
1863
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-order-by-client_order_id
1864
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-algo-order-by-order_id
1865
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-algo-order-by-client_order_id
1866
+
1618
1867
  fetches information on an order made by the user
1868
+ :param str id: the order id
1619
1869
  :param str symbol: unified symbol of the market the order was made in
1620
1870
  :param dict [params]: extra parameters specific to the exchange API endpoint
1621
1871
  :param boolean [params.trigger]: whether the order is a stop/algo order
@@ -1623,13 +1873,15 @@ class woofipro(Exchange, ImplicitAPI):
1623
1873
  :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1624
1874
  """
1625
1875
  self.load_markets()
1626
- market = self.market(symbol) if (symbol is not None) else None
1627
- stop = self.safe_bool_2(params, 'stop', 'trigger', False)
1876
+ market = None
1877
+ if symbol is not None:
1878
+ market = self.market(symbol)
1879
+ trigger = self.safe_bool_2(params, 'stop', 'trigger', False)
1628
1880
  request: dict = {}
1629
1881
  clientOrderId = self.safe_string_n(params, ['clOrdID', 'clientOrderId', 'client_order_id'])
1630
1882
  params = self.omit(params, ['stop', 'trigger', 'clOrdID', 'clientOrderId', 'client_order_id'])
1631
1883
  response = None
1632
- if stop:
1884
+ if trigger:
1633
1885
  if clientOrderId:
1634
1886
  request['client_order_id'] = clientOrderId
1635
1887
  response = self.v1PrivateGetAlgoClientOrderClientOrderId(self.extend(request, params))
@@ -1676,8 +1928,10 @@ class woofipro(Exchange, ImplicitAPI):
1676
1928
  def fetch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1677
1929
  """
1678
1930
  fetches information on multiple orders made by the user
1679
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-orders
1680
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-algo-orders
1931
+
1932
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-orders
1933
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-algo-orders
1934
+
1681
1935
  :param str symbol: unified market symbol of the market orders were made in
1682
1936
  :param int [since]: the earliest time in ms to fetch orders for
1683
1937
  :param int [limit]: the maximum number of order structures to retrieve
@@ -1757,8 +2011,10 @@ class woofipro(Exchange, ImplicitAPI):
1757
2011
  def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1758
2012
  """
1759
2013
  fetches information on multiple orders made by the user
1760
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-orders
1761
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-algo-orders
2014
+
2015
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-orders
2016
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-algo-orders
2017
+
1762
2018
  :param str symbol: unified market symbol of the market orders were made in
1763
2019
  :param int [since]: the earliest time in ms to fetch orders for
1764
2020
  :param int [limit]: the maximum number of order structures to retrieve
@@ -1777,8 +2033,10 @@ class woofipro(Exchange, ImplicitAPI):
1777
2033
  def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1778
2034
  """
1779
2035
  fetches information on multiple orders made by the user
1780
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-orders
1781
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-algo-orders
2036
+
2037
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-orders
2038
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-algo-orders
2039
+
1782
2040
  :param str symbol: unified market symbol of the market orders were made in
1783
2041
  :param int [since]: the earliest time in ms to fetch orders for
1784
2042
  :param int [limit]: the maximum number of order structures to retrieve
@@ -1797,7 +2055,9 @@ class woofipro(Exchange, ImplicitAPI):
1797
2055
  def fetch_order_trades(self, id: str, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1798
2056
  """
1799
2057
  fetch all the trades made from a single order
1800
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-all-trades-of-specific-order
2058
+
2059
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-all-trades-of-specific-order
2060
+
1801
2061
  :param str id: order id
1802
2062
  :param str symbol: unified market symbol
1803
2063
  :param int [since]: the earliest time in ms to fetch trades for
@@ -1840,7 +2100,9 @@ class woofipro(Exchange, ImplicitAPI):
1840
2100
 
1841
2101
  def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1842
2102
  """
1843
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-trades
2103
+
2104
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-trades
2105
+
1844
2106
  fetch all trades made by the user
1845
2107
  :param str symbol: unified market symbol
1846
2108
  :param int [since]: the earliest time in ms to fetch trades for
@@ -1915,7 +2177,9 @@ class woofipro(Exchange, ImplicitAPI):
1915
2177
  def fetch_balance(self, params={}) -> Balances:
1916
2178
  """
1917
2179
  query for balance and get the amount of funds available for trading or funds locked in orders
1918
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-current-holding
2180
+
2181
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-current-holding
2182
+
1919
2183
  :param dict [params]: extra parameters specific to the exchange API endpoint
1920
2184
  :returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
1921
2185
  """
@@ -1983,14 +2247,16 @@ class woofipro(Exchange, ImplicitAPI):
1983
2247
  data = self.safe_dict(response, 'data', {})
1984
2248
  return [currency, self.safe_list(data, 'rows', [])]
1985
2249
 
1986
- def parse_ledger_entry(self, item: dict, currency: Currency = None):
1987
- code = self.safe_string(item, 'token')
2250
+ def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
2251
+ currencyId = self.safe_string(item, 'token')
2252
+ code = self.safe_currency_code(currencyId, currency)
2253
+ currency = self.safe_currency(currencyId, currency)
1988
2254
  amount = self.safe_number(item, 'amount')
1989
2255
  side = self.safe_string(item, 'token_side')
1990
2256
  direction = 'in' if (side == 'DEPOSIT') else 'out'
1991
2257
  timestamp = self.safe_integer(item, 'created_time')
1992
2258
  fee = self.parse_token_and_fee_temp(item, 'fee_token', 'fee_amount')
1993
- return {
2259
+ return self.safe_ledger_entry({
1994
2260
  'id': self.safe_string(item, 'id'),
1995
2261
  'currency': code,
1996
2262
  'account': self.safe_string(item, 'account'),
@@ -2006,7 +2272,7 @@ class woofipro(Exchange, ImplicitAPI):
2006
2272
  'datetime': self.iso8601(timestamp),
2007
2273
  'type': self.parse_ledger_entry_type(self.safe_string(item, 'type')),
2008
2274
  'info': item,
2009
- }
2275
+ }, currency)
2010
2276
 
2011
2277
  def parse_ledger_entry_type(self, type):
2012
2278
  types: dict = {
@@ -2015,17 +2281,21 @@ class woofipro(Exchange, ImplicitAPI):
2015
2281
  }
2016
2282
  return self.safe_string(types, type, type)
2017
2283
 
2018
- def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
2284
+ def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
2019
2285
  """
2020
- fetch the history of changes, actions done by the user or operations that altered balance of the user
2021
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-asset-history
2022
- :param str code: unified currency code, default is None
2286
+ fetch the history of changes, actions done by the user or operations that altered the balance of the user
2287
+
2288
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-asset-history
2289
+
2290
+ :param str [code]: unified currency code, default is None
2023
2291
  :param int [since]: timestamp in ms of the earliest ledger entry, default is None
2024
- :param int [limit]: max number of ledger entrys to return, default is None
2292
+ :param int [limit]: max number of ledger entries to return, default is None
2025
2293
  :param dict [params]: extra parameters specific to the exchange API endpoint
2026
- :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
2294
+ :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
2027
2295
  """
2028
- currency, rows = self.get_asset_history_rows(code, since, limit, params)
2296
+ currencyRows = self.get_asset_history_rows(code, since, limit, params)
2297
+ currency = self.safe_value(currencyRows, 0)
2298
+ rows = self.safe_list(currencyRows, 1)
2029
2299
  return self.parse_ledger(rows, currency, since, limit, params)
2030
2300
 
2031
2301
  def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
@@ -2074,7 +2344,9 @@ class woofipro(Exchange, ImplicitAPI):
2074
2344
  def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
2075
2345
  """
2076
2346
  fetch all deposits made to an account
2077
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-asset-history
2347
+
2348
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-asset-history
2349
+
2078
2350
  :param str code: unified currency code
2079
2351
  :param int [since]: the earliest time in ms to fetch deposits for
2080
2352
  :param int [limit]: the maximum number of deposits structures to retrieve
@@ -2089,7 +2361,9 @@ class woofipro(Exchange, ImplicitAPI):
2089
2361
  def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
2090
2362
  """
2091
2363
  fetch all withdrawals made from an account
2092
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-asset-history
2364
+
2365
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-asset-history
2366
+
2093
2367
  :param str code: unified currency code
2094
2368
  :param int [since]: the earliest time in ms to fetch withdrawals for
2095
2369
  :param int [limit]: the maximum number of withdrawals structures to retrieve
@@ -2104,7 +2378,9 @@ class woofipro(Exchange, ImplicitAPI):
2104
2378
  def fetch_deposits_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
2105
2379
  """
2106
2380
  fetch history of deposits and withdrawals
2107
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-asset-history
2381
+
2382
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-asset-history
2383
+
2108
2384
  :param str [code]: unified currency code for the currency of the deposit/withdrawals, default is None
2109
2385
  :param int [since]: timestamp in ms of the earliest deposit/withdrawal, default is None
2110
2386
  :param int [limit]: max number of deposit/withdrawals to return, default is None
@@ -2112,7 +2388,9 @@ class woofipro(Exchange, ImplicitAPI):
2112
2388
  :returns dict: a list of `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
2113
2389
  """
2114
2390
  request: dict = {}
2115
- currency, rows = self.get_asset_history_rows(code, since, limit, self.extend(request, params))
2391
+ currencyRows = self.get_asset_history_rows(code, since, limit, self.extend(request, params))
2392
+ currency = self.safe_value(currencyRows, 0)
2393
+ rows = self.safe_list(currencyRows, 1)
2116
2394
  #
2117
2395
  # {
2118
2396
  # "rows":[],
@@ -2153,10 +2431,12 @@ class woofipro(Exchange, ImplicitAPI):
2153
2431
  def sign_message(self, message, privateKey):
2154
2432
  return self.sign_hash(self.hash_message(message), privateKey[-64:])
2155
2433
 
2156
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
2434
+ def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
2157
2435
  """
2158
2436
  make a withdrawal
2159
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/create-withdraw-request
2437
+
2438
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/create-withdraw-request
2439
+
2160
2440
  :param str code: unified currency code
2161
2441
  :param float amount: the amount to withdraw
2162
2442
  :param str address: the address to withdraw to
@@ -2169,7 +2449,7 @@ class woofipro(Exchange, ImplicitAPI):
2169
2449
  if code is not None:
2170
2450
  code = code.upper()
2171
2451
  if code != 'USDC':
2172
- raise NotSupported(self.id + 'withdraw() only support USDC')
2452
+ raise NotSupported(self.id + ' withdraw() only support USDC')
2173
2453
  currency = self.currency(code)
2174
2454
  verifyingContractAddress = self.safe_string(self.options, 'verifyingContractAddress')
2175
2455
  chainId = self.safe_string(params, 'chainId')
@@ -2241,7 +2521,9 @@ class woofipro(Exchange, ImplicitAPI):
2241
2521
  def fetch_leverage(self, symbol: str, params={}) -> Leverage:
2242
2522
  """
2243
2523
  fetch the set leverage for a market
2244
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-account-information
2524
+
2525
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-account-information
2526
+
2245
2527
  :param str symbol: unified market symbol
2246
2528
  :param dict [params]: extra parameters specific to the exchange API endpoint
2247
2529
  :returns dict: a `leverage structure <https://docs.ccxt.com/#/?id=leverage-structure>`
@@ -2279,11 +2561,14 @@ class woofipro(Exchange, ImplicitAPI):
2279
2561
  data = self.safe_dict(response, 'data', {})
2280
2562
  return self.parse_leverage(data, market)
2281
2563
 
2282
- def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
2564
+ def set_leverage(self, leverage: int, symbol: Str = None, params={}):
2283
2565
  """
2284
2566
  set the level of leverage for a market
2285
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/update-leverage-setting
2286
- :param str symbol: unified market symbol
2567
+
2568
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/update-leverage-setting
2569
+
2570
+ :param int [leverage]: the rate of leverage
2571
+ :param str [symbol]: unified market symbol
2287
2572
  :param dict [params]: extra parameters specific to the exchange API endpoint
2288
2573
  :returns dict: response from the exchange
2289
2574
  """
@@ -2364,9 +2649,11 @@ class woofipro(Exchange, ImplicitAPI):
2364
2649
  'takeProfitPrice': None,
2365
2650
  })
2366
2651
 
2367
- def fetch_position(self, symbol: Str = None, params={}):
2652
+ def fetch_position(self, symbol: Str, params={}):
2368
2653
  """
2369
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-one-position-info
2654
+
2655
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-one-position-info
2656
+
2370
2657
  fetch data on an open position
2371
2658
  :param str symbol: unified market symbol of the market the position is held in
2372
2659
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -2407,13 +2694,14 @@ class woofipro(Exchange, ImplicitAPI):
2407
2694
  data = self.safe_dict(response, 'data')
2408
2695
  return self.parse_position(data, market)
2409
2696
 
2410
- def fetch_positions(self, symbols: Strings = None, params={}):
2697
+ def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
2411
2698
  """
2412
2699
  fetch all open positions
2413
- :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-all-positions-info
2700
+
2701
+ https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-all-positions-info
2702
+
2414
2703
  :param str[] [symbols]: list of unified market symbols
2415
2704
  :param dict [params]: extra parameters specific to the exchange API endpoint
2416
- :param str [method]: method name to call, "positionRisk", "account" or "option", default is "positionRisk"
2417
2705
  :returns dict[]: a list of `position structure <https://docs.ccxt.com/#/?id=position-structure>`
2418
2706
  """
2419
2707
  self.load_markets()
@@ -2491,9 +2779,12 @@ class woofipro(Exchange, ImplicitAPI):
2491
2779
  auth = ''
2492
2780
  ts = str(self.nonce())
2493
2781
  url += pathWithParams
2782
+ apiKey = self.apiKey
2783
+ if apiKey.find('ed25519:') < 0:
2784
+ apiKey = 'ed25519:' + apiKey
2494
2785
  headers = {
2495
2786
  'orderly-account-id': self.accountId,
2496
- 'orderly-key': self.apiKey,
2787
+ 'orderly-key': apiKey,
2497
2788
  'orderly-timestamp': ts,
2498
2789
  }
2499
2790
  auth = ts + method + '/' + version + '/' + pathWithParams