ccxt 4.2.88__py2.py3-none-any.whl → 4.2.90__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 (156) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/bingx.py +2 -0
  3. ccxt/abstract/bybit.py +2 -0
  4. ccxt/ascendex.py +6 -3
  5. ccxt/async_support/__init__.py +1 -1
  6. ccxt/async_support/ascendex.py +6 -3
  7. ccxt/async_support/base/exchange.py +15 -2
  8. ccxt/async_support/bigone.py +2 -2
  9. ccxt/async_support/binance.py +88 -14
  10. ccxt/async_support/bingx.py +96 -3
  11. ccxt/async_support/bit2c.py +2 -2
  12. ccxt/async_support/bitbank.py +2 -2
  13. ccxt/async_support/bitfinex.py +2 -2
  14. ccxt/async_support/bitfinex2.py +4 -3
  15. ccxt/async_support/bitflyer.py +4 -2
  16. ccxt/async_support/bitget.py +12 -5
  17. ccxt/async_support/bitmart.py +6 -4
  18. ccxt/async_support/bitmex.py +3 -2
  19. ccxt/async_support/bitopro.py +3 -3
  20. ccxt/async_support/bitrue.py +3 -2
  21. ccxt/async_support/bitso.py +2 -2
  22. ccxt/async_support/bitstamp.py +89 -97
  23. ccxt/async_support/bitteam.py +2 -2
  24. ccxt/async_support/bitvavo.py +3 -3
  25. ccxt/async_support/bl3p.py +2 -2
  26. ccxt/async_support/blockchaincom.py +2 -2
  27. ccxt/async_support/blofin.py +4 -2
  28. ccxt/async_support/bybit.py +57 -5
  29. ccxt/async_support/cex.py +3 -3
  30. ccxt/async_support/coinbase.py +42 -22
  31. ccxt/async_support/coinbaseinternational.py +3 -2
  32. ccxt/async_support/coinbasepro.py +3 -3
  33. ccxt/async_support/coincheck.py +2 -2
  34. ccxt/async_support/coinex.py +101 -13
  35. ccxt/async_support/coinlist.py +3 -3
  36. ccxt/async_support/coinmate.py +2 -2
  37. ccxt/async_support/coinmetro.py +2 -2
  38. ccxt/async_support/coinone.py +2 -2
  39. ccxt/async_support/coinsph.py +6 -4
  40. ccxt/async_support/cryptocom.py +1 -0
  41. ccxt/async_support/currencycom.py +3 -3
  42. ccxt/async_support/delta.py +3 -2
  43. ccxt/async_support/deribit.py +3 -3
  44. ccxt/async_support/digifinex.py +7 -4
  45. ccxt/async_support/exmo.py +4 -3
  46. ccxt/async_support/gate.py +8 -4
  47. ccxt/async_support/gemini.py +13 -12
  48. ccxt/async_support/hitbtc.py +8 -5
  49. ccxt/async_support/hollaex.py +3 -3
  50. ccxt/async_support/htx.py +7 -4
  51. ccxt/async_support/huobijp.py +2 -2
  52. ccxt/async_support/hyperliquid.py +3 -2
  53. ccxt/async_support/idex.py +3 -3
  54. ccxt/async_support/independentreserve.py +2 -2
  55. ccxt/async_support/kraken.py +3 -3
  56. ccxt/async_support/kucoin.py +43 -18
  57. ccxt/async_support/kucoinfutures.py +32 -4
  58. ccxt/async_support/kuna.py +2 -2
  59. ccxt/async_support/latoken.py +7 -3
  60. ccxt/async_support/lbank.py +7 -5
  61. ccxt/async_support/luno.py +4 -2
  62. ccxt/async_support/lykke.py +2 -2
  63. ccxt/async_support/mexc.py +57 -9
  64. ccxt/async_support/ndax.py +2 -2
  65. ccxt/async_support/oceanex.py +2 -2
  66. ccxt/async_support/okcoin.py +2 -2
  67. ccxt/async_support/okx.py +149 -12
  68. ccxt/async_support/onetrading.py +3 -3
  69. ccxt/async_support/phemex.py +3 -2
  70. ccxt/async_support/poloniex.py +3 -3
  71. ccxt/async_support/probit.py +2 -2
  72. ccxt/async_support/timex.py +6 -4
  73. ccxt/async_support/upbit.py +2 -2
  74. ccxt/async_support/wazirx.py +2 -2
  75. ccxt/async_support/whitebit.py +3 -3
  76. ccxt/async_support/woo.py +4 -3
  77. ccxt/async_support/yobit.py +2 -2
  78. ccxt/base/exchange.py +65 -12
  79. ccxt/base/types.py +33 -0
  80. ccxt/bigone.py +2 -2
  81. ccxt/binance.py +88 -14
  82. ccxt/bingx.py +96 -3
  83. ccxt/bit2c.py +2 -2
  84. ccxt/bitbank.py +2 -2
  85. ccxt/bitfinex.py +2 -2
  86. ccxt/bitfinex2.py +4 -3
  87. ccxt/bitflyer.py +4 -2
  88. ccxt/bitget.py +12 -5
  89. ccxt/bitmart.py +6 -4
  90. ccxt/bitmex.py +3 -2
  91. ccxt/bitopro.py +3 -3
  92. ccxt/bitrue.py +3 -2
  93. ccxt/bitso.py +2 -2
  94. ccxt/bitstamp.py +89 -97
  95. ccxt/bitteam.py +2 -2
  96. ccxt/bitvavo.py +3 -3
  97. ccxt/bl3p.py +2 -2
  98. ccxt/blockchaincom.py +2 -2
  99. ccxt/blofin.py +4 -2
  100. ccxt/bybit.py +57 -5
  101. ccxt/cex.py +3 -3
  102. ccxt/coinbase.py +42 -22
  103. ccxt/coinbaseinternational.py +3 -2
  104. ccxt/coinbasepro.py +3 -3
  105. ccxt/coincheck.py +2 -2
  106. ccxt/coinex.py +101 -13
  107. ccxt/coinlist.py +3 -3
  108. ccxt/coinmate.py +2 -2
  109. ccxt/coinmetro.py +2 -2
  110. ccxt/coinone.py +2 -2
  111. ccxt/coinsph.py +6 -4
  112. ccxt/cryptocom.py +1 -0
  113. ccxt/currencycom.py +3 -3
  114. ccxt/delta.py +3 -2
  115. ccxt/deribit.py +3 -3
  116. ccxt/digifinex.py +7 -4
  117. ccxt/exmo.py +4 -3
  118. ccxt/gate.py +8 -4
  119. ccxt/gemini.py +13 -12
  120. ccxt/hitbtc.py +8 -5
  121. ccxt/hollaex.py +3 -3
  122. ccxt/htx.py +7 -4
  123. ccxt/huobijp.py +2 -2
  124. ccxt/hyperliquid.py +3 -2
  125. ccxt/idex.py +3 -3
  126. ccxt/independentreserve.py +2 -2
  127. ccxt/kraken.py +3 -3
  128. ccxt/kucoin.py +43 -18
  129. ccxt/kucoinfutures.py +32 -4
  130. ccxt/kuna.py +2 -2
  131. ccxt/latoken.py +7 -3
  132. ccxt/lbank.py +7 -5
  133. ccxt/luno.py +4 -2
  134. ccxt/lykke.py +2 -2
  135. ccxt/mexc.py +57 -9
  136. ccxt/ndax.py +2 -2
  137. ccxt/oceanex.py +2 -2
  138. ccxt/okcoin.py +2 -2
  139. ccxt/okx.py +149 -12
  140. ccxt/onetrading.py +3 -3
  141. ccxt/phemex.py +3 -2
  142. ccxt/poloniex.py +3 -3
  143. ccxt/pro/__init__.py +1 -1
  144. ccxt/pro/bitget.py +2 -0
  145. ccxt/pro/bitvavo.py +2 -2
  146. ccxt/probit.py +2 -2
  147. ccxt/timex.py +6 -4
  148. ccxt/upbit.py +2 -2
  149. ccxt/wazirx.py +2 -2
  150. ccxt/whitebit.py +3 -3
  151. ccxt/woo.py +4 -3
  152. ccxt/yobit.py +2 -2
  153. {ccxt-4.2.88.dist-info → ccxt-4.2.90.dist-info}/METADATA +4 -4
  154. {ccxt-4.2.88.dist-info → ccxt-4.2.90.dist-info}/RECORD +156 -156
  155. {ccxt-4.2.88.dist-info → ccxt-4.2.90.dist-info}/WHEEL +0 -0
  156. {ccxt-4.2.88.dist-info → ccxt-4.2.90.dist-info}/top_level.txt +0 -0
