ccxt 4.3.6__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 (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 +5 -3
  13. ccxt/async_support/bingx.py +3 -1
  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 +70 -4
  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 +151 -47
  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 +80 -4
  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 +3 -1
  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 +27 -1
  92. ccxt/bigone.py +1 -1
  93. ccxt/binance.py +5 -3
  94. ccxt/bingx.py +3 -1
  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 +70 -4
  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 +151 -47
  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 +80 -4
  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 +3 -1
  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.7.dist-info}/METADATA +4 -4
  176. {ccxt-4.3.6.dist-info → ccxt-4.3.7.dist-info}/RECORD +178 -178
  177. {ccxt-4.3.6.dist-info → ccxt-4.3.7.dist-info}/WHEEL +0 -0
  178. {ccxt-4.3.6.dist-info → ccxt-4.3.7.dist-info}/top_level.txt +0 -0
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.mexc import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Account, Balances, Currencies, Currency, IndexType, Int, Leverage, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry
9
+ from ccxt.base.types import Account, Balances, Currencies, Currency, IndexType, Int, Leverage, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import AuthenticationError
@@ -104,8 +104,10 @@ class mexc(Exchange, ImplicitAPI):
104
104
  'fetchOrders': True,
105
105
  'fetchOrderTrades': True,
106
106
  'fetchPosition': True,
107
+ 'fetchPositionHistory': 'emulated',
107
108
  'fetchPositionMode': True,
108
109
  'fetchPositions': True,
110
+ 'fetchPositionsHistory': True,
109
111
  'fetchPositionsRisk': None,
110
112
  'fetchPremiumIndexOHLCV': False,
111
113
  'fetchStatus': True,
@@ -3779,7 +3781,7 @@ class mexc(Exchange, ImplicitAPI):
3779
3781
  # }
3780
3782
  return response
3781
3783
 
3782
- async def reduce_margin(self, symbol: str, amount, params={}) -> MarginModification:
3784
+ async def reduce_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
3783
3785
  """
3784
3786
  remove margin from a position
3785
3787
  :param str symbol: unified market symbol
@@ -3789,7 +3791,7 @@ class mexc(Exchange, ImplicitAPI):
3789
3791
  """
3790
3792
  return await self.modify_margin_helper(symbol, amount, 'SUB', params)
3791
3793
 
3792
- async def add_margin(self, symbol: str, amount, params={}) -> MarginModification:
3794
+ async def add_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
3793
3795
  """
3794
3796
  add margin
3795
3797
  :param str symbol: unified market symbol
@@ -4557,6 +4559,8 @@ class mexc(Exchange, ImplicitAPI):
4557
4559
  return self.parse_positions(data, symbols)
4558
4560
 
4559
4561
  def parse_position(self, position, market: Market = None):
4562
+ #
4563
+ # fetchPositions
4560
4564
  #
4561
4565
  # {
4562
4566
  # "positionId": 1394650,
@@ -4581,6 +4585,40 @@ class mexc(Exchange, ImplicitAPI):
4581
4585
  # "autoAddIm": False
4582
4586
  # }
4583
4587
  #
4588
+ # fetchPositionsHistory
4589
+ #
4590
+ # {
4591
+ # positionId: '390281084',
4592
+ # symbol: 'RVN_USDT',
4593
+ # positionType: '1',
4594
+ # openType: '2',
4595
+ # state: '3',
4596
+ # holdVol: '0',
4597
+ # frozenVol: '0',
4598
+ # closeVol: '1141',
4599
+ # holdAvgPrice: '0.03491',
4600
+ # holdAvgPriceFullyScale: '0.03491',
4601
+ # openAvgPrice: '0.03491',
4602
+ # openAvgPriceFullyScale: '0.03491',
4603
+ # closeAvgPrice: '0.03494',
4604
+ # liquidatePrice: '0.03433',
4605
+ # oim: '0',
4606
+ # im: '0',
4607
+ # holdFee: '0',
4608
+ # realised: '0.1829',
4609
+ # leverage: '50',
4610
+ # createTime: '1711512408000',
4611
+ # updateTime: '1711512553000',
4612
+ # autoAddIm: False,
4613
+ # version: '4',
4614
+ # profitRatio: '0.0227',
4615
+ # newOpenAvgPrice: '0.03491',
4616
+ # newCloseAvgPrice: '0.03494',
4617
+ # closeProfitLoss: '0.3423',
4618
+ # fee: '0.1593977',
4619
+ # positionShowStatus: 'CLOSED'
4620
+ # }
4621
+ #
4584
4622
  market = self.safe_market(self.safe_string(position, 'symbol'), market)
4585
4623
  symbol = market['symbol']
4586
4624
  contracts = self.safe_string(position, 'holdVol')
@@ -4853,7 +4891,7 @@ class mexc(Exchange, ImplicitAPI):
4853
4891
  }
4854
4892
  return self.safe_string(statuses, status, status)
4855
4893
 
4856
- async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
4894
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
4857
4895
  """
