ccxt 4.3.5__py2.py3-none-any.whl → 4.3.7__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.

Potentially problematic release.


This version of ccxt might be problematic. Click here for more details.

Files changed (189) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/binance.py +1 -0
  3. ccxt/abstract/binancecoinm.py +1 -0
  4. ccxt/abstract/binanceus.py +1 -0
  5. ccxt/abstract/binanceusdm.py +1 -0
  6. ccxt/abstract/bingx.py +1 -0
  7. ccxt/abstract/coinbase.py +5 -0
  8. ccxt/abstract/woo.py +1 -0
  9. ccxt/ace.py +5 -0
  10. ccxt/alpaca.py +6 -0
  11. ccxt/ascendex.py +2 -2
  12. ccxt/async_support/__init__.py +1 -1
  13. ccxt/async_support/ace.py +5 -0
  14. ccxt/async_support/alpaca.py +6 -0
  15. ccxt/async_support/ascendex.py +2 -2
  16. ccxt/async_support/base/exchange.py +30 -1
  17. ccxt/async_support/bigone.py +1 -1
  18. ccxt/async_support/binance.py +7 -3
  19. ccxt/async_support/bingx.py +43 -1
  20. ccxt/async_support/bitbank.py +4 -1
  21. ccxt/async_support/bitfinex.py +1 -1
  22. ccxt/async_support/bitfinex2.py +1 -1
  23. ccxt/async_support/bitflyer.py +1 -1
  24. ccxt/async_support/bitget.py +70 -4
  25. ccxt/async_support/bithumb.py +5 -1
  26. ccxt/async_support/bitmart.py +1 -1
  27. ccxt/async_support/bitmex.py +25 -1
  28. ccxt/async_support/bitopro.py +6 -1
  29. ccxt/async_support/bitrue.py +1 -1
  30. ccxt/async_support/bitso.py +4 -1
  31. ccxt/async_support/bitstamp.py +4 -1
  32. ccxt/async_support/bitteam.py +4 -0
  33. ccxt/async_support/bitvavo.py +4 -1
  34. ccxt/async_support/bl3p.py +3 -0
  35. ccxt/async_support/blockchaincom.py +1 -1
  36. ccxt/async_support/btcalpha.py +3 -0
  37. ccxt/async_support/btcbox.py +3 -0
  38. ccxt/async_support/btcmarkets.py +4 -1
  39. ccxt/async_support/btcturk.py +3 -0
  40. ccxt/async_support/bybit.py +196 -14
  41. ccxt/async_support/cex.py +6 -0
  42. ccxt/async_support/coinbase.py +98 -22
  43. ccxt/async_support/coinbaseinternational.py +3 -1
  44. ccxt/async_support/coinbasepro.py +7 -1
  45. ccxt/async_support/coincheck.py +3 -0
  46. ccxt/async_support/coinex.py +180 -79
  47. ccxt/async_support/coinlist.py +5 -1
  48. ccxt/async_support/coinmate.py +4 -1
  49. ccxt/async_support/coinone.py +3 -0
  50. ccxt/async_support/coinsph.py +5 -1
  51. ccxt/async_support/coinspot.py +3 -0
  52. ccxt/async_support/cryptocom.py +33 -2
  53. ccxt/async_support/delta.py +2 -2
  54. ccxt/async_support/deribit.py +1 -1
  55. ccxt/async_support/digifinex.py +3 -3
  56. ccxt/async_support/exmo.py +8 -3
  57. ccxt/async_support/gate.py +112 -24
  58. ccxt/async_support/gemini.py +1 -1
  59. ccxt/async_support/hitbtc.py +7 -6
  60. ccxt/async_support/hollaex.py +1 -1
  61. ccxt/async_support/htx.py +29 -1
  62. ccxt/async_support/huobijp.py +1 -1
  63. ccxt/async_support/hyperliquid.py +39 -2
  64. ccxt/async_support/idex.py +4 -1
  65. ccxt/async_support/independentreserve.py +3 -0
  66. ccxt/async_support/indodax.py +4 -1
  67. ccxt/async_support/kraken.py +28 -1
  68. ccxt/async_support/krakenfutures.py +26 -0
  69. ccxt/async_support/kucoin.py +3 -1
  70. ccxt/async_support/kucoinfutures.py +5 -3
  71. ccxt/async_support/kuna.py +1 -1
  72. ccxt/async_support/latoken.py +6 -0
  73. ccxt/async_support/lbank.py +1 -1
  74. ccxt/async_support/luno.py +3 -0
  75. ccxt/async_support/lykke.py +6 -1
  76. ccxt/async_support/mercado.py +4 -1
  77. ccxt/async_support/mexc.py +110 -4
  78. ccxt/async_support/ndax.py +5 -1
  79. ccxt/async_support/novadax.py +5 -1
  80. ccxt/async_support/okcoin.py +1 -1
  81. ccxt/async_support/okx.py +183 -4
  82. ccxt/async_support/onetrading.py +4 -1
  83. ccxt/async_support/p2b.py +3 -0
  84. ccxt/async_support/phemex.py +1 -1
  85. ccxt/async_support/poloniex.py +1 -1
  86. ccxt/async_support/probit.py +4 -1
  87. ccxt/async_support/timex.py +3 -0
  88. ccxt/async_support/tokocrypto.py +1 -1
  89. ccxt/async_support/tradeogre.py +3 -0
  90. ccxt/async_support/upbit.py +1 -1
  91. ccxt/async_support/wavesexchange.py +4 -1
  92. ccxt/async_support/wazirx.py +3 -0
  93. ccxt/async_support/whitebit.py +38 -1
  94. ccxt/async_support/woo.py +30 -1
  95. ccxt/async_support/yobit.py +4 -1
  96. ccxt/async_support/zaif.py +1 -1
  97. ccxt/async_support/zonda.py +1 -1
  98. ccxt/base/exchange.py +30 -1
  99. ccxt/bigone.py +1 -1
  100. ccxt/binance.py +7 -3
  101. ccxt/bingx.py +43 -1
  102. ccxt/bitbank.py +4 -1
  103. ccxt/bitfinex.py +1 -1
  104. ccxt/bitfinex2.py +1 -1
  105. ccxt/bitflyer.py +1 -1
  106. ccxt/bitget.py +70 -4
  107. ccxt/bithumb.py +5 -1
  108. ccxt/bitmart.py +1 -1
  109. ccxt/bitmex.py +25 -1
  110. ccxt/bitopro.py +6 -1
  111. ccxt/bitrue.py +1 -1
  112. ccxt/bitso.py +4 -1
  113. ccxt/bitstamp.py +4 -1
  114. ccxt/bitteam.py +4 -0
  115. ccxt/bitvavo.py +4 -1
  116. ccxt/bl3p.py +3 -0
  117. ccxt/blockchaincom.py +1 -1
  118. ccxt/btcalpha.py +3 -0
  119. ccxt/btcbox.py +3 -0
  120. ccxt/btcmarkets.py +4 -1
  121. ccxt/btcturk.py +3 -0
  122. ccxt/bybit.py +196 -14
  123. ccxt/cex.py +6 -0
  124. ccxt/coinbase.py +98 -22
  125. ccxt/coinbaseinternational.py +3 -1
  126. ccxt/coinbasepro.py +7 -1
  127. ccxt/coincheck.py +3 -0
  128. ccxt/coinex.py +180 -79
  129. ccxt/coinlist.py +5 -1
  130. ccxt/coinmate.py +4 -1
  131. ccxt/coinone.py +3 -0
  132. ccxt/coinsph.py +5 -1
  133. ccxt/coinspot.py +3 -0
  134. ccxt/cryptocom.py +33 -2
  135. ccxt/delta.py +2 -2
  136. ccxt/deribit.py +1 -1
  137. ccxt/digifinex.py +3 -3
  138. ccxt/exmo.py +8 -3
  139. ccxt/gate.py +112 -24
  140. ccxt/gemini.py +1 -1
  141. ccxt/hitbtc.py +7 -6
  142. ccxt/hollaex.py +1 -1
  143. ccxt/htx.py +29 -1
  144. ccxt/huobijp.py +1 -1
  145. ccxt/hyperliquid.py +39 -2
  146. ccxt/idex.py +4 -1
  147. ccxt/independentreserve.py +3 -0
  148. ccxt/indodax.py +4 -1
  149. ccxt/kraken.py +28 -1
  150. ccxt/krakenfutures.py +26 -0
  151. ccxt/kucoin.py +3 -1
  152. ccxt/kucoinfutures.py +5 -3
  153. ccxt/kuna.py +1 -1
  154. ccxt/latoken.py +6 -0
  155. ccxt/lbank.py +1 -1
  156. ccxt/luno.py +3 -0
  157. ccxt/lykke.py +6 -1
  158. ccxt/mercado.py +4 -1
  159. ccxt/mexc.py +110 -4
  160. ccxt/ndax.py +5 -1
  161. ccxt/novadax.py +5 -1
  162. ccxt/okcoin.py +1 -1
  163. ccxt/okx.py +183 -4
  164. ccxt/onetrading.py +4 -1
  165. ccxt/p2b.py +3 -0
  166. ccxt/phemex.py +1 -1
  167. ccxt/poloniex.py +1 -1
  168. ccxt/pro/__init__.py +1 -1
  169. ccxt/pro/bitget.py +1 -1
  170. ccxt/pro/bybit.py +1 -1
  171. ccxt/pro/coinbase.py +28 -28
  172. ccxt/probit.py +4 -1
  173. ccxt/test/test_async.py +2 -0
  174. ccxt/test/test_sync.py +2 -0
  175. ccxt/timex.py +3 -0
  176. ccxt/tokocrypto.py +1 -1
  177. ccxt/tradeogre.py +3 -0
  178. ccxt/upbit.py +1 -1
  179. ccxt/wavesexchange.py +4 -1
  180. ccxt/wazirx.py +3 -0
  181. ccxt/whitebit.py +38 -1
  182. ccxt/woo.py +30 -1
  183. ccxt/yobit.py +4 -1
  184. ccxt/zaif.py +1 -1
  185. ccxt/zonda.py +1 -1
  186. {ccxt-4.3.5.dist-info → ccxt-4.3.7.dist-info}/METADATA +4 -4
  187. {ccxt-4.3.5.dist-info → ccxt-4.3.7.dist-info}/RECORD +189 -189
  188. {ccxt-4.3.5.dist-info → ccxt-4.3.7.dist-info}/WHEEL +0 -0
  189. {ccxt-4.3.5.dist-info → ccxt-4.3.7.dist-info}/top_level.txt +0 -0