ccxt/base/types.py CHANGED
@@ -65,6 +65,15 @@ class FeeInterface(TypedDict):
65
65
  Fee = Optional[FeeInterface]
66
66
 
67
67
 
68
+ class TradingFeeInterface(TypedDict):
69
+ info: Dict[str, Any]
70
+ symbol: Str
71
+ maker: Num
72
+ taker: Num
73
+ percentage: Bool
74
+ tierBased: Bool
75
+
76
+
68
77
  class Balance(TypedDict):
69
78
  free: Num
70
79
  used: Num
@@ -361,10 +370,31 @@ class MarketInterface(TypedDict):
361
370
  created: Int
362
371
 
363
372
 
373
+ class Limit(TypedDict):
374
+ min: Num
375
+ max: Num
376
+
377
+
378
+ class CurrencyLimits(TypedDict):
379
+ amount: Limit
380
+ withdraw: Limit
381
+
382
+
364
383
  class CurrencyInterface(TypedDict):
365
384
  id: Str
366
385
  code: Str
386
+ numericId: Int
367
387
  precision: Num
388
+ type: Str
389
+ margin: Bool
390
+ name: Str
391
+ active: Bool
392
+ deposit: Bool
393
+ withdraw: Bool
394
+ fee: Num
395
+ limits: CurrencyLimits
396
+ networks: Dict[str, any]
397
+ info: any
368
398
 