4858
4896
  make a withdrawal
4859
4897
  :see: https://mexcdevelop.github.io/apidocs/spot_v3_en/#withdraw
@@ -5180,6 +5218,74 @@ class mexc(Exchange, ImplicitAPI):
5180
5218
  marginMode = 'isolated'
5181
5219
  return [marginMode, params]
5182
5220
 
5221
+ async def fetch_positions_history(self, symbols: Strings = None, since: Int = None, limit: Int = None, params={}) -> List[Position]:
5222
+ """
5223
+ fetches historical positions
5224
+ :see: https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-the-user-s-history-position-information
5225
+ :param str[] [symbols]: unified contract symbols
5226
+ :param int [since]: not used by mexc fetchPositionsHistory
5227
+ :param int [limit]: the maximum amount of candles to fetch, default=1000
5228
+ :param dict params: extra parameters specific to the exchange api endpoint
5229
+ *
5230
+ * EXCHANGE SPECIFIC PARAMETERS
5231
+ :param int type: position type,1: long, 2: short
5232
+ :param int page_num: current page number, default is 1
5233
+ :returns dict[]: a list of `position structures <https://docs.ccxt.com/#/?id=position-structure>`
5234
+ """
5235
+ await self.load_markets()
5236
+ request = {}
5237
+ if symbols is not None:
5238
+ symbolsLength = len(symbols)
5239
+ if symbolsLength == 1:
5240
+ market = self.market(symbols[0])
5241
+ request['symbol'] = market['id']
5242
+ if limit is not None:
5243
+ request['page_size'] = limit
5244
+ response = await self.contractPrivateGetPositionListHistoryPositions(self.extend(request, params))
5245
+ #
5246
+ # {
5247
+ # success: True,
5248
+ # code: '0',
5249
+ # data: [
5250
+ # {
5251
+ # positionId: '390281084',
5252
+ # symbol: 'RVN_USDT',
5253
+ # positionType: '1',
5254
+ # openType: '2',
5255
+ # state: '3',
5256
+ # holdVol: '0',
5257
+ # frozenVol: '0',
5258
+ # closeVol: '1141',
5259
+ # holdAvgPrice: '0.03491',
5260
+ # holdAvgPriceFullyScale: '0.03491',
5261
+ # openAvgPrice: '0.03491',
5262
+ # openAvgPriceFullyScale: '0.03491',
5263
+ # closeAvgPrice: '0.03494',
5264
+ # liquidatePrice: '0.03433',
5265
+ # oim: '0',
5266
+ # im: '0',
5267
+ # holdFee: '0',
5268
+ # realised: '0.1829',
5269
+ # leverage: '50',
5270
+ # createTime: '1711512408000',
5271
+ # updateTime: '1711512553000',
5272
+ # autoAddIm: False,
5273
+ # version: '4',
5274
+ # profitRatio: '0.0227',
5275
+ # newOpenAvgPrice: '0.03491',
5276
+ # newCloseAvgPrice: '0.03494',
5277
+ # closeProfitLoss: '0.3423',
5278
+ # fee: '0.1593977',
5279
+ # positionShowStatus: 'CLOSED'
5280
+ # },
5281
+ # ...
5282
+ # ]
5283
+ # }
5284
+ #
5285
+ data = self.safe_list(response, 'data')
5286
+ positions = self.parse_positions(data, symbols, params)
5287
+ return self.filter_by_since_limit(positions, since, limit)
5288
+
5183
5289
  def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
5184
5290
  section = self.safe_string(api, 0)
5185
5291
  access = self.safe_string(api, 1)
@@ -76,7 +76,11 @@ class ndax(Exchange, ImplicitAPI):
76
76
  'fetchOrders': True,
