ccxt 4.3.6__py2.py3-none-any.whl → 4.3.8__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 (178) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/coinbase.py +5 -0
  3. ccxt/ace.py +5 -0
  4. ccxt/alpaca.py +6 -0
  5. ccxt/ascendex.py +2 -2
  6. ccxt/async_support/__init__.py +1 -1
  7. ccxt/async_support/ace.py +5 -0
  8. ccxt/async_support/alpaca.py +6 -0
  9. ccxt/async_support/ascendex.py +2 -2
  10. ccxt/async_support/base/exchange.py +27 -1
  11. ccxt/async_support/bigone.py +1 -1
  12. ccxt/async_support/binance.py +6 -4
  13. ccxt/async_support/bingx.py +4 -2
  14. ccxt/async_support/bitbank.py +4 -1
  15. ccxt/async_support/bitfinex.py +1 -1
  16. ccxt/async_support/bitfinex2.py +1 -1
  17. ccxt/async_support/bitflyer.py +1 -1
  18. ccxt/async_support/bitget.py +71 -5
  19. ccxt/async_support/bithumb.py +5 -1
  20. ccxt/async_support/bitmart.py +1 -1
  21. ccxt/async_support/bitmex.py +3 -1
  22. ccxt/async_support/bitopro.py +6 -1
  23. ccxt/async_support/bitrue.py +1 -1
  24. ccxt/async_support/bitso.py +4 -1
  25. ccxt/async_support/bitstamp.py +4 -1
  26. ccxt/async_support/bitteam.py +4 -0
  27. ccxt/async_support/bitvavo.py +4 -1
  28. ccxt/async_support/bl3p.py +3 -0
  29. ccxt/async_support/blockchaincom.py +1 -1
  30. ccxt/async_support/btcalpha.py +3 -0
  31. ccxt/async_support/btcbox.py +3 -0
  32. ccxt/async_support/btcmarkets.py +4 -1
  33. ccxt/async_support/btcturk.py +3 -0
  34. ccxt/async_support/bybit.py +116 -14
  35. ccxt/async_support/cex.py +6 -0
  36. ccxt/async_support/coinbase.py +94 -18
  37. ccxt/async_support/coinbaseinternational.py +3 -1
  38. ccxt/async_support/coinbasepro.py +7 -1
  39. ccxt/async_support/coincheck.py +3 -0
  40. ccxt/async_support/coinex.py +255 -192
  41. ccxt/async_support/coinlist.py +5 -1
  42. ccxt/async_support/coinmate.py +4 -1
  43. ccxt/async_support/coinone.py +3 -0
  44. ccxt/async_support/coinsph.py +5 -1
  45. ccxt/async_support/coinspot.py +3 -0
  46. ccxt/async_support/cryptocom.py +3 -1
  47. ccxt/async_support/delta.py +2 -2
  48. ccxt/async_support/deribit.py +1 -1
  49. ccxt/async_support/digifinex.py +3 -3
  50. ccxt/async_support/exmo.py +8 -3
  51. ccxt/async_support/gate.py +112 -24
  52. ccxt/async_support/gemini.py +1 -1
  53. ccxt/async_support/hitbtc.py +7 -6
  54. ccxt/async_support/hollaex.py +1 -1
  55. ccxt/async_support/htx.py +3 -1
  56. ccxt/async_support/huobijp.py +1 -1
  57. ccxt/async_support/hyperliquid.py +2 -2
  58. ccxt/async_support/idex.py +4 -1
  59. ccxt/async_support/independentreserve.py +3 -0
  60. ccxt/async_support/indodax.py +4 -1
  61. ccxt/async_support/kraken.py +1 -1
  62. ccxt/async_support/kucoin.py +3 -1
  63. ccxt/async_support/kucoinfutures.py +3 -1
  64. ccxt/async_support/kuna.py +1 -1
  65. ccxt/async_support/latoken.py +6 -0
  66. ccxt/async_support/lbank.py +1 -1
  67. ccxt/async_support/luno.py +3 -0
  68. ccxt/async_support/lykke.py +6 -1
  69. ccxt/async_support/mercado.py +4 -1
  70. ccxt/async_support/mexc.py +110 -4
  71. ccxt/async_support/ndax.py +5 -1
  72. ccxt/async_support/novadax.py +5 -1
  73. ccxt/async_support/okcoin.py +1 -1
  74. ccxt/async_support/okx.py +81 -5
  75. ccxt/async_support/onetrading.py +4 -1
  76. ccxt/async_support/p2b.py +3 -0
  77. ccxt/async_support/phemex.py +1 -1
  78. ccxt/async_support/poloniex.py +1 -1
  79. ccxt/async_support/probit.py +4 -1
  80. ccxt/async_support/timex.py +3 -0
  81. ccxt/async_support/tokocrypto.py +1 -1
  82. ccxt/async_support/tradeogre.py +3 -0
  83. ccxt/async_support/upbit.py +1 -1
  84. ccxt/async_support/wavesexchange.py +4 -1
  85. ccxt/async_support/wazirx.py +3 -0
  86. ccxt/async_support/whitebit.py +1 -1
  87. ccxt/async_support/woo.py +4 -2
  88. ccxt/async_support/yobit.py +4 -1
  89. ccxt/async_support/zaif.py +1 -1
  90. ccxt/async_support/zonda.py +1 -1
  91. ccxt/base/exchange.py +38 -4
  92. ccxt/bigone.py +1 -1
  93. ccxt/binance.py +6 -4
  94. ccxt/bingx.py +4 -2
  95. ccxt/bitbank.py +4 -1
  96. ccxt/bitfinex.py +1 -1
  97. ccxt/bitfinex2.py +1 -1
  98. ccxt/bitflyer.py +1 -1
  99. ccxt/bitget.py +71 -5
  100. ccxt/bithumb.py +5 -1
  101. ccxt/bitmart.py +1 -1
  102. ccxt/bitmex.py +3 -1
  103. ccxt/bitopro.py +6 -1
  104. ccxt/bitrue.py +1 -1
  105. ccxt/bitso.py +4 -1
  106. ccxt/bitstamp.py +4 -1
  107. ccxt/bitteam.py +4 -0
  108. ccxt/bitvavo.py +4 -1
  109. ccxt/bl3p.py +3 -0
  110. ccxt/blockchaincom.py +1 -1
  111. ccxt/btcalpha.py +3 -0
  112. ccxt/btcbox.py +3 -0
  113. ccxt/btcmarkets.py +4 -1
  114. ccxt/btcturk.py +3 -0
  115. ccxt/bybit.py +116 -14
  116. ccxt/cex.py +6 -0
  117. ccxt/coinbase.py +94 -18
  118. ccxt/coinbaseinternational.py +3 -1
  119. ccxt/coinbasepro.py +7 -1
  120. ccxt/coincheck.py +3 -0
  121. ccxt/coinex.py +255 -192
  122. ccxt/coinlist.py +5 -1
  123. ccxt/coinmate.py +4 -1
  124. ccxt/coinone.py +3 -0
  125. ccxt/coinsph.py +5 -1
  126. ccxt/coinspot.py +3 -0
  127. ccxt/cryptocom.py +3 -1
  128. ccxt/delta.py +2 -2
  129. ccxt/deribit.py +1 -1
  130. ccxt/digifinex.py +3 -3
  131. ccxt/exmo.py +8 -3
  132. ccxt/gate.py +112 -24
  133. ccxt/gemini.py +1 -1
  134. ccxt/hitbtc.py +7 -6
  135. ccxt/hollaex.py +1 -1
  136. ccxt/htx.py +3 -1
  137. ccxt/huobijp.py +1 -1
  138. ccxt/hyperliquid.py +2 -2
  139. ccxt/idex.py +4 -1
  140. ccxt/independentreserve.py +3 -0
  141. ccxt/indodax.py +4 -1
  142. ccxt/kraken.py +1 -1
  143. ccxt/kucoin.py +3 -1
  144. ccxt/kucoinfutures.py +3 -1
  145. ccxt/kuna.py +1 -1
  146. ccxt/latoken.py +6 -0
  147. ccxt/lbank.py +1 -1
  148. ccxt/luno.py +3 -0
  149. ccxt/lykke.py +6 -1
  150. ccxt/mercado.py +4 -1
  151. ccxt/mexc.py +110 -4
  152. ccxt/ndax.py +5 -1
  153. ccxt/novadax.py +5 -1
  154. ccxt/okcoin.py +1 -1
  155. ccxt/okx.py +81 -5
  156. ccxt/onetrading.py +4 -1
  157. ccxt/p2b.py +3 -0
  158. ccxt/phemex.py +1 -1
  159. ccxt/poloniex.py +1 -1
  160. ccxt/pro/__init__.py +1 -1
  161. ccxt/pro/bybit.py +1 -1
  162. ccxt/pro/coinbase.py +28 -28
  163. ccxt/probit.py +4 -1
  164. ccxt/timex.py +3 -0
  165. ccxt/tokocrypto.py +1 -1
  166. ccxt/tradeogre.py +3 -0
  167. ccxt/upbit.py +1 -1
  168. ccxt/wavesexchange.py +4 -1
  169. ccxt/wazirx.py +3 -0
  170. ccxt/whitebit.py +1 -1
  171. ccxt/woo.py +4 -2
  172. ccxt/yobit.py +4 -1
  173. ccxt/zaif.py +1 -1
  174. ccxt/zonda.py +1 -1
  175. {ccxt-4.3.6.dist-info → ccxt-4.3.8.dist-info}/METADATA +4 -4
  176. {ccxt-4.3.6.dist-info → ccxt-4.3.8.dist-info}/RECORD +178 -178
  177. {ccxt-4.3.6.dist-info → ccxt-4.3.8.dist-info}/WHEEL +0 -0
  178. {ccxt-4.3.6.dist-info → ccxt-4.3.8.dist-info}/top_level.txt +0 -0