369
399
 
370
400
  class LastPrice(TypedDict):
@@ -380,6 +410,7 @@ class MarginModification(TypedDict):
380
410
  info: Dict[str, any]
381
411
  symbol: str
382
412
  type: Optional[Literal['add', 'reduce', 'set']]
413
+ marginMode: Optional[Literal['isolated', 'cross']]
383
414
  amount: Optional[float]
384
415
  code: Str
385
416
  status: Str
@@ -388,6 +419,8 @@ class MarginModification(TypedDict):
388
419
 
389
420
 
390
421
  LastPrices = Dict[Str, LastPrice]
422
+ Currencies = Dict[Str, CurrencyInterface]
423
+ TradingFees = Dict[Str, TradingFeeInterface]
391
424
 
392
425
  Market = Optional[MarketInterface]
393
426
  Currency = Optional[CurrencyInterface]
ccxt/bigone.py CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.bigone import ImplicitAPI
8
- from ccxt.base.types import Balances, Bool, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
8
+ from ccxt.base.types import Balances, Bool, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
9
9
  from typing import List
10
10
  from ccxt.base.errors import ExchangeError
11
11
  from ccxt.base.errors import PermissionDenied
@@ -339,7 +339,7 @@ class bigone(Exchange, ImplicitAPI):
339
339
  },
340
340
  })
341
341
 
342
- def fetch_currencies(self, params={}):
342
+ def fetch_currencies(self, params={}) -> Currencies:
343
343
  """
344
344
  fetches all available currencies on an exchange
345
345
  :param dict [params]: extra parameters specific to the exchange API endpoint
ccxt/binance.py CHANGED
@@ -7,7 +7,7 @@ from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.binance import ImplicitAPI
8
8
  import hashlib
9
9
  import json
10
- from ccxt.base.types import Balances, Currency, Greeks, Int, Leverage, Leverages, MarginMode, MarginModes, MarginModification, Market, MarketInterface, Num, Option, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
10
+ from ccxt.base.types import Balances, Currencies, Currency, Greeks, Int, Leverage, Leverages, MarginMode, MarginModes, MarginModification, Market, MarketInterface, Num, Option, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import PermissionDenied
@@ -120,6 +120,7 @@ class binance(Exchange, ImplicitAPI):
120
120
  'fetchLeverages': True,
121
121
  'fetchLeverageTiers': True,
122
122
  'fetchLiquidations': False,
123
+ 'fetchMarginAdjustmentHistory': True,
123
124
  'fetchMarginMode': 'emulated',
124
125
  'fetchMarginModes': True,
125
126
  'fetchMarketLeverageTiers': 'emulated',
@@ -2592,7 +2593,7 @@ class binance(Exchange, ImplicitAPI):
2592
2593
  response = self.publicGetTime(query)
2593
2594
  return self.safe_integer(response, 'serverTime')
2594
2595
 
2595
- def fetch_currencies(self, params={}):
2596
+ def fetch_currencies(self, params={}) -> Currencies:
2596
2597
  """
2597
2598
  fetches all available currencies on an exchange
2598
2599
  :see: https://binance-docs.github.io/apidocs/spot/en/#all-coins-39-information-user_data
@@ -8036,7 +8037,7 @@ class binance(Exchange, ImplicitAPI):
8036
8037
  # {id: '9a67628b16ba4988ae20d329333f16bc'}
8037
8038
  return self.parse_transaction(response, currency)
8038
8039
 
8039
- def parse_trading_fee(self, fee, market: Market = None):
8040
+ def parse_trading_fee(self, fee, market: Market = None) -> TradingFeeInterface:
8040
8041
  #
8041
8042
  # spot
8042
8043
  # [
@@ -8061,9 +8062,11 @@ class binance(Exchange, ImplicitAPI):
8061
8062
  'symbol': symbol,
8062
8063
  'maker': self.safe_number_2(fee, 'makerCommission', 'makerCommissionRate'),
8063
8064
  'taker': self.safe_number_2(fee, 'takerCommission', 'takerCommissionRate'),
8065
+ 'percentage': None,
8066
+ 'tierBased': None,
8064
8067
  }
8065
8068
 
8066
- def fetch_trading_fee(self, symbol: str, params={}):
8069
+ def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
8067
8070
  """
8068
8071
  fetch the trading fees for a market
8069
8072
  :see: https://binance-docs.github.io/apidocs/spot/en/#trade-fee-user_data
@@ -8126,7 +8129,7 @@ class binance(Exchange, ImplicitAPI):
8126
8129
  data = self.safe_dict(data, 0, {})
8127
8130
  return self.parse_trading_fee(data, market)
8128
8131
 
8129
- def fetch_trading_fees(self, params={}):
8132
+ def fetch_trading_fees(self, params={}) -> TradingFees:
8130
8133
  """