@@ -82,8 +82,11 @@ class probit(Exchange, ImplicitAPI):
82
82
  'fetchOrder': True,
83
83
  'fetchOrderBook': True,
84
84
  'fetchPosition': False,
85
+ 'fetchPositionHistory': False,
85
86
  'fetchPositionMode': False,
86
87
  'fetchPositions': False,
88
+ 'fetchPositionsForSymbol': False,
89
+ 'fetchPositionsHistory': False,
87
90
  'fetchPositionsRisk': False,
88
91
  'fetchPremiumIndexOHLCV': False,
89
92
  'fetchTicker': True,
@@ -1331,7 +1334,7 @@ class probit(Exchange, ImplicitAPI):
1331
1334
  data = self.safe_list(response, 'data', [])
1332
1335
  return self.parse_deposit_addresses(data, codes)
1333
1336
 
1334
- async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
1337
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1335
1338
  """
1336
1339
  :see: https://docs-en.probit.com/reference/withdrawal
1337
1340
  make a withdrawal
@@ -78,8 +78,11 @@ class timex(Exchange, ImplicitAPI):
78
78
  'fetchOrder': True,
79
79
  'fetchOrderBook': True,
80
80
  'fetchPosition': False,
81
+ 'fetchPositionHistory': False,
81
82
  'fetchPositionMode': False,
82
83
  'fetchPositions': False,
84
+ 'fetchPositionsForSymbol': False,
85
+ 'fetchPositionsHistory': False,
83
86
  'fetchPositionsRisk': False,
84
87
  'fetchPremiumIndexOHLCV': False,
85
88
  'fetchTicker': True,
@@ -2237,7 +2237,7 @@ class tokocrypto(Exchange, ImplicitAPI):
2237
2237
  'fee': fee,
2238
2238
  }
2239
2239
 
2240
- async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
2240
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
2241
2241
  """