ccxt/__init__.py CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  # ----------------------------------------------------------------------------
24
24
 
25
- __version__ = '4.3.6'
25
+ __version__ = '4.3.8'
26
26
 
27
27
  # ----------------------------------------------------------------------------
28
28
 
ccxt/abstract/coinbase.py CHANGED
@@ -48,6 +48,11 @@ class ImplicitAPI:
48
48
  v2_private_delete_accounts_id = v2PrivateDeleteAccountsId = Entry('accounts/{id}', ['v2', 'private'], 'DELETE', {'cost': 10.6})
49
49
  v2_private_delete_accounts_account_id_transactions_transaction_id = v2PrivateDeleteAccountsAccountIdTransactionsTransactionId = Entry('accounts/{account_id}/transactions/{transaction_id}', ['v2', 'private'], 'DELETE', {'cost': 10.6})
50
50
  v3_public_get_brokerage_time = v3PublicGetBrokerageTime = Entry('brokerage/time', ['v3', 'public'], 'GET', {'cost': 3})
51
+ v3_public_get_brokerage_market_product_book = v3PublicGetBrokerageMarketProductBook = Entry('brokerage/market/product_book', ['v3', 'public'], 'GET', {'cost': 3})
52
+ v3_public_get_brokerage_market_products = v3PublicGetBrokerageMarketProducts = Entry('brokerage/market/products', ['v3', 'public'], 'GET', {'cost': 3})
53
+ v3_public_get_brokerage_market_products_product_id = v3PublicGetBrokerageMarketProductsProductId = Entry('brokerage/market/products/{product_id}', ['v3', 'public'], 'GET', {'cost': 3})
54
+ v3_public_get_brokerage_market_products_product_id_candles = v3PublicGetBrokerageMarketProductsProductIdCandles = Entry('brokerage/market/products/{product_id}/candles', ['v3', 'public'], 'GET', {'cost': 3})
55
+ v3_public_get_brokerage_market_products_product_id_ticker = v3PublicGetBrokerageMarketProductsProductIdTicker = Entry('brokerage/market/products/{product_id}/ticker', ['v3', 'public'], 'GET', {'cost': 3})
51
56
  v3_private_get_brokerage_accounts = v3PrivateGetBrokerageAccounts = Entry('brokerage/accounts', ['v3', 'private'], 'GET', {'cost': 1})