8131
8134
  fetch the trading fees for multiple markets
8132
8135
  :see: https://binance-docs.github.io/apidocs/spot/en/#trade-fee-user_data
@@ -10327,21 +10330,37 @@ class binance(Exchange, ImplicitAPI):
10327
10330
  # "type": 1
10328
10331
  # }
10329
10332
  #
10333
+ # fetchMarginAdjustmentHistory
10334
+ #
10335
+ # {
10336
+ # symbol: "XRPUSDT",
10337
+ # type: "1",
10338
+ # deltaType: "TRADE",
10339
+ # amount: "2.57148240",
10340
+ # asset: "USDT",
10341
+ # time: "1711046271555",
10342
+ # positionSide: "BOTH",
10343
+ # clientTranId: ""
10344
+ # }
10345
+ #
10330
10346
  rawType = self.safe_integer(data, 'type')
10331
- resultType = 'add' if (rawType == 1) else 'reduce'
10332
- resultAmount = self.safe_number(data, 'amount')
10333
10347
  errorCode = self.safe_string(data, 'code')
10334
- status = 'ok' if (errorCode == '200') else 'failed'
10348
+ marketId = self.safe_string(data, 'symbol')
10349
+ timestamp = self.safe_integer(data, 'time')
10350
+ market = self.safe_market(marketId, market, None, 'swap')
10351
+ noErrorCode = errorCode is None
10352
+ success = errorCode == '200'
10335
10353
  return {
10336
10354
  'info': data,
10337
10355
  'symbol': market['symbol'],
10338
- 'type': resultType,
10339
- 'amount': resultAmount,
10356
+ 'type': 'add' if (rawType == 1) else 'reduce',
10357
+ 'marginMode': 'isolated',
10358
+ 'amount': self.safe_number(data, 'amount'),
10359
+ 'code': self.safe_string(data, 'asset'),
10340
10360
  'total': None,
10341
- 'code': None,
10342
- 'status': status,
10343
- 'timestamp': None,
10344
- 'datetime': None,
10361
+ 'status': 'ok' if (success or noErrorCode) else 'failed',
10362
+ 'timestamp': timestamp,
10363
+ 'datetime': self.iso8601(timestamp),
10345
10364
  }
10346
10365
 
10347
10366
  def reduce_margin(self, symbol: str, amount, params={}) -> MarginModification:
@@ -11503,3 +11522,58 @@ class binance(Exchange, ImplicitAPI):
11503
11522
  'baseVolume': self.safe_number(chain, 'volume'),
11504
11523
  'quoteVolume': None,
11505
11524
  }
11525
+
11526
+ def fetch_margin_adjustment_history(self, symbol: Str = None, type: Str = None, since: Num = None, limit: Num = None, params={}) -> List[MarginModification]:
11527
+ """
11528
+ fetches the history of margin added or reduced from contract isolated positions
11529
+ :see: https://binance-docs.github.io/apidocs/futures/en/#get-position-margin-change-history-trade
11530
+ :see: https://binance-docs.github.io/apidocs/delivery/en/#get-position-margin-change-history-trade
11531
+ :param str symbol: unified market symbol
11532
+ :param str [type]: "add" or "reduce"
11533
+ :param int [since]: timestamp in ms of the earliest change to fetch
11534
+ :param int [limit]: the maximum amount of changes to fetch
11535
+ :param dict params: extra parameters specific to the exchange api endpoint
11536
+ :param int [params.until]: timestamp in ms of the latest change to fetch
11537
+ :returns dict[]: a list of `margin structures <https://docs.ccxt.com/#/?id=margin-loan-structure>`
11538
+ """
11539
+ self.load_markets()
11540
+ if symbol is None:
11541
+ raise ArgumentsRequired(self.id + ' fetchMarginAdjustmentHistory() requires a symbol argument')
11542
+ market = self.market(symbol)
11543
+ until = self.safe_integer(params, 'until')
11544
+ params = self.omit(params, 'until')
11545
+ request = {
11546
+ 'symbol': market['id'],
11547
+ }
11548
+ if type is not None:
11549
+ request['type'] = 1 if (type == 'add') else 2
11550
+ if since is not None:
11551
+ request['startTime'] = since
11552
+ if limit is not None:
11553
+ request['limit'] = limit
11554
+ if until is not None:
11555
+ request['endTime'] = until
11556
+ response = None
11557
+ if market['linear']:
11558
+ response = self.fapiPrivateGetPositionMarginHistory(self.extend(request, params))
11559
+ elif market['inverse']:
11560
+ response = self.dapiPrivateGetPositionMarginHistory(self.extend(request, params))
11561
+ else:
11562
+ raise BadRequest(self.id + 'fetchMarginAdjustmentHistory() is not supported for markets of type ' + market['type'])
11563
+ #
11564
+ # [
11565
+ # {
11566
+ # symbol: "XRPUSDT",
11567
+ # type: "1",
11568
+ # deltaType: "TRADE",
11569
+ # amount: "2.57148240",
11570
+ # asset: "USDT",
11571
+ # time: "1711046271555",
11572
+ # positionSide: "BOTH",
11573
+ # clientTranId: ""
11574
+ # }
11575
+ # ...
11576
+ # ]
11577
+ #
11578
+ modifications = self.parse_margin_modifications(response)
11579
+ return self.filter_by_symbol_since_limit(modifications, symbol, since, limit)
ccxt/bingx.py CHANGED
@@ -7,7 +7,7 @@ from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.bingx import ImplicitAPI
8
8
  import hashlib