77
77
  'fetchOrderTrades': True,
78
78
  'fetchPosition': False,
79
+ 'fetchPositionHistory': False,
80
+ 'fetchPositionMode': False,
79
81
  'fetchPositions': False,
82
+ 'fetchPositionsForSymbol': False,
83
+ 'fetchPositionsHistory': False,
80
84
  'fetchPositionsRisk': False,
81
85
  'fetchPremiumIndexOHLCV': False,
82
86
  'fetchTicker': True,
@@ -2191,7 +2195,7 @@ class ndax(Exchange, ImplicitAPI):
2191
2195
  'network': None,
2192
2196
  }
2193
2197
 
2194
- async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
2198
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
2195
2199
  """
2196
2200
  make a withdrawal
2197
2201
  :param str code: unified currency code
@@ -89,7 +89,11 @@ class novadax(Exchange, ImplicitAPI):
89
89
  'fetchOrders': True,
90
90
  'fetchOrderTrades': True,
91
91
  'fetchPosition': False,
92
+ 'fetchPositionHistory': False,
93
+ 'fetchPositionMode': False,
92
94
  'fetchPositions': False,
95
+ 'fetchPositionsForSymbol': False,
96
+ 'fetchPositionsHistory': False,
93
97
  'fetchPositionsRisk': False,
94
98
  'fetchPremiumIndexOHLCV': False,
95
99
  'fetchTicker': True,
@@ -1154,7 +1158,7 @@ class novadax(Exchange, ImplicitAPI):
1154
1158
  }
1155
1159
  return self.safe_string(statuses, status, 'failed')
1156
1160
 
1157
- async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
1161
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1158
1162
  """
1159
1163
  make a withdrawal
1160
1164
  :see: https://doc.novadax.com/en-US/#send-cryptocurrencies
@@ -2309,7 +2309,7 @@ class okcoin(Exchange, ImplicitAPI):
2309
2309
  }
2310
2310
  return self.safe_string(statuses, status, status)
2311
2311
 
2312
- async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
2312
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
2313
2313
  """
2314
2314
  :see: https://www.okcoin.com/docs-v5/en/#rest-api-funding-withdrawal
2315
2315
  make a withdrawal
ccxt/async_support/okx.py CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.okx import ImplicitAPI
8
8
  import asyncio
9
9
  import hashlib
10
- from ccxt.base.types import Account, Balances, Conversion, Currencies, Currency, Greeks, Int, Leverage, MarginModification, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
10
+ from ccxt.base.types import Account, Balances, Conversion, Currencies, Currency, Greeks, Int, Leverage, MarginModification, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
11
11
  from typing import List
12
12
  from typing import Any
13
13
  from ccxt.base.errors import ExchangeError
@@ -135,8 +135,10 @@ class okx(Exchange, ImplicitAPI):
135
135
  'fetchOrderTrades': True,
136
136
  'fetchPermissions': None,
137
137
  'fetchPosition': True,
138
+ 'fetchPositionHistory': 'emulated',
138
139
  'fetchPositions': True,
139
140
  'fetchPositionsForSymbol': True,
141
+ 'fetchPositionsHistory': True,
140
142
  'fetchPositionsRisk': False,
141
143
  'fetchPremiumIndexOHLCV': False,
142
144
  'fetchSettlementHistory': True,
@@ -4501,7 +4503,7 @@ class okx(Exchange, ImplicitAPI):
4501
4503
  raise InvalidAddress(self.id + ' fetchDepositAddress() cannot find ' + network + ' deposit address for ' + code)
4502
4504
  return result
4503
4505
 
4504
- async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
4506
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
4505
4507
  """
4506
4508
  make a withdrawal
4507
4509
  :see: https://www.okx.com/docs-v5/en/#funding-account-rest-api-withdrawal
@@ -6225,7 +6227,7 @@ class okx(Exchange, ImplicitAPI):
6225
6227
  'datetime': self.iso8601(timestamp),
6226
6228
  }
6227
6229
 
6228
- async def reduce_margin(self, symbol: str, amount, params={}) -> MarginModification:
6230
+ async def reduce_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
6229
6231
  """
6230
6232
  remove margin from a position
6231
6233
  :see: https://www.okx.com/docs-v5/en/#trading-account-rest-api-increase-decrease-margin
@@ -6236,7 +6238,7 @@ class okx(Exchange, ImplicitAPI):
6236
6238
  """