2242
2242
  :see: https://www.tokocrypto.com/apidocs/#withdraw-signed
2243
2243
  make a withdrawal
@@ -84,8 +84,11 @@ class tradeogre(Exchange, ImplicitAPI):
84
84
  'fetchOrderTrades': False,
85
85
  'fetchPermissions': False,
86
86
  'fetchPosition': False,
87
+ 'fetchPositionHistory': False,
88
+ 'fetchPositionMode': False,
87
89
  'fetchPositions': False,
88
90
  'fetchPositionsForSymbol': False,
91
+ 'fetchPositionsHistory': False,
89
92
  'fetchPositionsRisk': False,
90
93
  'fetchPremiumIndexOHLCV': False,
91
94
  'fetchTicker': True,
@@ -1717,7 +1717,7 @@ class upbit(Exchange, ImplicitAPI):
1717
1717
  raise AddressPending(self.id + ' is generating ' + code + ' deposit address, call fetchDepositAddress or createDepositAddress one more time later to retrieve the generated address')
1718
1718
  return self.parse_deposit_address(response)
1719
1719
 
1720
- async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
1720
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1721
1721
  """
1722
1722
  :see: https://docs.upbit.com/reference/디지털자산-출금하기
1723
1723
  :see: https://docs.upbit.com/reference/%EC%9B%90%ED%99%94-%EC%B6%9C%EA%B8%88%ED%95%98%EA%B8%B0
@@ -80,8 +80,11 @@ class wavesexchange(Exchange, ImplicitAPI):
80
80
  'fetchOrderBook': True,
81
81
  'fetchOrders': True,
82
82
  'fetchPosition': False,
83
+ 'fetchPositionHistory': False,
83
84
  'fetchPositionMode': False,
84
85
  'fetchPositions': False,
86
+ 'fetchPositionsForSymbol': False,
87
+ 'fetchPositionsHistory': False,
85
88
  'fetchPositionsRisk': False,
86
89
  'fetchPremiumIndexOHLCV': False,
87
90
  'fetchTicker': True,
@@ -2290,7 +2293,7 @@ class wavesexchange(Exchange, ImplicitAPI):
2290
2293
  raise ExchangeError(self.id + ' ' + body)
2291
2294
  return None
2292
2295
 
2293
- async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
2296
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
2294
2297
  """
2295
2298
  make a withdrawal
2296
2299
  :param str code: unified currency code
@@ -82,8 +82,11 @@ class wazirx(Exchange, ImplicitAPI):
82
82
  'fetchOrderBook': True,
83
83
  'fetchOrders': True,
84
84
  'fetchPosition': False,
85
+ 'fetchPositionHistory': False,
85
86
  'fetchPositionMode': False,
86
87
  'fetchPositions': False,
88
+ 'fetchPositionsForSymbol': False,
89
+ 'fetchPositionsHistory': False,
87
90
  'fetchPositionsRisk': False,
88
91
  'fetchPremiumIndexOHLCV': False,
89
92
  'fetchStatus': True,
@@ -42,6 +42,7 @@ class whitebit(Exchange, ImplicitAPI):
42
42
  'future': False,
43
43
  'option': False,
44
44
  'cancelAllOrders': True,
45
+ 'cancelAllOrdersAfter': True,
45
46
  'cancelOrder': True,
46
47
  'cancelOrders': False,
47
48
  'createOrder': True,
@@ -1332,6 +1333,42 @@ class whitebit(Exchange, ImplicitAPI):
1332
1333
  #
1333
1334
  return response
1334
1335
 