9
9
  import numbers
10
- from ccxt.base.types import Balances, Currency, Int, Leverage, MarginMode, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
10
+ from ccxt.base.types import Balances, Currencies, Currency, Int, Leverage, MarginMode, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import PermissionDenied
@@ -73,6 +73,7 @@ class bingx(Exchange, ImplicitAPI):
73
73
  'fetchFundingRates': True,
74
74
  'fetchLeverage': True,
75
75
  'fetchLiquidations': False,
76
+ 'fetchMarginAdjustmentHistory': False,
76
77
  'fetchMarginMode': True,
77
78
  'fetchMarkets': True,
78
79
  'fetchMarkOHLCV': True,
@@ -82,6 +83,7 @@ class bingx(Exchange, ImplicitAPI):
82
83
  'fetchOpenOrders': True,
83
84
  'fetchOrder': True,
84
85
  'fetchOrderBook': True,
86
+ 'fetchOrders': True,
85
87
  'fetchPositionMode': True,
86
88
  'fetchPositions': True,
87
89
  'fetchTicker': True,
@@ -193,6 +195,7 @@ class bingx(Exchange, ImplicitAPI):
193
195
  'positionSide/dual': 1,
194
196
  'market/markPriceKlines': 1,
195
197
  'trade/batchCancelReplace': 1,
198
+ 'trade/fullOrder': 1,
196
199
  },
197
200
  'post': {
198
201
  'trade/cancelReplace': 1,
@@ -340,6 +343,7 @@ class bingx(Exchange, ImplicitAPI):
340
343
  'post': {
341
344
  'swap/trace/closeTrackOrder': 1,
342
345
  'swap/trace/setTPSL': 1,
346
+ 'spot/trader/sellOrder': 1,
343
347
  },
344
348
  },
345
349
  },
@@ -454,7 +458,7 @@ class bingx(Exchange, ImplicitAPI):
454
458
  data = self.safe_dict(response, 'data')
455
459
  return self.safe_integer(data, 'serverTime')
456
460
 
457
- def fetch_currencies(self, params={}):
461
+ def fetch_currencies(self, params={}) -> Currencies:
458
462
  """
459
463
  fetches all available currencies on an exchange
460
464
  :see: https://bingx-api.github.io/docs/#/common/account-api.html#All%20Coins
@@ -2586,7 +2590,7 @@ class bingx(Exchange, ImplicitAPI):
2586
2590
  :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
2587
2591
  """
2588
2592
  if symbol is None:
2589
- raise ArgumentsRequired(self.id + ' fetchOrders() requires a symbol argument')
2593
+ raise ArgumentsRequired(self.id + ' fetchOrder() requires a symbol argument')
2590
2594
  self.load_markets()
2591
2595
  market = self.market(symbol)