52
57
  v3_private_get_brokerage_accounts_account_uuid = v3PrivateGetBrokerageAccountsAccountUuid = Entry('brokerage/accounts/{account_uuid}', ['v3', 'private'], 'GET', {'cost': 1})
53
58
  v3_private_get_brokerage_orders_historical_batch = v3PrivateGetBrokerageOrdersHistoricalBatch = Entry('brokerage/orders/historical/batch', ['v3', 'private'], 'GET', {'cost': 1})
ccxt/ace.py CHANGED
@@ -67,8 +67,13 @@ class ace(Exchange, ImplicitAPI):
67
67
  'fetchOrderBook': True,
68
68
  'fetchOrders': False,
69
69
  'fetchOrderTrades': True,
70
+ 'fetchPosition': False,
71
+ 'fetchPositionHistory': False,
70
72
  'fetchPositionMode': False,
71
73
  'fetchPositions': False,
74
+ 'fetchPositionsForSymbol': False,
75
+ 'fetchPositionsHistory': False,
76
+ 'fetchPositionsRisk': False,
72
77
  'fetchPremiumIndexOHLCV': False,
73
78
  'fetchTicker': True,
74
79
  'fetchTickers': True,
ccxt/alpaca.py CHANGED
@@ -80,7 +80,13 @@ class alpaca(Exchange, ImplicitAPI):
80
80
  'fetchOrder': True,
81
81
  'fetchOrderBook': True,
82
82
  'fetchOrders': True,
83
+ 'fetchPosition': False,
84
+ 'fetchPositionHistory': False,
85
+ 'fetchPositionMode': False,
83
86
  'fetchPositions': False,
87
+ 'fetchPositionsForSymbol': False,
88
+ 'fetchPositionsHistory': False,
89
+ 'fetchPositionsRisk': False,
84
90
  'fetchStatus': False,
85
91
  'fetchTicker': False,
86
92
  'fetchTickers': False,
ccxt/ascendex.py CHANGED
@@ -2754,7 +2754,7 @@ class ascendex(Exchange, ImplicitAPI):
2754
2754
  'datetime': None,
2755
2755
  }
2756
2756
 
2757
- def reduce_margin(self, symbol: str, amount, params={}) -> MarginModification:
2757
+ def reduce_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
2758
2758
  """
2759
2759
  remove margin from a position
2760
2760
  :param str symbol: unified market symbol
@@ -2764,7 +2764,7 @@ class ascendex(Exchange, ImplicitAPI):
2764
2764
  """
2765
2765
  return self.modify_margin_helper(symbol, -amount, 'reduce', params)
2766
2766
 