1336
+ async def cancel_all_orders_after(self, timeout: Int, params={}):
1337
+ """
1338
+ dead man's switch, cancel all orders after the given timeout
1339
+ :see: https://docs.whitebit.com/private/http-trade-v4/#sync-kill-switch-timer
1340
+ :param number timeout: time in milliseconds, 0 represents cancel the timer
1341
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1342
+ :param str [params.types]: Order types value. Example: "spot", "margin", "futures" or None
1343
+ :param str [params.symbol]: symbol unified symbol of the market the order was made in
1344
+ :returns dict: the api result
1345
+ """
1346
+ await self.load_markets()
1347
+ symbol = self.safe_string(params, 'symbol')
1348
+ if symbol is None:
1349
+ raise ArgumentsRequired(self.id + ' cancelAllOrdersAfter() requires a symbol argument in params')
1350
+ market = self.market(symbol)
1351
+ params = self.omit(params, 'symbol')
1352
+ isBiggerThanZero = (timeout > 0)
1353
+ request: dict = {
1354
+ 'market': market['id'],
1355
+ # 'timeout': self.number_to_string(timeout / 1000) if (timeout > 0) else null,
1356
+ }
1357
+ if isBiggerThanZero:
1358
+ request['timeout'] = self.number_to_string(timeout / 1000)
1359
+ else:
1360
+ request['timeout'] = 'null'
1361
+ response = await self.v4PrivatePostOrderKillSwitch(self.extend(request, params))
1362
+ #
1363
+ # {
1364
+ # "market": "BTC_USDT", # currency market,
1365
+ # "startTime": 1662478154, # now timestamp,
1366
+ # "cancellationTime": 1662478154, # now + timer_value,
1367
+ # "types": ["spot", "margin"]
1368
+ # }
1369
+ #
1370
+ return response
1371
+
1335
1372
  def parse_balance(self, response) -> Balances:
1336
1373
  balanceKeys = list(response.keys())
1337
1374
  result = {}
@@ -1772,7 +1809,7 @@ class whitebit(Exchange, ImplicitAPI):
1772
1809
  'status': None,
1773
1810
  }
1774
1811
 
1775
- async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
1812
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1776
1813
  """
1777
1814
  make a withdrawal
1778
1815
  :see: https://docs.whitebit.com/private/http-main-v4/#create-withdraw-request
ccxt/async_support/woo.py CHANGED
@@ -41,6 +41,7 @@ class woo(Exchange, ImplicitAPI):
41
41
  'option': False,
42
42
  'addMargin': False,
43
43
  'cancelAllOrders': True,
44
+ 'cancelAllOrdersAfter': True,
44
45
  'cancelOrder': True,
45
46
  'cancelWithdraw': False, # exchange have that endpoint disabled atm, but was once implemented in ccxt per old docs: https://kronosresearch.github.io/wootrade-documents/#cancel-withdraw-request
46
47
  'closeAllPositions': False,
@@ -96,8 +97,10 @@ class woo(Exchange, ImplicitAPI):
96
97
  'fetchOrders': True,
97
98
  'fetchOrderTrades': True,
98
99
  'fetchPosition': True,
100
+ 'fetchPositionHistory': False,
99
101
  'fetchPositionMode': False,
100
102
  'fetchPositions': True,
103
+ 'fetchPositionsHistory': False,
101
104
  'fetchPremiumIndexOHLCV': False,
102
105
  'fetchStatus': True,
103
106
  'fetchTicker': False,
@@ -208,6 +211,7 @@ class woo(Exchange, ImplicitAPI):
208
211
  },
209
212
  'post': {
210
213
  'order': 5, # 2 requests per 1 second per symbol
214
+ 'order/cancel_all_after': 1,
211
215
  'asset/main_sub_transfer': 30, # 20 requests per 60 seconds
212
216
  'asset/ltv': 30,
213
217
  'asset/withdraw': 30, # implemented in ccxt, disabled on the exchange side https://kronosresearch.github.io/wootrade-documents/#token-withdraw
@@ -1203,6 +1207,31 @@ class woo(Exchange, ImplicitAPI):
1203
1207
  #
1204
1208
  return response
1205
1209
 
1210
+ async def cancel_all_orders_after(self, timeout: Int, params={}):
1211
+ """
1212
+ dead man's switch, cancel all orders after the given timeout
1213
+ :see: https://docs.woo.org/#cancel-all-after
1214
+ :param number timeout: time in milliseconds, 0 represents cancel the timer
1215
+ :param boolean activated: countdown
1216
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1217
+ :returns dict: the api result
1218
+ """
1219
+ await self.load_markets()
1220
+ request: dict = {
1221
+ 'trigger_after': timeout if (timeout > 0) else 0,
1222
+ }
1223
+ response = await self.v1PrivatePostOrderCancelAllAfter(self.extend(request, params))
1224
+ #
1225
+ # {
1226
+ # "success": True,
1227
+ # "data": {
1228
+ # "expected_trigger_time": 1711534302938
1229
+ # },
1230
+ # "timestamp": 1711534302943
1231
+ # }
1232
+ #
1233
+ return response
1234
+
1206
1235
  async def fetch_order(self, id: str, symbol: Str = None, params={}):
1207
1236
  """
1208
1237
  :see: https://docs.woo.org/#get-algo-order
@@ -2211,7 +2240,7 @@ class woo(Exchange, ImplicitAPI):
2211
2240
  }
2212
2241
  return self.safe_string(statuses, status, status)