2592
2596
  request: dict = {
@@ -2654,6 +2658,94 @@ class bingx(Exchange, ImplicitAPI):
2654
2658
  first = self.safe_dict(data, 'order', data)
2655
2659
  return self.parse_order(first, market)
2656
2660
 
2661
+ def fetch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
2662
+ """
2663
+ fetches information on multiple orders made by the user
2664
+ :see: https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#User's%20All%20Orders
2665
+ :param str symbol: unified market symbol of the market orders were made in
2666
+ :param int [since]: the earliest time in ms to fetch orders for
2667
+ :param int [limit]: the maximum number of order structures to retrieve
2668
+ :param dict [params]: extra parameters specific to the exchange API endpoint
2669
+ :param int [params.until]: the latest time in ms to fetch entries for
2670
+ :param int [params.orderId]: Only return subsequent orders, and return the latest order by default
2671
+ :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
2672
+ """
2673
+ self.load_markets()
2674
+ request = {}
2675
+ market = None
2676
+ if symbol is not None:
2677
+ market = self.market(symbol)
2678
+ request['symbol'] = market['id']
2679
+ type = None
2680
+ type, params = self.handle_market_type_and_params('fetchOrders', market, params)
2681
+ if type != 'swap':
2682
+ raise NotSupported(self.id + ' fetchOrders() is only supported for swap markets')
2683
+ if limit is not None:
2684
+ request['limit'] = limit
2685
+ if since is not None:
2686
+ request['startTime'] = since
2687
+ until = self.safe_integer_2(params, 'until', 'till') # unified in milliseconds
2688
+ endTime = self.safe_integer(params, 'endTime', until) # exchange-specific in milliseconds
2689
+ params = self.omit(params, ['endTime', 'till', 'until'])
2690
+ if endTime is not None:
2691
+ request['endTime'] = endTime
2692
+ response = self.swapV1PrivateGetTradeFullOrder(self.extend(request, params))
2693
+ #
2694
+ # {
2695
+ # "code": 0,
2696
+ # "msg": "",
2697
+ # "data": {
2698
+ # "orders": [
2699
+ # {
2700
+ # "symbol": "PYTH-USDT",
2701
+ # "orderId": 1736007506620112100,
2702
+ # "side": "SELL",
2703
+ # "positionSide": "SHORT",
2704
+ # "type": "LIMIT",
2705
+ # "origQty": "33",
2706
+ # "price": "0.3916",
2707
+ # "executedQty": "33",
2708
+ # "avgPrice": "0.3916",
2709
+ # "cumQuote": "13",
2710
+ # "stopPrice": "",
2711
+ # "profit": "0.0000",
2712
+ # "commission": "-0.002585",
2713
+ # "status": "FILLED",
2714
+ # "time": 1702731418000,
2715
+ # "updateTime": 1702731470000,
2716
+ # "clientOrderId": "",
2717
+ # "leverage": "15X",
2718
+ # "takeProfit": {
2719
+ # "type": "TAKE_PROFIT",
2720
+ # "quantity": 0,
2721
+ # "stopPrice": 0,
2722
+ # "price": 0,
2723
+ # "workingType": ""
2724
+ # },
2725
+ # "stopLoss": {
2726
+ # "type": "STOP",
2727
+ # "quantity": 0,
2728
+ # "stopPrice": 0,
2729
+ # "price": 0,
2730
+ # "workingType": ""
2731
+ # },
2732
+ # "advanceAttr": 0,
2733
+ # "positionID": 0,
2734
+ # "takeProfitEntrustPrice": 0,
2735
+ # "stopLossEntrustPrice": 0,
2736
+ # "orderType": "",
2737
+ # "workingType": "MARK_PRICE",
2738
+ # "stopGuaranteed": False,
2739
+ # "triggerOrderId": 1736012449498123500
2740
+ # }
2741
+ # ]
2742
+ # }
2743
+ # }
2744
+ #
2745
+ data = self.safe_dict(response, 'data', {})
2746
+ orders = self.safe_list(data, 'orders', [])
2747
+ return self.parse_orders(orders, market, since, limit)
2748
+
2657
2749
  def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
2658
2750
  """
2659
2751
  :see: https://bingx-api.github.io/docs/#/spot/trade-api.html#Query%20Open%20Orders
@@ -3306,6 +3398,7 @@ class bingx(Exchange, ImplicitAPI):
3306
3398
  'info': data,
3307
3399
  'symbol': self.safe_string(market, 'symbol'),
3308
3400
  'type': 'add' if (type == '1') else 'reduce',
3401
+ 'marginMode': 'isolated',
3309
3402
  'amount': self.safe_number(data, 'amount'),
3310
3403
  'total': self.safe_number(data, 'margin'),
3311
3404
  'code': self.safe_string(market, 'settle'),
ccxt/bit2c.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.bit2c import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Ticker, Trade
9
+ from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Ticker, Trade, TradingFees
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import PermissionDenied
@@ -360,7 +360,7 @@ class bit2c(Exchange, ImplicitAPI):
360
360
  raise ExchangeError(response)
361
361
  return self.parse_trades(response, market, since, limit)
362
362
 
363
- def fetch_trading_fees(self, params={}):
363
+ def fetch_trading_fees(self, params={}) -> TradingFees:
364
364
  """
365
365
  fetch the trading fees for multiple markets
366
366
  :see: https://bit2c.co.il/home/api#balance
ccxt/bitbank.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.bitbank import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Ticker, Trade, Transaction
9
+ from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Ticker, Trade, TradingFees, Transaction
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import PermissionDenied
@@ -390,7 +390,7 @@ class bitbank(Exchange, ImplicitAPI):
390
390
  trades = self.safe_list(data, 'transactions', [])
391
391
  return self.parse_trades(trades, market, since, limit)
392
392
 
393
- def fetch_trading_fees(self, params={}):
393
+ def fetch_trading_fees(self, params={}) -> TradingFees:
394
394
  """
395
395
  fetch the trading fees for multiple markets
396
396
  :see: https://github.com/bitbankinc/bitbank-api-docs/blob/38d6d7c6f486c793872fd4b4087a0d090a04cd0a/rest-api.md#get-all-pairs-info
ccxt/bitfinex.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.bitfinex import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
9
+ from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, 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 PermissionDenied
@@ -480,7 +480,7 @@ class bitfinex(Exchange, ImplicitAPI):
480
480
  'info': fee,
481
481
  }
482
482
 
483
- def fetch_trading_fees(self, params={}):
483
+ def fetch_trading_fees(self, params={}) -> TradingFees:
484
484
  """
485
485
  fetch the trading fees for multiple markets
486
486
  :see: https://docs.bitfinex.com/v1/reference/rest-auth-summary
ccxt/bitfinex2.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.bitfinex2 import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currency, Int, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
9
+ from ccxt.base.types import Balances, Currencies, Currency, Int, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, 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 PermissionDenied
@@ -630,7 +630,7 @@ class bitfinex2(Exchange, ImplicitAPI):
630
630
  })