2767
- def add_margin(self, symbol: str, amount, params={}) -> MarginModification:
2767
+ def add_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
2768
2768
  """
2769
2769
  add margin
2770
2770
  :param str symbol: unified market symbol
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.3.6'
7
+ __version__ = '4.3.8'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
ccxt/async_support/ace.py CHANGED
@@ -67,8 +67,13 @@ class ace(Exchange, ImplicitAPI):
67
67
  'fetchOrderBook': True,
68
68
  'fetchOrders': False,
69
69
  'fetchOrderTrades': True,
70
+ 'fetchPosition': False,
71
+ 'fetchPositionHistory': False,
70
72
  'fetchPositionMode': False,
71
73
  'fetchPositions': False,
74
+ 'fetchPositionsForSymbol': False,
75
+ 'fetchPositionsHistory': False,
76
+ 'fetchPositionsRisk': False,
72
77
  'fetchPremiumIndexOHLCV': False,
73
78
  'fetchTicker': True,
74
79
  'fetchTickers': True,
@@ -80,7 +80,13 @@ class alpaca(Exchange, ImplicitAPI):
80
80
  'fetchOrder': True,
81
81
  'fetchOrderBook': True,
82
82
  'fetchOrders': True,
83
+ 'fetchPosition': False,
84
+ 'fetchPositionHistory': False,
85
+ 'fetchPositionMode': False,
83
86
  'fetchPositions': False,
87
+ 'fetchPositionsForSymbol': False,
88
+ 'fetchPositionsHistory': False,
89
+ 'fetchPositionsRisk': False,
84
90
  'fetchStatus': False,
85
91
  'fetchTicker': False,
86
92
  'fetchTickers': False,
@@ -2754,7 +2754,7 @@ class ascendex(Exchange, ImplicitAPI):
2754
2754
  'datetime': None,
2755
2755
  }
2756
2756
 
2757
- async def reduce_margin(self, symbol: str, amount, params={}) -> MarginModification:
2757
+ async def reduce_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
2758
2758
  """
2759
2759
  remove margin from a position
2760
2760
  :param str symbol: unified market symbol
@@ -2764,7 +2764,7 @@ class ascendex(Exchange, ImplicitAPI):
2764
2764
  """
2765
2765
  return await self.modify_margin_helper(symbol, -amount, 'reduce', params)
2766
2766
 
2767
- async def add_margin(self, symbol: str, amount, params={}) -> MarginModification:
2767
+ async def add_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
2768
2768
  """
2769
2769
  add margin
2770
2770
  :param str symbol: unified market symbol
@@ -2,7 +2,7 @@
2
2
 
3
3
  # -----------------------------------------------------------------------------
4
4
 
5
- __version__ = '4.3.6'
5
+ __version__ = '4.3.8'
6
6
 
7
7
  # -----------------------------------------------------------------------------
8
8
 
@@ -1893,3 +1893,29 @@ class Exchange(BaseExchange):
1893
1893
  sorted = self.sortCursorPaginatedResult(result)
1894
1894
  key = 0 if (method == 'fetchOHLCV') else 'timestamp'
1895
1895
  return self.filter_by_since_limit(sorted, since, limit, key)
1896
+
1897
+ async def fetch_position_history(self, symbol: str, since: Int = None, limit: Int = None, params={}):
1898
+ """
1899
+ fetches the history of margin added or reduced from contract isolated positions
1900
+ :param str [symbol]: unified market symbol
1901
+ :param int [since]: timestamp in ms of the position
1902
+ :param int [limit]: the maximum amount of candles to fetch, default=1000
1903
+ :param dict params: extra parameters specific to the exchange api endpoint
1904
+ :returns dict[]: a list of `position structures <https://docs.ccxt.com/#/?id=position-structure>`
1905
+ """
1906
+ if self.has['fetchPositionsHistory']:
1907
+ positions = await self.fetch_positions_history([symbol], since, limit, params)
1908
+ return self.safe_dict(positions, 0)
1909
+ else:
1910
+ raise NotSupported(self.id + ' fetchPositionHistory() is not supported yet')
1911
+
1912
+ async def fetch_positions_history(self, symbols: Strings = None, since: Int = None, limit: Int = None, params={}):
1913
+ """
1914
+ fetches the history of margin added or reduced from contract isolated positions
1915
+ :param str [symbol]: unified market symbol
1916
+ :param int [since]: timestamp in ms of the position
1917
+ :param int [limit]: the maximum amount of candles to fetch, default=1000
1918
+ :param dict params: extra parameters specific to the exchange api endpoint
1919
+ :returns dict[]: a list of `position structures <https://docs.ccxt.com/#/?id=position-structure>`
1920
+ """
1921
+ raise NotSupported(self.id + ' fetchPositionsHistory() is not supported yet')
@@ -2044,7 +2044,7 @@ class bigone(Exchange, ImplicitAPI):
2044
2044
  }
2045
2045
  return self.safe_string(statuses, status, 'failed')
2046
2046
 