2213
2242
 
2214
- async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
2243
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
2215
2244
  """
2216
2245
  make a withdrawal
2217
2246
  :param str code: unified currency code
@@ -76,8 +76,11 @@ class yobit(Exchange, ImplicitAPI):
76
76
  'fetchOrderBook': True,
77
77
  'fetchOrderBooks': True,
78
78
  'fetchPosition': False,
79
+ 'fetchPositionHistory': False,
79
80
  'fetchPositionMode': False,
80
81
  'fetchPositions': False,
82
+ 'fetchPositionsForSymbol': False,
83
+ 'fetchPositionsHistory': False,
81
84
  'fetchPositionsRisk': False,
82
85
  'fetchPremiumIndexOHLCV': False,
83
86
  'fetchTicker': True,
@@ -1150,7 +1153,7 @@ class yobit(Exchange, ImplicitAPI):
1150
1153
  },
1151
1154
  }
1152
1155
 
1153
- async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
1156
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1154
1157
  """
1155
1158
  :see: https://yobit.net/en/api
1156
1159
  make a withdrawal
@@ -557,7 +557,7 @@ class zaif(Exchange, ImplicitAPI):
557
557
  response = await self.privatePostTradeHistory(self.extend(request, params))
558
558
  return self.parse_orders(response['return'], market, since, limit)
559
559
 
560
- async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
560
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
561
561
  """
562
562
  :see: https://zaif-api-document.readthedocs.io/ja/latest/TradingAPI.html#id41
563
563
  make a withdrawal
@@ -1649,7 +1649,7 @@ class zonda(Exchange, ImplicitAPI):
1649
1649
  }
1650
1650
  return self.safe_string(statuses, status, status)
1651
1651
 
1652
- async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
1652
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1653
1653
  """
1654
1654
  :see: https://docs.zondacrypto.exchange/reference/crypto-withdrawal-1
1655
1655
  make a withdrawal
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.3.5'
7
+ __version__ = '4.3.7'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -4494,6 +4494,9 @@ class Exchange(object):
4494
4494
  def cancel_all_orders(self, symbol: Str = None, params={}):
4495
4495
  raise NotSupported(self.id + ' cancelAllOrders() is not supported yet')
4496
4496
 
4497
+ def cancel_all_orders_after(self, timeout: Int, params={}):
4498
+ raise NotSupported(self.id + ' cancelAllOrdersAfter() is not supported yet')
4499
+
4497
4500
  def cancel_orders_for_symbols(self, orders: List[CancellationRequest], params={}):
4498
4501
  raise NotSupported(self.id + ' cancelOrdersForSymbols() is not supported yet')
4499
4502
 
@@ -5769,6 +5772,32 @@ class Exchange(object):
5769
5772
  reconstructedDate = day + month + year
5770
5773
  return reconstructedDate
5771
5774
 
5775
+ def fetch_position_history(self, symbol: str, since: Int = None, limit: Int = None, params={}):
5776
+ """
5777
+ fetches the history of margin added or reduced from contract isolated positions
5778
+ :param str [symbol]: unified market symbol
5779
+ :param int [since]: timestamp in ms of the position
5780
+ :param int [limit]: the maximum amount of candles to fetch, default=1000
5781
+ :param dict params: extra parameters specific to the exchange api endpoint
5782
+ :returns dict[]: a list of `position structures <https://docs.ccxt.com/#/?id=position-structure>`
5783
+ """
5784
+ if self.has['fetchPositionsHistory']:
5785
+ positions = self.fetch_positions_history([symbol], since, limit, params)
5786
+ return self.safe_dict(positions, 0)
5787
+ else:
5788
+ raise NotSupported(self.id + ' fetchPositionHistory() is not supported yet')
5789
+
5790
+ def fetch_positions_history(self, symbols: Strings = None, since: Int = None, limit: Int = None, params={}):
5791
+ """
5792
+ fetches the history of margin added or reduced from contract isolated positions
5793
+ :param str [symbol]: unified market symbol
5794
+ :param int [since]: timestamp in ms of the position
5795
+ :param int [limit]: the maximum amount of candles to fetch, default=1000
5796
+ :param dict params: extra parameters specific to the exchange api endpoint
5797
+ :returns dict[]: a list of `position structures <https://docs.ccxt.com/#/?id=position-structure>`
5798
+ """
5799
+ raise NotSupported(self.id + ' fetchPositionsHistory() is not supported yet')
5800
+
5772
5801
  def parse_margin_modification(self, data, market: Market = None):
5773
5802
  raise NotSupported(self.id + ' parseMarginModification() is not supported yet')
5774
5803
 
ccxt/bigone.py CHANGED
@@ -2043,7 +2043,7 @@ class bigone(Exchange, ImplicitAPI):
2043
2043
  }
2044
2044
  return self.safe_string(statuses, status, 'failed')
2045
2045
 