6237
6239
  return await self.modify_margin_helper(symbol, amount, 'reduce', params)
6238
6240
 
6239
- async def add_margin(self, symbol: str, amount, params={}) -> MarginModification:
6241
+ async def add_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
6240
6242
  """
6241
6243
  add margin
6242
6244
  :see: https://www.okx.com/docs-v5/en/#trading-account-rest-api-increase-decrease-margin
@@ -7653,3 +7655,77 @@ class okx(Exchange, ImplicitAPI):
7653
7655
  data = self.safe_list(response, 'data')
7654
7656
  modifications = self.parse_margin_modifications(data)
7655
7657
  return self.filter_by_symbol_since_limit(modifications, symbol, since, limit)
7658
+
7659
+ async def fetch_positions_history(self, symbols: Strings = None, since: Int = None, limit: Int = None, params={}) -> List[Position]:
7660
+ """
7661
+ fetches historical positions
7662
+ :see: https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-positions-history
7663
+ :param str [symbols]: unified market symbols
7664
+ :param int [since]: timestamp in ms of the earliest position to fetch
7665
+ :param int [limit]: the maximum amount of records to fetch, default=100, max=100
7666
+ :param dict params: extra parameters specific to the exchange api endpoint
7667
+ :param str [params.marginMode]: "cross" or "isolated"
7668
+ *
7669
+ * EXCHANGE SPECIFIC PARAMETERS
7670
+ :param str [params.instType]: margin, swap, futures or option
7671
+ :param str [params.type]: the type of latest close position 1: close position partially, 2:close all, 3:liquidation, 4:partial liquidation; 5:adl, is it is the latest type if there are several types for the same position
7672
+ :param str [params.posId]: position id, there is attribute expiration, the posid will be expired if it is more than 30 days after the last full close position, then position will use new posid
7673
+ :param str [params.before]: timestamp in ms of the earliest position to fetch based on the last update time of the position
7674
+ :param str [params.after]: timestamp in ms of the latest position to fetch based on the last update time of the position
7675
+ :returns dict[]: a list of `position structures <https://docs.ccxt.com/#/?id=position-structure>`
7676
+ """
7677
+ await self.load_markets()
7678
+ marginMode = self.safe_string(params, 'marginMode')
7679
+ instType = self.safe_string_upper(params, 'instType')
7680
+ params = self.omit(params, ['until', 'marginMode', 'instType'])
7681
+ if limit is None:
7682
+ limit = 100
7683
+ request = {
7684
+ 'limit': limit,
7685
+ }
7686
+ if symbols is not None:
7687
+ symbolsLength = len(symbols)
7688
+ if symbolsLength == 1:
7689
+ market = self.market(symbols[0])
7690
+ request['instId'] = market['id']
7691
+ if marginMode is not None:
7692
+ request['mgnMode'] = marginMode
7693
+ if instType is not None:
7694
+ request['instType'] = instType
7695
+ response = await self.privateGetAccountPositionsHistory(self.extend(request, params))
7696
+ #
7697
+ # {
7698
+ # code: '0',
7699
+ # data: [
7700
+ # {
7701
+ # cTime: '1708735940395',
7702
+ # ccy: 'USDT',
7703
+ # closeAvgPx: '0.6330444444444444',
7704
+ # closeTotalPos: '27',
7705
+ # direction: 'long',
7706
+ # fee: '-1.69566',
7707
+ # fundingFee: '-11.870404179341788',
7708
+ # instId: 'XRP-USDT-SWAP',
7709
+ # instType: 'SWAP',
7710
+ # lever: '3.0',
7711
+ # liqPenalty: '0',
7712
+ # mgnMode: 'cross',
7713
+ # openAvgPx: '0.623',
7714
+ # openMaxPos: '15',
7715
+ # pnl: '27.11999999999988',
7716
+ # pnlRatio: '0.0241732402722634',
7717
+ # posId: '681423155054862336',
7718
+ # realizedPnl: '13.553935820658092',
7719
+ # triggerPx: '',
7720
+ # type: '2',
7721
+ # uTime: '1711088748170',
7722
+ # uly: 'XRP-USDT'
7723
+ # },
7724
+ # ...
7725
+ # ],
7726
+ # msg: ''
7727
+ # }
7728
+ #
7729
+ data = self.safe_list(response, 'data')
7730
+ positions = self.parse_positions(data, symbols, params)
7731
+ return self.filter_by_since_limit(positions, since, limit)
@@ -86,8 +86,11 @@ class onetrading(Exchange, ImplicitAPI):
86
86
  'fetchOrders': False,
87
87
  'fetchOrderTrades': True,
88
88
  'fetchPosition': False,
89
+ 'fetchPositionHistory': False,
89
90
  'fetchPositionMode': False,
90
91
  'fetchPositions': False,
92
+ 'fetchPositionsForSymbol': False,
93
+ 'fetchPositionsHistory': False,
91
94
  'fetchPositionsRisk': False,
92
95
  'fetchPremiumIndexOHLCV': False,
93
96
  'fetchTicker': True,
@@ -1179,7 +1182,7 @@ class onetrading(Exchange, ImplicitAPI):
1179
1182
  withdrawalHistory = self.safe_list(response, 'withdrawal_history', [])
1180
1183
  return self.parse_transactions(withdrawalHistory, currency, since, limit, {'type': 'withdrawal'})
1181
1184
 
1182
- async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
1185
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1183
1186
  """