2047
- async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
2047
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
2048
2048
  """
2049
2049
  make a withdrawal
2050
2050
  :see: https://open.big.one/docs/spot_withdrawal.html#create-withdrawal-of-user
@@ -148,8 +148,10 @@ class binance(Exchange, ImplicitAPI):
148
148
  'fetchOrders': True,
149
149
  'fetchOrderTrades': True,
150
150
  'fetchPosition': True,
151
+ 'fetchPositionHistory': False,
151
152
  'fetchPositionMode': True,
152
153
  'fetchPositions': True,
154
+ 'fetchPositionsHistory': False,
153
155
  'fetchPositionsRisk': True,
154
156
  'fetchPremiumIndexOHLCV': False,
155
157
  'fetchSettlementHistory': True,
@@ -8019,7 +8021,7 @@ class binance(Exchange, ImplicitAPI):
8019
8021
  }
8020
8022
  return result
8021
8023
 
8022
- async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
8024
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
8023
8025
  """
8024
8026
  make a withdrawal
8025
8027
  :see: https://binance-docs.github.io/apidocs/spot/en/#withdraw-user_data
@@ -10380,7 +10382,7 @@ class binance(Exchange, ImplicitAPI):
10380
10382
  'datetime': self.iso8601(timestamp),
10381
10383
  }
10382
10384
 
10383
- async def reduce_margin(self, symbol: str, amount, params={}) -> MarginModification:
10385
+ async def reduce_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
10384
10386
  """
10385
10387
  :see: https://binance-docs.github.io/apidocs/delivery/en/#modify-isolated-position-margin-trade
10386
10388
  :see: https://binance-docs.github.io/apidocs/futures/en/#modify-isolated-position-margin-trade
@@ -10392,7 +10394,7 @@ class binance(Exchange, ImplicitAPI):
10392
10394
  """
10393
10395
  return await self.modify_margin_helper(symbol, amount, 2, params)
10394
10396
 
10395
- async def add_margin(self, symbol: str, amount, params={}) -> MarginModification:
10397
+ async def add_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
10396
10398
  """
10397
10399
  :see: https://binance-docs.github.io/apidocs/delivery/en/#modify-isolated-position-margin-trade
10398
10400
  :see: https://binance-docs.github.io/apidocs/futures/en/#modify-isolated-position-margin-trade
@@ -11882,7 +11884,7 @@ class binance(Exchange, ImplicitAPI):
11882
11884
  # }
11883
11885
  #
11884
11886
  rows = self.safe_list(response, responseQuery, [])
11885
- return self.parse_conversions(rows, fromCurrencyKey, toCurrencyKey, since, limit)
11887
+ return self.parse_conversions(rows, code, fromCurrencyKey, toCurrencyKey, since, limit)
11886
11888
 
11887
11889
  def parse_conversion(self, conversion, fromCurrency: Currency = None, toCurrency: Currency = None) -> Conversion:
11888
11890
  #
@@ -87,8 +87,10 @@ class bingx(Exchange, ImplicitAPI):
87
87
  'fetchOrder': True,
88
88
  'fetchOrderBook': True,
89
89
  'fetchOrders': True,
90
+ 'fetchPositionHistory': False,
90
91
  'fetchPositionMode': True,
91
92
  'fetchPositions': True,
93
+ 'fetchPositionsHistory': False,
92
94
  'fetchTicker': True,
93
95
  'fetchTickers': True,
94
96
  'fetchTime': True,
@@ -2316,7 +2318,7 @@ class bingx(Exchange, ImplicitAPI):
2316
2318
  return self.safe_order({
2317
2319
  'info': info,
2318
2320
  'id': self.safe_string_2(order, 'orderId', 'i'),
2319
- 'clientOrderId': self.safe_string_n(order, ['clientOrderID', 'origClientOrderId', 'c']),
2321
+ 'clientOrderId': self.safe_string_n(order, ['clientOrderID', 'clientOrderId', 'origClientOrderId', 'c']),
2320
2322
  'symbol': self.safe_symbol(marketId, market, '-', marketType),
2321
2323
  'timestamp': timestamp,
2322
2324
  'datetime': self.iso8601(timestamp),
@@ -3683,7 +3685,7 @@ class bingx(Exchange, ImplicitAPI):
3683
3685
  coins = self.safe_list(response, 'data')
3684
3686
  return self.parse_deposit_withdraw_fees(coins, codes, 'coin')
3685
3687
 
3686
- async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
3688
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
3687
3689
  """
3688
3690
  make a withdrawal
3689
3691
  :see: https://bingx-api.github.io/docs/#/common/account-api.html#Withdraw
@@ -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
- async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
769
+ async 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
@@ -1462,7 +1462,7 @@ class bitfinex(Exchange, ImplicitAPI):
1462
1462
  }
1463
1463
  return self.safe_string(statuses, status, status)
1464
1464
 
1465
- async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
1465
+ async 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
@@ -2424,7 +2424,7 @@ class bitfinex2(Exchange, ImplicitAPI):
2424
2424
  #
2425
2425
  return self.parse_transactions(response, currency, since, limit)
2426
2426
 
2427
- async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
2427
+ async 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
@@ -764,7 +764,7 @@ class bitflyer(Exchange, ImplicitAPI):
764
764
  # todo unify parsePosition/parsePositions