2046
- def withdraw(self, code: str, amount: float, address, tag=None, params={}):
2046
+ def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
2047
2047
  """
2048
2048
  make a withdrawal
2049
2049
  :see: https://open.big.one/docs/spot_withdrawal.html#create-withdrawal-of-user
ccxt/binance.py CHANGED
@@ -147,8 +147,10 @@ class binance(Exchange, ImplicitAPI):
147
147
  'fetchOrders': True,
148
148
  'fetchOrderTrades': True,
149
149
  'fetchPosition': True,
150
+ 'fetchPositionHistory': False,
150
151
  'fetchPositionMode': True,
151
152
  'fetchPositions': True,
153
+ 'fetchPositionsHistory': False,
152
154
  'fetchPositionsRisk': True,
153
155
  'fetchPremiumIndexOHLCV': False,
154
156
  'fetchSettlementHistory': True,
@@ -343,6 +345,7 @@ class binance(Exchange, ImplicitAPI):
343
345
  'capital/deposit/subAddress': 0.1,
344
346
  'capital/deposit/subHisrec': 0.1,
345
347
  'capital/withdraw/history': 1800, # Weight(IP): 18000 => cost = 0.1 * 18000 = 1800
348
+ 'capital/withdraw/address/list': 10,
346
349
  'capital/contract/convertible-coins': 4.0002, # Weight(UID): 600 => cost = 0.006667 * 600 = 4.0002
347
350
  'convert/tradeFlow': 20.001, # Weight(UID): 3000 => cost = 0.006667 * 3000 = 20.001
348
351
  'convert/exchangeInfo': 50,
@@ -3987,6 +3990,7 @@ class binance(Exchange, ImplicitAPI):
3987
3990
  :param str[] [symbols]: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
3988
3991
  :param dict [params]: extra parameters specific to the exchange API endpoint
3989
3992
  :param str [params.subType]: "linear" or "inverse"
3993
+ :param str [params.type]: 'spot', 'option', use params["subType"] for swap and future markets
3990
3994
  :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
3991
3995
  """
3992
3996
  self.load_markets()
@@ -8016,7 +8020,7 @@ class binance(Exchange, ImplicitAPI):
8016
8020
  }
8017
8021
  return result
8018
8022
 
8019
- def withdraw(self, code: str, amount: float, address, tag=None, params={}):
8023
+ def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
8020
8024
  """
8021
8025
  make a withdrawal
8022
8026
  :see: https://binance-docs.github.io/apidocs/spot/en/#withdraw-user_data
@@ -10377,7 +10381,7 @@ class binance(Exchange, ImplicitAPI):
10377
10381
  'datetime': self.iso8601(timestamp),
10378
10382
  }
10379
10383
 
10380
- def reduce_margin(self, symbol: str, amount, params={}) -> MarginModification:
10384
+ def reduce_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
10381
10385
  """
10382
10386
  :see: https://binance-docs.github.io/apidocs/delivery/en/#modify-isolated-position-margin-trade
10383
10387
  :see: https://binance-docs.github.io/apidocs/futures/en/#modify-isolated-position-margin-trade
@@ -10389,7 +10393,7 @@ class binance(Exchange, ImplicitAPI):
10389
10393
  """
10390
10394
  return self.modify_margin_helper(symbol, amount, 2, params)
10391
10395
 
10392
- def add_margin(self, symbol: str, amount, params={}) -> MarginModification:
10396
+ def add_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
10393
10397
  """
10394
10398
  :see: https://binance-docs.github.io/apidocs/delivery/en/#modify-isolated-position-margin-trade
10395
10399
  :see: https://binance-docs.github.io/apidocs/futures/en/#modify-isolated-position-margin-trade
ccxt/bingx.py CHANGED
@@ -46,6 +46,7 @@ class bingx(Exchange, ImplicitAPI):
46
46
  'option': False,
47
47
  'addMargin': True,
48
48
  'cancelAllOrders': True,
49
+ 'cancelAllOrdersAfter': True,
49
50
  'cancelOrder': True,
50
51
  'cancelOrders': True,
51
52
  'closeAllPositions': True,
@@ -85,8 +86,10 @@ class bingx(Exchange, ImplicitAPI):
85
86
  'fetchOrder': True,
86
87
  'fetchOrderBook': True,
87
88
  'fetchOrders': True,
89
+ 'fetchPositionHistory': False,
88
90
  'fetchPositionMode': True,
89
91
  'fetchPositions': True,
92
+ 'fetchPositionsHistory': False,
90
93
  'fetchTicker': True,
91
94
  'fetchTickers': True,
92
95
  'fetchTime': True,
@@ -242,6 +245,7 @@ class bingx(Exchange, ImplicitAPI):
242
245
  'trade/order': 3,
243
246
  'trade/batchOrders': 3,
244
247
  'trade/closeAllPositions': 3,
248
+ 'trade/cancelAllAfter': 3,
245
249
  'trade/marginType': 3,
246
250
  'trade/leverage': 3,
247
251
  'trade/positionMargin': 3,
@@ -2581,6 +2585,44 @@ class bingx(Exchange, ImplicitAPI):
2581
2585
  #
2582
2586
  return response
2583
2587
 