631
631
  return result
632
632
 
633
- def fetch_currencies(self, params={}):
633
+ def fetch_currencies(self, params={}) -> Currencies:
634
634
  """
635
635
  fetches all available currencies on an exchange
636
636
  :see: https://docs.bitfinex.com/reference/rest-public-conf
@@ -2261,7 +2261,7 @@ class bitfinex2(Exchange, ImplicitAPI):
2261
2261
  },
2262
2262
  }
2263
2263
 
2264
- def fetch_trading_fees(self, params={}):
2264
+ def fetch_trading_fees(self, params={}) -> TradingFees:
2265
2265
  """
2266
2266
  fetch the trading fees for multiple markets
2267
2267
  :see: https://docs.bitfinex.com/reference/rest-auth-summary
@@ -3325,6 +3325,7 @@ class bitfinex2(Exchange, ImplicitAPI):
3325
3325
  'info': data,
3326
3326
  'symbol': market['symbol'],
3327
3327
  'type': None,
3328
+ 'marginMode': 'isolated',
3328
3329
  'amount': None,
3329
3330
  'total': None,
3330
3331
  'code': None,
ccxt/bitflyer.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.bitflyer import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currency, Int, Market, MarketInterface, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Trade, Transaction
9
+ from ccxt.base.types import Balances, Currency, Int, Market, MarketInterface, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Trade, TradingFeeInterface, Transaction
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import ArgumentsRequired
@@ -493,7 +493,7 @@ class bitflyer(Exchange, ImplicitAPI):
493
493
  #
494
494
  return self.parse_trades(response, market, since, limit)
495
495
 
496
- def fetch_trading_fee(self, symbol: str, params={}):
496
+ def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
497
497
  """
498
498
  fetch the trading fees for a market
499
499
  :see: https://lightning.bitflyer.com/docs?lang=en#get-trading-commission
@@ -518,6 +518,8 @@ class bitflyer(Exchange, ImplicitAPI):
518
518
  'symbol': market['symbol'],
519
519
  'maker': fee,
520
520
  'taker': fee,
521
+ 'percentage': None,
522
+ 'tierBased': None,
521
523
  }
522
524
 
523
525
  def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
ccxt/bitget.py CHANGED
@@ -7,7 +7,7 @@ from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.bitget import ImplicitAPI
8
8
  import hashlib
9
9
  import json
10
- from ccxt.base.types import Balances, Currency, FundingHistory, Int, Liquidation, Leverage, MarginMode, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
10
+ from ccxt.base.types import Balances, Currencies, Currency, FundingHistory, Int, Liquidation, Leverage, MarginMode, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import PermissionDenied
@@ -105,6 +105,7 @@ class bitget(Exchange, ImplicitAPI):
105
105
  'fetchLeverage': True,
106
106
  'fetchLeverageTiers': False,
107
107
  'fetchLiquidations': False,
108
+ 'fetchMarginAdjustmentHistory': False,
108
109
  'fetchMarginMode': True,
109
110
  'fetchMarketLeverageTiers': True,
110
111
  'fetchMarkets': True,
@@ -1813,7 +1814,7 @@ class bitget(Exchange, ImplicitAPI):
1813
1814
  data = self.safe_value(response, 'data', [])
1814
1815
  return self.parse_markets(data)
1815
1816
 
1816
- def fetch_currencies(self, params={}):
1817
+ def fetch_currencies(self, params={}) -> Currencies:
1817
1818
  """
1818
1819
  fetches all available currencies on an exchange
1819
1820
  :see: https://www.bitget.com/api-doc/spot/market/Get-Coin-List
@@ -2557,7 +2558,10 @@ class bitget(Exchange, ImplicitAPI):
2557
2558
  #
2558
2559
  marketId = self.safe_string(ticker, 'symbol')
2559
2560
  close = self.safe_string(ticker, 'lastPr')
2560
- timestamp = self.safe_integer(ticker, 'ts')
2561
+ timestampString = self.omit_zero(self.safe_string(ticker, 'ts')) # exchange sometimes provided 0
2562
+ timestamp = None
2563
+ if timestampString is not None:
2564
+ timestamp = self.parse_to_int(timestampString)
2561
2565
  change = self.safe_string(ticker, 'change24h')