765
765
  return response
766
766
 
767
- async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
767
+ async 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
@@ -128,8 +128,10 @@ class bitget(Exchange, ImplicitAPI):
128
128
  'fetchOrders': False,
129
129
  'fetchOrderTrades': False,
130
130
  'fetchPosition': True,
131
+ 'fetchPositionHistory': 'emulated',
131
132
  'fetchPositionMode': False,
132
133
  'fetchPositions': True,
134
+ 'fetchPositionsHistory': True,
133
135
  'fetchPositionsRisk': False,
134
136
  'fetchPremiumIndexOHLCV': False,
135
137
  'fetchStatus': False,
@@ -2160,7 +2162,7 @@ class bitget(Exchange, ImplicitAPI):
2160
2162
  rawTransactions = self.safe_list(response, 'data', [])
2161
2163
  return self.parse_transactions(rawTransactions, currency, since, limit)
2162
2164
 
2163
- async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
2165
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
2164
2166
  """
2165
2167
  make a withdrawal
2166
2168
  :see: https://www.bitget.com/api-doc/spot/account/Wallet-Withdrawal
@@ -6086,7 +6088,7 @@ class bitget(Exchange, ImplicitAPI):
6086
6088
  # "cTime": "1700807507275"
6087
6089
  # }
6088
6090
  #
6089
- # fetchPositions: privateMixGetV2MixPositionHistoryPosition
6091
+ # fetchPositionsHistory: privateMixGetV2MixPositionHistoryPosition
6090
6092
  #
6091
6093
  # {
6092
6094
  # "symbol": "BTCUSDT",
@@ -6501,7 +6503,7 @@ class bitget(Exchange, ImplicitAPI):
6501
6503
  'datetime': None,
6502
6504
  }
6503
6505
 
6504
- async def reduce_margin(self, symbol: str, amount, params={}) -> MarginModification:
6506
+ async def reduce_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
6505
6507
  """
6506
6508
  remove margin from a position
6507
6509
  :see: https://www.bitget.com/api-doc/contract/account/Change-Margin
@@ -6517,7 +6519,7 @@ class bitget(Exchange, ImplicitAPI):
6517
6519
  raise ArgumentsRequired(self.id + ' reduceMargin() requires a holdSide parameter, either long or short')
6518
6520
  return await self.modify_margin_helper(symbol, amount, 'reduce', params)
6519
6521
 
6520
- async def add_margin(self, symbol: str, amount, params={}) -> MarginModification:
6522
+ async def add_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
6521
6523
  """
6522
6524
  add margin
6523
6525
  :see: https://www.bitget.com/api-doc/contract/account/Change-Margin
@@ -7858,6 +7860,70 @@ class bitget(Exchange, ImplicitAPI):
7858
7860
  'marginMode': marginType,
7859
7861
  }
7860
7862
 
7863
+ async def fetch_positions_history(self, symbols: Strings = None, since: Int = None, limit: Int = None, params={}) -> List[Position]:
7864
+ """
7865
+ fetches historical positions
7866
+ :see: https://www.bitget.com/api-doc/contract/position/Get-History-Position
7867
+ :param str [symbol]: unified contract symbols
7868
+ :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
7869
+ :param int [limit]: the maximum amount of records to fetch, default=20, max=100
7870
+ :param dict params: extra parameters specific to the exchange api endpoint
7871
+ :param int [params.until]: timestamp in ms of the latest position to fetch, max range for params["until"] - since is 3 months
7872
+ *
7873
+ * EXCHANGE SPECIFIC PARAMETERS
7874
+ :param str [params.productType]: USDT-FUTURES(default), COIN-FUTURES, USDC-FUTURES, SUSDT-FUTURES, SCOIN-FUTURES, or SUSDC-FUTURES
7875
+ :returns dict[]: a list of `position structures <https://docs.ccxt.com/#/?id=position-structure>`
7876
+ """
7877
+ await self.load_markets()
7878
+ until = self.safe_integer(params, 'until')
7879
+ params = self.omit(params, 'until')
7880
+ request = {}
7881
+ if symbols is not None:
7882
+ symbolsLength = len(symbols)
7883
+ if symbolsLength > 0:
7884
+ market = self.market(symbols[0])
7885
+ request['symbol'] = market['id']
7886
+ if since is not None:
7887
+ request['startTime'] = since
7888
+ if limit is not None:
7889
+ request['limit'] = limit
7890
+ if until is not None:
7891
+ request['endTime'] = until
7892
+ response = await self.privateMixGetV2MixPositionHistoryPosition(self.extend(request, params))
7893
+ #
7894
+ # {
7895
+ # code: '00000',
7896
+ # msg: 'success',
7897
+ # requestTime: '1712794148791',
7898
+ # data: {
7899
+ # list: [
7900
+ # {
7901
+ # symbol: 'XRPUSDT',
7902
+ # marginCoin: 'USDT',
7903
+ # holdSide: 'long',
7904
+ # openAvgPrice: '0.64967',
7905
+ # closeAvgPrice: '0.58799',
7906
+ # marginMode: 'isolated',
7907
+ # openTotalPos: '10',
7908
+ # closeTotalPos: '10',
7909
+ # pnl: '-0.62976205',
7910
+ # netProfit: '-0.65356802',
7911
+ # totalFunding: '-0.01638',
7912
+ # openFee: '-0.00389802',
7913
+ # closeFee: '-0.00352794',
7914
+ # ctime: '1709590322199',
7915
+ # utime: '1709667583395'
7916
+ # },
7917
+ # ...
7918
+ # ]
7919
+ # }
7920
+ # }
7921
+ #
7922
+ data = self.safe_dict(response, 'data')
7923
+ responseList = self.safe_list(data, 'list')
7924
+ positions = self.parse_positions(responseList, symbols, params)
7925
+ return self.filter_by_since_limit(positions, since, limit)
7926
+
7861
7927
  async def fetch_convert_quote(self, fromCode: str, toCode: str, amount: Num = None, params={}) -> Conversion:
7862
7928
  """