2588
+ def cancel_all_orders_after(self, timeout: Int, params={}):
2589
+ """
2590
+ dead man's switch, cancel all orders after the given timeout
2591
+ :see: https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Cancel%20all%20orders%20in%20countdown
2592
+ :see: https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Cancel%20all%20orders%20in%20countdown
2593
+ :param number timeout: time in milliseconds, 0 represents cancel the timer
2594
+ :param dict [params]: extra parameters specific to the exchange API endpoint
2595
+ :param str [params.type]: spot or swap market
2596
+ :returns dict: the api result
2597
+ """
2598
+ self.load_markets()
2599
+ isActive = (timeout > 0)
2600
+ request: dict = {
2601
+ 'type': 'ACTIVATE' if (isActive) else 'CLOSE',
2602
+ 'timeOut': (self.parse_to_int(timeout / 1000)) if (isActive) else 0,
2603
+ }
2604
+ response = None
2605
+ type = None
2606
+ type, params = self.handle_market_type_and_params('cancelAllOrdersAfter', None, params)
2607
+ if type == 'spot':
2608
+ response = self.spotV1PrivatePostTradeCancelAllAfter(self.extend(request, params))
2609
+ elif type == 'swap':
2610
+ response = self.swapV2PrivatePostTradeCancelAllAfter(self.extend(request, params))
2611
+ else:
2612
+ raise NotSupported(self.id + ' cancelAllOrdersAfter() is not supported for ' + type + ' markets')
2613
+ #
2614
+ # {
2615
+ # code: '0',
2616
+ # msg: '',
2617
+ # data: {
2618
+ # triggerTime: '1712645434',
2619
+ # status: 'ACTIVATED',
2620
+ # note: 'All your perpetual pending orders will be closed automatically at 2024-04-09 06:50:34 UTC(+0),before that you can cancel the timer, or self.extend triggerTime time by self request'
2621
+ # }
2622
+ # }
2623
+ #
2624
+ return response
2625
+
2584
2626
  def fetch_order(self, id: str, symbol: Str = None, params={}):
2585
2627
  """
2586
2628
  fetches information on an order made by the user
@@ -3642,7 +3684,7 @@ class bingx(Exchange, ImplicitAPI):
3642
3684
  coins = self.safe_list(response, 'data')
3643
3685
  return self.parse_deposit_withdraw_fees(coins, codes, 'coin')
3644
3686
 
3645
- def withdraw(self, code: str, amount: float, address, tag=None, params={}):
3687
+ def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
3646
3688
  """
3647
3689
  make a withdrawal
3648
3690
  :see: https://bingx-api.github.io/docs/#/common/account-api.html#Withdraw
ccxt/bitbank.py CHANGED
@@ -64,8 +64,11 @@ class bitbank(Exchange, ImplicitAPI):
64
64
  'fetchOrder': True,
65
65
  'fetchOrderBook': True,
66
66
  'fetchPosition': False,
67
+ 'fetchPositionHistory': False,
67
68
  'fetchPositionMode': False,
68
69
  'fetchPositions': False,
70
+ 'fetchPositionsForSymbol': False,
71
+ 'fetchPositionsHistory': False,
69
72
  'fetchPositionsRisk': False,
70
73
  'fetchPremiumIndexOHLCV': False,
71
74
  'fetchTicker': True,
@@ -763,7 +766,7 @@ class bitbank(Exchange, ImplicitAPI):
763
766
  'info': response,
764
767
  }
765
768
 
766
- def withdraw(self, code: str, amount: float, address, tag=None, params={}):
769
+ def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
767
770
  """
768
771
  make a withdrawal
769
772
  :see: https://github.com/bitbankinc/bitbank-api-docs/blob/38d6d7c6f486c793872fd4b4087a0d090a04cd0a/rest-api.md#new-withdrawal-request
ccxt/bitfinex.py CHANGED
@@ -1462,7 +1462,7 @@ class bitfinex(Exchange, ImplicitAPI):
1462
1462
  }
1463
1463
  return self.safe_string(statuses, status, status)
1464
1464
 
1465
- def withdraw(self, code: str, amount: float, address, tag=None, params={}):
1465
+ def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1466
1466
  """
1467
1467
  make a withdrawal
1468
1468
  :see: https://docs.bitfinex.com/v1/reference/rest-auth-withdrawal
ccxt/bitfinex2.py CHANGED
@@ -2424,7 +2424,7 @@ class bitfinex2(Exchange, ImplicitAPI):
2424
2424
  #
2425
2425
  return self.parse_transactions(response, currency, since, limit)
2426
2426
 
2427
- def withdraw(self, code: str, amount: float, address, tag=None, params={}):
2427
+ def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
2428
2428
  """
2429
2429
  make a withdrawal
2430
2430
  :see: https://docs.bitfinex.com/reference/rest-auth-withdraw
ccxt/bitflyer.py CHANGED
@@ -764,7 +764,7 @@ class bitflyer(Exchange, ImplicitAPI):
764
764
  # todo unify parsePosition/parsePositions
765
765
  return response
766
766
 
767
- def withdraw(self, code: str, amount: float, address, tag=None, params={}):
767
+ def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
768
768
  """
769
769
  make a withdrawal
770
770
  :see: https://lightning.bitflyer.com/docs?lang=en#withdrawing-funds
ccxt/bitget.py CHANGED
@@ -127,8 +127,10 @@ class bitget(Exchange, ImplicitAPI):
127
127
  'fetchOrders': False,
128
128
  'fetchOrderTrades': False,
129
129
  'fetchPosition': True,
130
+ 'fetchPositionHistory': 'emulated',
130
131
  'fetchPositionMode': False,
131
132
  'fetchPositions': True,
133
+ 'fetchPositionsHistory': True,
132
134
  'fetchPositionsRisk': False,
133
135
  'fetchPremiumIndexOHLCV': False,
134
136
  'fetchStatus': False,
@@ -2159,7 +2161,7 @@ class bitget(Exchange, ImplicitAPI):
2159
2161
  rawTransactions = self.safe_list(response, 'data', [])
2160
2162
  return self.parse_transactions(rawTransactions, currency, since, limit)