2562
2566
  open24 = self.safe_string(ticker, 'open24')
2563
2567
  open = self.safe_string(ticker, 'open')
@@ -3004,7 +3008,7 @@ class bitget(Exchange, ImplicitAPI):
3004
3008
  data = self.safe_list(response, 'data', [])
3005
3009
  return self.parse_trades(data, market, since, limit)
3006
3010
 
3007
- def fetch_trading_fee(self, symbol: str, params={}):
3011
+ def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
3008
3012
  """
3009
3013
  fetch the trading fees for a market
3010
3014
  :see: https://www.bitget.com/api-doc/common/public/Get-Trade-Rate
@@ -3042,7 +3046,7 @@ class bitget(Exchange, ImplicitAPI):
3042
3046
  data = self.safe_value(response, 'data', {})
3043
3047
  return self.parse_trading_fee(data, market)
3044
3048
 
3045
- def fetch_trading_fees(self, params={}):
3049
+ def fetch_trading_fees(self, params={}) -> TradingFees:
3046
3050
  """
3047
3051
  fetch the trading fees for multiple markets
3048
3052
  :see: https://www.bitget.com/api-doc/spot/market/Get-Symbols
@@ -3162,6 +3166,8 @@ class bitget(Exchange, ImplicitAPI):
3162
3166
  'symbol': self.safe_symbol(marketId, market),
3163
3167
  'maker': self.safe_number(data, 'makerFeeRate'),
3164
3168
  'taker': self.safe_number(data, 'takerFeeRate'),
3169
+ 'percentage': None,
3170
+ 'tierBased': None,
3165
3171
  }
3166
3172
 
3167
3173
  def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
@@ -6480,6 +6486,7 @@ class bitget(Exchange, ImplicitAPI):
6480
6486
  'info': data,
6481
6487
  'symbol': market['symbol'],
6482
6488
  'type': None,
6489
+ 'marginMode': 'isolated',
6483
6490
  'amount': None,
6484
6491
  'total': None,
6485
6492
  'code': market['settle'],
ccxt/bitmart.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.bitmart import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
9
+ from ccxt.base.types import Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import PermissionDenied
@@ -985,7 +985,7 @@ class bitmart(Exchange, ImplicitAPI):
985
985
  contract = self.fetch_contract_markets(params)
986
986
  return self.array_concat(spot, contract)
987
987
 
988
- def fetch_currencies(self, params={}):
988
+ def fetch_currencies(self, params={}) -> Currencies:
989
989
  """
990
990
  fetches all available currencies on an exchange
991
991
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -1999,7 +1999,7 @@ class bitmart(Exchange, ImplicitAPI):
1999
1999
  #
2000
2000
  return self.custom_parse_balance(response, marketType)
2001
2001
 
2002
- def parse_trading_fee(self, fee, market: Market = None):
2002
+ def parse_trading_fee(self, fee, market: Market = None) -> TradingFeeInterface:
2003
2003
  #
2004
2004
  # {
2005
2005
  # "symbol": "ETH_USDT",
@@ -2014,9 +2014,11 @@ class bitmart(Exchange, ImplicitAPI):
2014
2014
  'symbol': symbol,
2015
2015
  'maker': self.safe_number(fee, 'maker_fee_rate'),
2016
2016
  'taker': self.safe_number(fee, 'taker_fee_rate'),
2017
+ 'percentage': None,
2018
+ 'tierBased': None,
2017
2019
  }
2018
2020
 
2019
- def fetch_trading_fee(self, symbol: str, params={}):
2021
+ def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
2020
2022
  """
2021
2023
  fetch the trading fees for a market
2022
2024
  :param str symbol: unified market symbol
ccxt/bitmex.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.bitmex import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currency, Int, Leverage, Leverages, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
9
+ from ccxt.base.types import Balances, Currencies, Currency, Int, Leverage, Leverages, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import PermissionDenied
@@ -75,6 +75,7 @@ class bitmex(Exchange, ImplicitAPI):
75
75
  'fetchLeverages': True,
76
76
  'fetchLeverageTiers': False,
77
77
  'fetchLiquidations': True,
78
+ 'fetchMarginAdjustmentHistory': False,
78
79
  'fetchMarketLeverageTiers': False,
79
80
  'fetchMarkets': True,
80
81
  'fetchMarkOHLCV': False,
@@ -290,7 +291,7 @@ class bitmex(Exchange, ImplicitAPI):
290
291
  },
291
292
  })
292
293
 
293
- def fetch_currencies(self, params={}):
294
+ def fetch_currencies(self, params={}) -> Currencies:
294
295
  """
295
296
  fetches all available currencies on an exchange
296
297
  :see: https://www.bitmex.com/api/explorer/#not /Wallet/Wallet_getAssetsConfig