7863
7929
  fetch a quote for converting from one currency to another
@@ -7997,7 +8063,7 @@ class bitget(Exchange, ImplicitAPI):
7997
8063
  #
7998
8064
  data = self.safe_dict(response, 'data', {})
7999
8065
  dataList = self.safe_list(data, 'dataList', [])
8000
- return self.parse_conversions(dataList, 'fromCoin', 'toCoin', since, limit)
8066
+ return self.parse_conversions(dataList, code, 'fromCoin', 'toCoin', since, limit)
8001
8067
 
8002
8068
  def parse_conversion(self, conversion, fromCurrency: Currency = None, toCurrency: Currency = None) -> Conversion:
8003
8069
  #
@@ -66,7 +66,11 @@ class bithumb(Exchange, ImplicitAPI):
66
66
  'fetchOrder': True,
67
67
  'fetchOrderBook': True,
68
68
  'fetchPosition': False,
69
+ 'fetchPositionHistory': False,
70
+ 'fetchPositionMode': False,
69
71
  'fetchPositions': False,
72
+ 'fetchPositionsForSymbol': False,
73
+ 'fetchPositionsHistory': False,
70
74
  'fetchPositionsRisk': False,
71
75
  'fetchPremiumIndexOHLCV': False,
72
76
  'fetchTicker': True,
@@ -928,7 +932,7 @@ class bithumb(Exchange, ImplicitAPI):
928
932
  }
929
933
  return await self.cancel_order(order['id'], order['symbol'], self.extend(request, params))
930
934
 
931
- async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
935
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
932
936
  """
933
937
  make a withdrawal
934
938
  :see: https://apidocs.bithumb.com/reference/%EC%BD%94%EC%9D%B8-%EC%B6%9C%EA%B8%88%ED%95%98%EA%B8%B0-%EA%B0%9C%EC%9D%B8
@@ -2961,7 +2961,7 @@ class bitmart(Exchange, ImplicitAPI):
2961
2961
  return code
2962
2962
  return self.network_id_to_code(networkId)
2963
2963
 
2964
- async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
2964
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
2965
2965
  """
2966
2966
  make a withdrawal
2967
2967
  :param str code: unified currency code
@@ -88,7 +88,9 @@ class bitmex(Exchange, ImplicitAPI):
88
88
  'fetchOrderBook': True,
89
89
  'fetchOrders': True,
90
90
  'fetchPosition': False,
91
+ 'fetchPositionHistory': False,
91
92
  'fetchPositions': True,
93
+ 'fetchPositionsHistory': False,
92
94
  'fetchPositionsRisk': False,
93
95
  'fetchPremiumIndexOHLCV': False,
94
96
  'fetchTicker': True,
@@ -2277,7 +2279,7 @@ class bitmex(Exchange, ImplicitAPI):
2277
2279
  'takeProfitPrice': None,
2278
2280
  })
2279
2281
 
2280
- async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
2282
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
2281
2283
  """
2282
2284
  make a withdrawal
2283
2285
  :see: https://www.bitmex.com/api/explorer/#not /User/User_requestWithdrawal
@@ -73,8 +73,13 @@ class bitopro(Exchange, ImplicitAPI):
73
73
  'fetchOrderBook': True,
74
74
  'fetchOrders': False,
75
75
  'fetchOrderTrades': False,
76
+ 'fetchPosition': False,
77
+ 'fetchPositionHistory': False,
76
78
  'fetchPositionMode': False,
77
79
  'fetchPositions': False,
80
+ 'fetchPositionsForSymbol': False,
81
+ 'fetchPositionsHistory': False,
82
+ 'fetchPositionsRisk': False,
78
83
  'fetchPremiumIndexOHLCV': False,
79
84
  'fetchTicker': True,
80
85
  'fetchTickers': True,
@@ -1479,7 +1484,7 @@ class bitopro(Exchange, ImplicitAPI):
1479
1484
  #
1480
1485
  return self.parse_transaction(result, currency)
1481
1486
 
1482
- async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
1487
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1483
1488
  """