2161
2163
 
2162
- def withdraw(self, code: str, amount: float, address, tag=None, params={}):
2164
+ def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
2163
2165
  """
2164
2166
  make a withdrawal
2165
2167
  :see: https://www.bitget.com/api-doc/spot/account/Wallet-Withdrawal
@@ -6085,7 +6087,7 @@ class bitget(Exchange, ImplicitAPI):
6085
6087
  # "cTime": "1700807507275"
6086
6088
  # }
6087
6089
  #
6088
- # fetchPositions: privateMixGetV2MixPositionHistoryPosition
6090
+ # fetchPositionsHistory: privateMixGetV2MixPositionHistoryPosition
6089
6091
  #
6090
6092
  # {
6091
6093
  # "symbol": "BTCUSDT",
@@ -6500,7 +6502,7 @@ class bitget(Exchange, ImplicitAPI):
6500
6502
  'datetime': None,
6501
6503
  }
6502
6504
 
6503
- def reduce_margin(self, symbol: str, amount, params={}) -> MarginModification:
6505
+ def reduce_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
6504
6506
  """
6505
6507
  remove margin from a position
6506
6508
  :see: https://www.bitget.com/api-doc/contract/account/Change-Margin
@@ -6516,7 +6518,7 @@ class bitget(Exchange, ImplicitAPI):
6516
6518
  raise ArgumentsRequired(self.id + ' reduceMargin() requires a holdSide parameter, either long or short')
6517
6519
  return self.modify_margin_helper(symbol, amount, 'reduce', params)
6518
6520
 
6519
- def add_margin(self, symbol: str, amount, params={}) -> MarginModification:
6521
+ def add_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
6520
6522
  """
6521
6523
  add margin
6522
6524
  :see: https://www.bitget.com/api-doc/contract/account/Change-Margin
@@ -7857,6 +7859,70 @@ class bitget(Exchange, ImplicitAPI):
7857
7859
  'marginMode': marginType,
7858
7860
  }
7859
7861
 
7862
+ def fetch_positions_history(self, symbols: Strings = None, since: Int = None, limit: Int = None, params={}) -> List[Position]:
7863
+ """
7864
+ fetches historical positions
7865
+ :see: https://www.bitget.com/api-doc/contract/position/Get-History-Position
7866
+ :param str [symbol]: unified contract symbols
7867
+ :param int [since]: timestamp in ms of the earliest position to fetch, default=3 months ago, max range for params["until"] - since is 3 months
7868
+ :param int [limit]: the maximum amount of records to fetch, default=20, max=100
7869
+ :param dict params: extra parameters specific to the exchange api endpoint
7870
+ :param int [params.until]: timestamp in ms of the latest position to fetch, max range for params["until"] - since is 3 months
7871
+ *
7872
+ * EXCHANGE SPECIFIC PARAMETERS
7873
+ :param str [params.productType]: USDT-FUTURES(default), COIN-FUTURES, USDC-FUTURES, SUSDT-FUTURES, SCOIN-FUTURES, or SUSDC-FUTURES
7874
+ :returns dict[]: a list of `position structures <https://docs.ccxt.com/#/?id=position-structure>`
7875
+ """
7876
+ self.load_markets()
7877
+ until = self.safe_integer(params, 'until')
7878
+ params = self.omit(params, 'until')
7879
+ request = {}
7880
+ if symbols is not None:
7881
+ symbolsLength = len(symbols)
7882
+ if symbolsLength > 0:
7883
+ market = self.market(symbols[0])
7884
+ request['symbol'] = market['id']
7885
+ if since is not None:
7886
+ request['startTime'] = since
7887
+ if limit is not None:
7888
+ request['limit'] = limit
7889
+ if until is not None:
7890
+ request['endTime'] = until
7891
+ response = self.privateMixGetV2MixPositionHistoryPosition(self.extend(request, params))
7892
+ #
7893
+ # {
7894
+ # code: '00000',
7895
+ # msg: 'success',
7896
+ # requestTime: '1712794148791',
7897
+ # data: {
7898
+ # list: [
7899
+ # {
7900
+ # symbol: 'XRPUSDT',
7901
+ # marginCoin: 'USDT',
7902
+ # holdSide: 'long',
7903
+ # openAvgPrice: '0.64967',
7904
+ # closeAvgPrice: '0.58799',
7905
+ # marginMode: 'isolated',
7906
+ # openTotalPos: '10',
7907
+ # closeTotalPos: '10',
7908
+ # pnl: '-0.62976205',
7909
+ # netProfit: '-0.65356802',
7910
+ # totalFunding: '-0.01638',
7911
+ # openFee: '-0.00389802',
7912
+ # closeFee: '-0.00352794',
7913
+ # ctime: '1709590322199',
7914
+ # utime: '1709667583395'
7915
+ # },
7916
+ # ...
7917
+ # ]
7918
+ # }
7919
+ # }
7920
+ #
7921
+ data = self.safe_dict(response, 'data')
7922
+ responseList = self.safe_list(data, 'list')
7923
+ positions = self.parse_positions(responseList, symbols, params)
7924
+ return self.filter_by_since_limit(positions, since, limit)
7925
+
7860
7926
  def fetch_convert_quote(self, fromCode: str, toCode: str, amount: Num = None, params={}) -> Conversion:
7861
7927
  """
7862
7928
  fetch a quote for converting from one currency to another