1184
1187
  make a withdrawal
1185
1188
  :param str code: unified currency code
ccxt/async_support/p2b.py CHANGED
@@ -85,8 +85,11 @@ class p2b(Exchange, ImplicitAPI):
85
85
  'fetchOrderTrades': True,
86
86
  'fetchPermissions': False,
87
87
  'fetchPosition': False,
88
+ 'fetchPositionHistory': False,
89
+ 'fetchPositionMode': False,
88
90
  'fetchPositions': False,
89
91
  'fetchPositionsForSymbol': False,
92
+ 'fetchPositionsHistory': False,
90
93
  'fetchPositionsRisk': False,
91
94
  'fetchPremiumIndexOHLCV': False,
92
95
  'fetchTicker': True,
@@ -4319,7 +4319,7 @@ class phemex(Exchange, ImplicitAPI):
4319
4319
  sorted = self.sort_by(result, 'timestamp')
4320
4320
  return self.filter_by_symbol_since_limit(sorted, symbol, since, limit)
4321
4321
 
4322
- async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
4322
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
4323
4323
  """
4324
4324
  make a withdrawal
4325
4325
  :see: https://phemex-docs.github.io/#create-withdraw-request
@@ -1787,7 +1787,7 @@ class poloniex(Exchange, ImplicitAPI):
1787
1787
  'status': None,
1788
1788
  }
1789
1789
 
1790
- async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
1790
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1791
1791
  """
1792
1792
  make a withdrawal
1793
1793
  :see: https://docs.poloniex.com/#authenticated-endpoints-wallets-withdraw-currency
@@ -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,
@@ -1809,7 +1809,7 @@ class whitebit(Exchange, ImplicitAPI):
1809
1809
  'status': None,
1810
1810
  }
1811
1811
 
1812
- 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={}):
1813
1813
  """
1814
1814
  make a withdrawal
1815
1815
  :see: https://docs.whitebit.com/private/http-main-v4/#create-withdraw-request
ccxt/async_support/woo.py CHANGED
@@ -97,8 +97,10 @@ class woo(Exchange, ImplicitAPI):
97
97
  'fetchOrders': True,
98
98
  'fetchOrderTrades': True,
99
99
  'fetchPosition': True,
100
+ 'fetchPositionHistory': False,
100
101
  'fetchPositionMode': False,
101
102
  'fetchPositions': True,
103
+ 'fetchPositionsHistory': False,
102
104
  'fetchPremiumIndexOHLCV': False,
103
105
  'fetchStatus': True,
104
106
  'fetchTicker': False,
@@ -2238,7 +2240,7 @@ class woo(Exchange, ImplicitAPI):
2238
2240
  }
2239
2241
  return self.safe_string(statuses, status, status)
2240
2242
 
2241
- 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={}):
2242
2244
  """
2243
2245
  make a withdrawal
2244
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.6'
7
+ __version__ = '4.3.7'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -5772,6 +5772,32 @@ class Exchange(object):
5772
5772
  reconstructedDate = day + month + year
5773
5773
  return reconstructedDate
5774
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
+
5775
5801
  def parse_margin_modification(self, data, market: Market = None):
5776
5802
  raise NotSupported(self.id + ' parseMarginModification() is not supported yet')
5777
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