1484
1489
  make a withdrawal
1485
1490
  :see: https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/private/create_an_withdraw_invoice.md
@@ -2592,7 +2592,7 @@ class bitrue(Exchange, ImplicitAPI):
2592
2592
  'fee': fee,
2593
2593
  }
2594
2594
 
2595
- async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
2595
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
2596
2596
  """
2597
2597
  make a withdrawal
2598
2598
  :see: https://github.com/Bitrue-exchange/Spot-official-api-docs#withdraw-commit--withdraw_data
@@ -77,8 +77,11 @@ class bitso(Exchange, ImplicitAPI):
77
77
  'fetchOrderBook': True,
78
78
  'fetchOrderTrades': True,
79
79
  'fetchPosition': False,
80
+ 'fetchPositionHistory': False,
80
81
  'fetchPositionMode': False,
81
82
  'fetchPositions': False,
83
+ 'fetchPositionsForSymbol': False,
84
+ 'fetchPositionsHistory': False,
82
85
  'fetchPositionsRisk': False,
83
86
  'fetchPremiumIndexOHLCV': False,
84
87
  'fetchTicker': True,
@@ -1473,7 +1476,7 @@ class bitso(Exchange, ImplicitAPI):
1473
1476
  result[code]['info'][code] = withdrawFee
1474
1477
  return result
1475
1478
 
1476
- async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
1479
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1477
1480
  """
1478
1481
  make a withdrawal
1479
1482
  :param str code: unified currency code
@@ -82,8 +82,11 @@ class bitstamp(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,
@@ -1963,7 +1966,7 @@ class bitstamp(Exchange, ImplicitAPI):
1963
1966
  'info': response,
1964
1967
  }
1965
1968
 
1966
- async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
1969
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1967
1970
  """
1968
1971
  make a withdrawal
1969
1972
  :see: https://www.bitstamp.net/api/#tag/Withdrawals/operation/RequestFiatWithdrawal
@@ -96,7 +96,11 @@ class bitteam(Exchange, ImplicitAPI):
96
96
  'fetchOrders': True,
97
97
  'fetchOrderTrades': False,
98
98
  'fetchPosition': False,
99
+ 'fetchPositionHistory': False,
100
+ 'fetchPositionMode': False,
99
101
  'fetchPositions': False,
102
+ 'fetchPositionsForSymbol': False,
103
+ 'fetchPositionsHistory': False,
100
104
  'fetchPositionsRisk': False,
101
105
  'fetchPremiumIndexOHLCV': False,
102
106
  'fetchStatus': False,
@@ -88,8 +88,11 @@ class bitvavo(Exchange, ImplicitAPI):
88
88
  'fetchOrderBook': True,
89
89
  'fetchOrders': True,
90
90
  'fetchPosition': False,
91
+ 'fetchPositionHistory': False,
91
92
  'fetchPositionMode': False,
92
93
  'fetchPositions': False,
94
+ 'fetchPositionsForSymbol': False,
95
+ 'fetchPositionsHistory': False,
93
96
  'fetchPositionsRisk': False,
94
97
  'fetchPremiumIndexOHLCV': False,
95
98
  'fetchTicker': True,
@@ -1627,7 +1630,7 @@ class bitvavo(Exchange, ImplicitAPI):
1627
1630
  request['paymentId'] = tag
1628
1631
  return self.extend(request, params)
1629
1632
 
1630
- async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
1633
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1631
1634
  """
1632
1635
  make a withdrawal
1633
1636
  :param str code: unified currency code
@@ -61,8 +61,11 @@ class bl3p(Exchange, ImplicitAPI):
61
61
  'fetchOpenInterestHistory': False,
62
62
  'fetchOrderBook': True,
63
63
  'fetchPosition': False,
64
+ 'fetchPositionHistory': False,
64
65
  'fetchPositionMode': False,
65
66
  'fetchPositions': False,
67
+ 'fetchPositionsForSymbol': False,
68
+ 'fetchPositionsHistory': False,
66
69
  'fetchPositionsRisk': False,
67
70
  'fetchPremiumIndexOHLCV': False,
68
71
  'fetchTicker': True,
@@ -873,7 +873,7 @@ class blockchaincom(Exchange, ImplicitAPI):
873
873
  'fee': fee,
874
874
  }
875
875
 
876
- async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
876
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
877
877
  """
878
878
  make a withdrawal
879
879
  :see: https://api.blockchain.com/v3/#/payments/createWithdrawal
@@ -73,8 +73,11 @@ class btcalpha(Exchange, ImplicitAPI):
73
73
  'fetchOrderBook': True,
74
74
  'fetchOrders': True,
75
75
  'fetchPosition': False,
76
+ 'fetchPositionHistory': False,
76
77
  'fetchPositionMode': False,
77
78
  'fetchPositions': False,
79
+ 'fetchPositionsForSymbol': False,
80
+ 'fetchPositionsHistory': False,
78
81
  'fetchPositionsRisk': False,
79
82
  'fetchPremiumIndexOHLCV': False,
80
83
  'fetchTicker': True,