ccxt 4.4.77__py2.py3-none-any.whl → 4.4.80__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. ccxt/__init__.py +3 -3
  2. ccxt/abstract/apex.py +31 -0
  3. ccxt/abstract/bitmart.py +1 -0
  4. ccxt/apex.py +1884 -0
  5. ccxt/ascendex.py +23 -6
  6. ccxt/async_support/__init__.py +3 -3
  7. ccxt/async_support/apex.py +1884 -0
  8. ccxt/async_support/ascendex.py +23 -6
  9. ccxt/async_support/base/exchange.py +5 -1
  10. ccxt/async_support/binance.py +9 -3
  11. ccxt/async_support/bingx.py +4 -4
  12. ccxt/async_support/bitfinex.py +61 -36
  13. ccxt/async_support/bitflyer.py +2 -2
  14. ccxt/async_support/bitget.py +186 -128
  15. ccxt/async_support/bitmart.py +9 -4
  16. ccxt/async_support/bitmex.py +14 -7
  17. ccxt/async_support/bitopro.py +5 -1
  18. ccxt/async_support/bitrue.py +2 -1
  19. ccxt/async_support/bitso.py +1 -1
  20. ccxt/async_support/bitteam.py +2 -0
  21. ccxt/async_support/bitvavo.py +25 -10
  22. ccxt/async_support/btcalpha.py +1 -1
  23. ccxt/async_support/btcmarkets.py +1 -1
  24. ccxt/async_support/btcturk.py +1 -1
  25. ccxt/async_support/bybit.py +27 -15
  26. ccxt/async_support/cex.py +1 -1
  27. ccxt/async_support/coinbase.py +17 -4
  28. ccxt/async_support/coincatch.py +66 -0
  29. ccxt/async_support/coinex.py +2 -1
  30. ccxt/async_support/coinlist.py +1 -0
  31. ccxt/async_support/coinone.py +1 -0
  32. ccxt/async_support/cryptocom.py +2 -2
  33. ccxt/async_support/defx.py +1 -1
  34. ccxt/async_support/delta.py +4 -1
  35. ccxt/async_support/deribit.py +3 -2
  36. ccxt/async_support/derive.py +2 -2
  37. ccxt/async_support/digifinex.py +2 -2
  38. ccxt/async_support/gate.py +1 -1
  39. ccxt/async_support/hitbtc.py +5 -2
  40. ccxt/async_support/hollaex.py +1 -0
  41. ccxt/async_support/htx.py +9 -5
  42. ccxt/async_support/huobijp.py +1 -0
  43. ccxt/async_support/hyperliquid.py +14 -6
  44. ccxt/async_support/kraken.py +4 -2
  45. ccxt/async_support/krakenfutures.py +2 -2
  46. ccxt/async_support/kucoinfutures.py +2 -2
  47. ccxt/async_support/mexc.py +50 -52
  48. ccxt/async_support/okx.py +2 -2
  49. ccxt/async_support/oxfun.py +2 -2
  50. ccxt/async_support/paradex.py +2 -2
  51. ccxt/async_support/phemex.py +4 -3
  52. ccxt/async_support/poloniex.py +4 -3
  53. ccxt/async_support/probit.py +1 -0
  54. ccxt/async_support/timex.py +2 -2
  55. ccxt/async_support/tradeogre.py +2 -1
  56. ccxt/async_support/upbit.py +243 -63
  57. ccxt/async_support/vertex.py +2 -2
  58. ccxt/async_support/whitebit.py +66 -12
  59. ccxt/async_support/woo.py +5 -3
  60. ccxt/async_support/woofipro.py +2 -2
  61. ccxt/async_support/xt.py +9 -2
  62. ccxt/base/exchange.py +69 -2
  63. ccxt/binance.py +9 -3
  64. ccxt/bingx.py +4 -4
  65. ccxt/bitfinex.py +61 -36
  66. ccxt/bitflyer.py +2 -2
  67. ccxt/bitget.py +186 -128
  68. ccxt/bitmart.py +9 -4
  69. ccxt/bitmex.py +14 -7
  70. ccxt/bitopro.py +5 -1
  71. ccxt/bitrue.py +2 -1
  72. ccxt/bitso.py +1 -1
  73. ccxt/bitteam.py +2 -0
  74. ccxt/bitvavo.py +25 -10
  75. ccxt/btcalpha.py +1 -1
  76. ccxt/btcmarkets.py +1 -1
  77. ccxt/btcturk.py +1 -1
  78. ccxt/bybit.py +27 -15
  79. ccxt/cex.py +1 -1
  80. ccxt/coinbase.py +17 -4
  81. ccxt/coincatch.py +66 -0
  82. ccxt/coinex.py +2 -1
  83. ccxt/coinlist.py +1 -0
  84. ccxt/coinone.py +1 -0
  85. ccxt/cryptocom.py +2 -2
  86. ccxt/defx.py +1 -1
  87. ccxt/delta.py +4 -1
  88. ccxt/deribit.py +3 -2
  89. ccxt/derive.py +2 -2
  90. ccxt/digifinex.py +2 -2
  91. ccxt/gate.py +1 -1
  92. ccxt/hitbtc.py +5 -2
  93. ccxt/hollaex.py +1 -0
  94. ccxt/htx.py +9 -5
  95. ccxt/huobijp.py +1 -0
  96. ccxt/hyperliquid.py +14 -6
  97. ccxt/kraken.py +4 -2
  98. ccxt/krakenfutures.py +2 -2
  99. ccxt/kucoinfutures.py +2 -2
  100. ccxt/mexc.py +50 -52
  101. ccxt/okx.py +2 -2
  102. ccxt/oxfun.py +2 -2
  103. ccxt/paradex.py +2 -2
  104. ccxt/phemex.py +4 -3
  105. ccxt/poloniex.py +4 -3
  106. ccxt/pro/__init__.py +5 -1
  107. ccxt/pro/apex.py +984 -0
  108. ccxt/pro/binance.py +3 -3
  109. ccxt/pro/coinbase.py +43 -57
  110. ccxt/pro/gate.py +22 -2
  111. ccxt/pro/hollaex.py +2 -2
  112. ccxt/pro/p2b.py +2 -2
  113. ccxt/pro/tradeogre.py +272 -0
  114. ccxt/pro/upbit.py +42 -0
  115. ccxt/probit.py +1 -0
  116. ccxt/test/tests_async.py +4 -1
  117. ccxt/test/tests_sync.py +4 -1
  118. ccxt/timex.py +2 -2
  119. ccxt/tradeogre.py +2 -1
  120. ccxt/upbit.py +243 -63
  121. ccxt/vertex.py +2 -2
  122. ccxt/whitebit.py +66 -12
  123. ccxt/woo.py +5 -3
  124. ccxt/woofipro.py +2 -2
  125. ccxt/xt.py +9 -2
  126. {ccxt-4.4.77.dist-info → ccxt-4.4.80.dist-info}/METADATA +9 -11
  127. {ccxt-4.4.77.dist-info → ccxt-4.4.80.dist-info}/RECORD +130 -128
  128. ccxt/abstract/ace.py +0 -15
  129. ccxt/ace.py +0 -1152
  130. ccxt/async_support/ace.py +0 -1152
  131. {ccxt-4.4.77.dist-info → ccxt-4.4.80.dist-info}/LICENSE.txt +0 -0
  132. {ccxt-4.4.77.dist-info → ccxt-4.4.80.dist-info}/WHEEL +0 -0
  133. {ccxt-4.4.77.dist-info → ccxt-4.4.80.dist-info}/top_level.txt +0 -0
ccxt/hitbtc.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.hitbtc import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Any, Balances, Currencies, Currency, DepositAddress, Int, Leverage, MarginMode, MarginModes, MarginModification, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, OrderBooks, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
9
+ from ccxt.base.types import Any, Balances, Currencies, Currency, DepositAddress, Int, Leverage, MarginMode, MarginModes, MarginModification, Market, Num, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, OrderBooks, Trade, TradingFeeInterface, 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
@@ -966,6 +966,8 @@ class hitbtc(Exchange, ImplicitAPI):
966
966
  transferEnabled = self.safe_bool(entry, 'transfer_enabled', False)
967
967
  active = payinEnabled and payoutEnabled and transferEnabled
968
968
  rawNetworks = self.safe_value(entry, 'networks', [])
969
+ isCrypto = self.safe_bool(entry, 'crypto')
970
+ type = 'crypto' if isCrypto else 'fiat'
969
971
  networks: dict = {}
970
972
  fee = None
971
973
  depositEnabled = None
@@ -1023,6 +1025,7 @@ class hitbtc(Exchange, ImplicitAPI):
1023
1025
  'max': None,
1024
1026
  },
1025
1027
  },
1028
+ 'type': type,
1026
1029
  }
1027
1030
  return result
1028
1031
 
@@ -2823,7 +2826,7 @@ class hitbtc(Exchange, ImplicitAPI):
2823
2826
  sorted = self.sort_by(rates, 'timestamp')
2824
2827
  return self.filter_by_symbol_since_limit(sorted, symbol, since, limit)
2825
2828
 
2826
- def fetch_positions(self, symbols: Strings = None, params={}):
2829
+ def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
2827
2830
  """
2828
2831
  fetch all open positions
2829
2832
 
ccxt/hollaex.py CHANGED
@@ -493,6 +493,7 @@ class hollaex(Exchange, ImplicitAPI):
493
493
  },
494
494
  },
495
495
  'networks': {},
496
+ 'type': 'crypto',
496
497
  }
497
498
  return result
498
499
 
ccxt/htx.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.htx import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Account, Any, Balances, BorrowInterest, Currencies, Currency, DepositAddress, Int, IsolatedBorrowRate, IsolatedBorrowRates, LedgerEntry, LeverageTier, LeverageTiers, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFeeInterface, Transaction, TransferEntry
9
+ from ccxt.base.types import Account, Any, Balances, BorrowInterest, Currencies, Currency, DepositAddress, Int, IsolatedBorrowRate, IsolatedBorrowRates, LedgerEntry, LeverageTier, LeverageTiers, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, 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 AuthenticationError
@@ -962,6 +962,7 @@ class htx(Exchange, ImplicitAPI):
962
962
  },
963
963
  'precisionMode': TICK_SIZE,
964
964
  'options': {
965
+ 'include_OS_certificates': False, # temporarily leave self, remove in future
965
966
  'fetchMarkets': {
966
967
  'types': {
967
968
  'spot': True,
@@ -2172,14 +2173,14 @@ class htx(Exchange, ImplicitAPI):
2172
2173
  ask = None
2173
2174
  askVolume = None
2174
2175
  if 'bid' in ticker:
2175
- if isinstance(ticker['bid'], list):
2176
+ if ticker['bid'] is not None and isinstance(ticker['bid'], list):
2176
2177
  bid = self.safe_string(ticker['bid'], 0)
2177
2178
  bidVolume = self.safe_string(ticker['bid'], 1)
2178
2179
  else:
2179
2180
  bid = self.safe_string(ticker, 'bid')
2180
2181
  bidVolume = self.safe_string(ticker, 'bidSize')
2181
2182
  if 'ask' in ticker:
2182
- if isinstance(ticker['ask'], list):
2183
+ if ticker['ask'] is not None and isinstance(ticker['ask'], list):
2183
2184
  ask = self.safe_string(ticker['ask'], 0)
2184
2185
  askVolume = self.safe_string(ticker['ask'], 1)
2185
2186
  else:
@@ -3270,7 +3271,7 @@ class htx(Exchange, ImplicitAPI):
3270
3271
  # "withdrawQuotaPerYear": null,
3271
3272
  # "withdrawQuotaTotal": null,
3272
3273
  # "withdrawFeeType": "fixed",
3273
- # "transactFeeWithdraw": "11.1653",
3274
+ # "transactFeeWithdraw": "11.1654",
3274
3275
  # "addrWithTag": False,
3275
3276
  # "addrDepositTag": False
3276
3277
  # }
@@ -3293,6 +3294,8 @@ class htx(Exchange, ImplicitAPI):
3293
3294
  chains = self.safe_value(entry, 'chains', [])
3294
3295
  networks: dict = {}
3295
3296
  instStatus = self.safe_string(entry, 'instStatus')
3297
+ assetType = self.safe_string(entry, 'assetType')
3298
+ type = assetType == 'crypto' if '1' else 'fiat'
3296
3299
  currencyActive = instStatus == 'normal'
3297
3300
  minPrecision = None
3298
3301
  minDeposit = None
@@ -3350,6 +3353,7 @@ class htx(Exchange, ImplicitAPI):
3350
3353
  'withdraw': withdraw,
3351
3354
  'fee': None,
3352
3355
  'name': None,
3356
+ 'type': type,
3353
3357
  'limits': {
3354
3358
  'amount': {
3355
3359
  'min': None,
@@ -7337,7 +7341,7 @@ class htx(Exchange, ImplicitAPI):
7337
7341
  'takeProfitPrice': None,
7338
7342
  })
7339
7343
 
7340
- def fetch_positions(self, symbols: Strings = None, params={}):
7344
+ def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
7341
7345
  """
7342
7346
  fetch all open positions
7343
7347
 
ccxt/huobijp.py CHANGED
@@ -1110,6 +1110,7 @@ class huobijp(Exchange, ImplicitAPI):
1110
1110
  'withdraw': withdrawEnabled,
1111
1111
  'fee': None, # todo need to fetch from fee endpoint
1112
1112
  'precision': precision,
1113
+ 'networks': None,
1113
1114
  'limits': {
1114
1115
  'amount': {
1115
1116
  'min': precision,
ccxt/hyperliquid.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.hyperliquid import ImplicitAPI
8
8
  import math
9
- from ccxt.base.types import Any, Balances, Currencies, Currency, Int, LedgerEntry, MarginModification, Market, Num, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFeeInterface, Transaction, TransferEntry
9
+ from ccxt.base.types import Any, Balances, Currencies, Currency, Int, LedgerEntry, MarginModification, Market, Num, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, 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 ArgumentsRequired
@@ -379,6 +379,7 @@ class hyperliquid(Exchange, ImplicitAPI):
379
379
  'withdraw': None,
380
380
  'networks': None,
381
381
  'fee': None,
382
+ 'type': 'crypto',
382
383
  'limits': {
383
384
  'amount': {
384
385
  'min': None,
@@ -771,12 +772,15 @@ class hyperliquid(Exchange, ImplicitAPI):
771
772
  :param dict [params]: extra parameters specific to the exchange API endpoint
772
773
  :param str [params.user]: user address, will default to self.walletAddress if not provided
773
774
  :param str [params.type]: wallet type, ['spot', 'swap'], defaults to swap
775
+ :param str [params.marginMode]: 'cross' or 'isolated', for margin trading, uses self.options.defaultMarginMode if not passed, defaults to None/None/None
774
776
  :returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
775
777
  """
776
778
  userAddress = None
777
779
  userAddress, params = self.handle_public_address('fetchBalance', params)
778
780
  type = None
779
781
  type, params = self.handle_market_type_and_params('fetchBalance', None, params)
782
+ marginMode = None
783
+ marginMode, params = self.handle_margin_mode_and_params('fetchBalance', params)
780
784
  isSpot = (type == 'spot')
781
785
  reqType = 'spotClearinghouseState' if (isSpot) else 'clearinghouseState'
782
786
  request: dict = {
@@ -833,12 +837,16 @@ class hyperliquid(Exchange, ImplicitAPI):
833
837
  spotBalances[code] = account
834
838
  return self.safe_balance(spotBalances)
835
839
  data = self.safe_dict(response, 'marginSummary', {})
840
+ usdcBalance = {
841
+ 'total': self.safe_number(data, 'accountValue'),
842
+ }
843
+ if (marginMode is not None) and (marginMode == 'isolated'):
844
+ usdcBalance['free'] = self.safe_number(response, 'withdrawable')
845
+ else:
846
+ usdcBalance['used'] = self.safe_number(data, 'totalMarginUsed')
836
847
  result: dict = {
837
848
  'info': response,
838
- 'USDC': {
839
- 'total': self.safe_number(data, 'accountValue'),
840
- 'used': self.safe_number(data, 'totalMarginUsed'),
841
- },
849
+ 'USDC': usdcBalance,
842
850
  }
843
851
  timestamp = self.safe_integer(response, 'time')
844
852
  result['timestamp'] = timestamp
@@ -2452,7 +2460,7 @@ class hyperliquid(Exchange, ImplicitAPI):
2452
2460
  positions = self.fetch_positions([symbol], params)
2453
2461
  return self.safe_dict(positions, 0, {})
2454
2462
 
2455
- def fetch_positions(self, symbols: Strings = None, params={}):
2463
+ def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
2456
2464
  """
2457
2465
  fetch all open positions
2458
2466
 
ccxt/kraken.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.kraken import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Any, Balances, Currencies, Currency, DepositAddress, IndexType, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
9
+ from ccxt.base.types import Any, Balances, Currencies, Currency, DepositAddress, IndexType, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderSide, OrderType, Position, 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 AuthenticationError
@@ -864,12 +864,14 @@ class kraken(Exchange, ImplicitAPI):
864
864
  precision = self.parse_number(self.parse_precision(self.safe_string(currency, 'decimals')))
865
865
  # assumes all currencies are active except those listed above
866
866
  active = self.safe_string(currency, 'status') == 'enabled'
867
+ isFiat = code.find('.HOLD') >= 0
867
868
  result[code] = {
868
869
  'id': id,
869
870
  'code': code,
870
871
  'info': currency,
871
872
  'name': self.safe_string(currency, 'altname'),
872
873
  'active': active,
874
+ 'type': 'fiat' if isFiat else 'crypto',
873
875
  'deposit': None,
874
876
  'withdraw': None,
875
877
  'fee': None,
@@ -3067,7 +3069,7 @@ class kraken(Exchange, ImplicitAPI):
3067
3069
  return self.parse_transaction(result, currency)
3068
3070
  raise ExchangeError(self.id + " withdraw() requires a 'key' parameter(withdrawal key name, up on your account)")
3069
3071
 
3070
- def fetch_positions(self, symbols: Strings = None, params={}):
3072
+ def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
3071
3073
  """
3072
3074
  fetch all open positions
3073
3075
 
ccxt/krakenfutures.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.krakenfutures import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Any, Balances, Currency, Int, Leverage, Leverages, LeverageTier, LeverageTiers, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TransferEntry
9
+ from ccxt.base.types import Any, Balances, Currency, Int, Leverage, Leverages, LeverageTier, LeverageTiers, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import AuthenticationError
@@ -2287,7 +2287,7 @@ class krakenfutures(Exchange, ImplicitAPI):
2287
2287
  sorted = self.sort_by(result, 'timestamp')
2288
2288
  return self.filter_by_symbol_since_limit(sorted, symbol, since, limit)
2289
2289
 
2290
- def fetch_positions(self, symbols: Strings = None, params={}):
2290
+ def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
2291
2291
  """
2292
2292
 
2293
2293
  https://docs.futures.kraken.com/#http-api-trading-v3-api-account-information-get-open-positions
ccxt/kucoinfutures.py CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  from ccxt.kucoin import kucoin
7
7
  from ccxt.abstract.kucoinfutures import ImplicitAPI
8
- from ccxt.base.types import Any, Balances, Currency, DepositAddress, Int, Leverage, LeverageTier, MarginMode, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, Trade, TradingFeeInterface, Transaction, TransferEntry
8
+ from ccxt.base.types import Any, Balances, Currency, DepositAddress, Int, Leverage, LeverageTier, MarginMode, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, Trade, TradingFeeInterface, Transaction, TransferEntry
9
9
  from typing import List
10
10
  from ccxt.base.errors import AuthenticationError
11
11
  from ccxt.base.errors import PermissionDenied
@@ -1232,7 +1232,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
1232
1232
  data = self.safe_dict(response, 'data', {})
1233
1233
  return self.parse_position(data, market)
1234
1234
 
1235
- def fetch_positions(self, symbols: Strings = None, params={}):
1235
+ def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
1236
1236
  """
1237
1237
  fetch all open positions
1238
1238
 
ccxt/mexc.py CHANGED
@@ -1097,80 +1097,47 @@ class mexc(Exchange, ImplicitAPI):
1097
1097
  id = self.safe_string(currency, 'coin')
1098
1098
  code = self.safe_currency_code(id)
1099
1099
  name = self.safe_string(currency, 'name')
1100
- currencyActive = False
1101
- currencyFee = None
1102
- currencyWithdrawMin = None
1103
- currencyWithdrawMax = None
1104
- depositEnabled = False
1105
- withdrawEnabled = False
1106
1100
  networks: dict = {}
1107
1101
  chains = self.safe_value(currency, 'networkList', [])
1108
1102
  for j in range(0, len(chains)):
1109
1103
  chain = chains[j]
1110
1104
  networkId = self.safe_string_2(chain, 'netWork', 'network')
1111
1105
  network = self.network_id_to_code(networkId)
1112
- isDepositEnabled = self.safe_bool(chain, 'depositEnable', False)
1113
- isWithdrawEnabled = self.safe_bool(chain, 'withdrawEnable', False)
1114
- active = (isDepositEnabled and isWithdrawEnabled)
1115
- currencyActive = active or currencyActive
1116
- withdrawMin = self.safe_string(chain, 'withdrawMin')
1117
- withdrawMax = self.safe_string(chain, 'withdrawMax')
1118
- currencyWithdrawMin = withdrawMin if (currencyWithdrawMin is None) else currencyWithdrawMin
1119
- currencyWithdrawMax = withdrawMax if (currencyWithdrawMax is None) else currencyWithdrawMax
1120
- fee = self.safe_number(chain, 'withdrawFee')
1121
- currencyFee = fee if (currencyFee is None) else currencyFee
1122
- if Precise.string_gt(currencyWithdrawMin, withdrawMin):
1123
- currencyWithdrawMin = withdrawMin
1124
- if Precise.string_lt(currencyWithdrawMax, withdrawMax):
1125
- currencyWithdrawMax = withdrawMax
1126
- if isDepositEnabled:
1127
- depositEnabled = True
1128
- if isWithdrawEnabled:
1129
- withdrawEnabled = True
1130
1106
  networks[network] = {
1131
1107
  'info': chain,
1132
1108
  'id': networkId,
1133
1109
  'network': network,
1134
- 'active': active,
1135
- 'deposit': isDepositEnabled,
1136
- 'withdraw': isWithdrawEnabled,
1137
- 'fee': fee,
1110
+ 'active': None,
1111
+ 'deposit': self.safe_bool(chain, 'depositEnable', False),
1112
+ 'withdraw': self.safe_bool(chain, 'withdrawEnable', False),
1113
+ 'fee': self.safe_number(chain, 'withdrawFee'),
1138
1114
  'precision': None,
1139
1115
  'limits': {
1140
1116
  'withdraw': {
1141
- 'min': withdrawMin,
1142
- 'max': withdrawMax,
1117
+ 'min': self.safe_string(chain, 'withdrawMin'),
1118
+ 'max': self.safe_string(chain, 'withdrawMax'),
1143
1119
  },
1144
1120
  },
1145
1121
  }
1146
- networkKeys = list(networks.keys())
1147
- networkKeysLength = len(networkKeys)
1148
- if (networkKeysLength == 1) or ('NONE' in networks):
1149
- defaultNetwork = self.safe_value_2(networks, 'NONE', networkKeysLength - 1)
1150
- if defaultNetwork is not None:
1151
- currencyFee = defaultNetwork['fee']
1152
- result[code] = {
1122
+ result[code] = self.safe_currency_structure({
1153
1123
  'info': currency,
1154
1124
  'id': id,
1155
1125
  'code': code,
1156
1126
  'name': name,
1157
- 'active': currencyActive,
1158
- 'deposit': depositEnabled,
1159
- 'withdraw': withdrawEnabled,
1160
- 'fee': currencyFee,
1127
+ 'active': None,
1128
+ 'deposit': None,
1129
+ 'withdraw': None,
1130
+ 'fee': None,
1161
1131
  'precision': None,
1162
1132
  'limits': {
1163
1133
  'amount': {
1164
1134
  'min': None,
1165
1135
  'max': None,
1166
1136
  },
1167
- 'withdraw': {
1168
- 'min': currencyWithdrawMin,
1169
- 'max': currencyWithdrawMax,
1170
- },
1171
1137
  },
1138
+ 'type': 'crypto',
1172
1139
  'networks': networks,
1173
- }
1140
+ })
1174
1141
  return result
1175
1142
 
1176
1143
  def fetch_markets(self, params={}) -> List[Market]:
@@ -3253,13 +3220,27 @@ class mexc(Exchange, ImplicitAPI):
3253
3220
 
3254
3221
  def parse_order(self, order: dict, market: Market = None) -> Order:
3255
3222
  #
3256
- # spot: createOrder
3223
+ # spot
3224
+ # createOrder
3257
3225
  #
3258
- # {
3226
+ # {
3227
+ # "symbol": "FARTCOINUSDT",
3228
+ # "orderId": "C02__342252993005723644225",
3229
+ # "orderListId": "-1",
3230
+ # "price": "1.1",
3231
+ # "origQty": "6.3",
3232
+ # "type": "IMMEDIATE_OR_CANCEL",
3233
+ # "side": "SELL",
3234
+ # "transactTime": "1745852205223"
3235
+ # }
3236
+ #
3237
+ # unknown endpoint on spot
3238
+ #
3239
+ # {
3259
3240
  # "symbol": "BTCUSDT",
3260
3241
  # "orderId": "123738410679123456",
3261
3242
  # "orderListId": -1
3262
- # }
3243
+ # }
3263
3244
  #
3264
3245
  # margin: createOrder
3265
3246
  #
@@ -3421,6 +3402,10 @@ class mexc(Exchange, ImplicitAPI):
3421
3402
  id = order
3422
3403
  else:
3423
3404
  id = self.safe_string_2(order, 'orderId', 'id')
3405
+ timeInForce = self.parse_order_time_in_force(self.safe_string(order, 'timeInForce'))
3406
+ typeRaw = self.safe_string(order, 'type')
3407
+ if timeInForce is None:
3408
+ timeInForce = self.get_tif_from_raw_order_type(typeRaw)
3424
3409
  marketId = self.safe_string(order, 'symbol')
3425
3410
  market = self.safe_market(marketId, market)
3426
3411
  timestamp = self.safe_integer_n(order, ['time', 'createTime', 'transactTime'])
@@ -3442,8 +3427,8 @@ class mexc(Exchange, ImplicitAPI):
3442
3427
  'lastTradeTimestamp': None, # TODO: self might be 'updateTime' if order-status is filled, otherwise cancellation time. needs to be checked
3443
3428
  'status': self.parse_order_status(self.safe_string_2(order, 'status', 'state')),
3444
3429
  'symbol': market['symbol'],
3445
- 'type': self.parse_order_type(self.safe_string(order, 'type')),
3446
- 'timeInForce': self.parse_order_time_in_force(self.safe_string(order, 'timeInForce')),
3430
+ 'type': self.parse_order_type(typeRaw),
3431
+ 'timeInForce': timeInForce,
3447
3432
  'side': self.parse_order_side(self.safe_string(order, 'side')),
3448
3433
  'price': self.safe_number(order, 'price'),
3449
3434
  'triggerPrice': self.safe_number_2(order, 'stopPrice', 'triggerPrice'),
@@ -3472,6 +3457,9 @@ class mexc(Exchange, ImplicitAPI):
3472
3457
  'MARKET': 'market',
3473
3458
  'LIMIT': 'limit',
3474
3459
  'LIMIT_MAKER': 'limit',
3460
+ # on spot, during submission below types are used only accepted order
3461
+ 'IMMEDIATE_OR_CANCEL': 'limit',
3462
+ 'FILL_OR_KILL': 'limit',
3475
3463
  }
3476
3464
  return self.safe_string(statuses, status, status)
3477
3465
 
@@ -3499,6 +3487,16 @@ class mexc(Exchange, ImplicitAPI):
3499
3487
  }
3500
3488
  return self.safe_string(statuses, status, status)
3501
3489
 
3490
+ def get_tif_from_raw_order_type(self, orderType: Str = None):
3491
+ statuses: dict = {
3492
+ 'LIMIT': 'GTC',
3493
+ 'LIMIT_MAKER': 'POST_ONLY',
3494
+ 'IMMEDIATE_OR_CANCEL': 'IOC',
3495
+ 'FILL_OR_KILL': 'FOK',
3496
+ 'MARKET': 'IOC',
3497
+ }
3498
+ return self.safe_string(statuses, orderType, orderType)
3499
+
3502
3500
  def fetch_account_helper(self, type, params):
3503
3501
  if type == 'spot':
3504
3502
  return self.spotPrivateGetAccount(params)
@@ -4849,7 +4847,7 @@ class mexc(Exchange, ImplicitAPI):
4849
4847
  response = self.fetch_positions(None, self.extend(request, params))
4850
4848
  return self.safe_value(response, 0)
4851
4849
 
4852
- def fetch_positions(self, symbols: Strings = None, params={}):
4850
+ def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
4853
4851
  """
4854
4852
  fetch all open positions
4855
4853
 
ccxt/okx.py CHANGED
@@ -4831,7 +4831,7 @@ class okx(Exchange, ImplicitAPI):
4831
4831
  :returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
4832
4832
  """
4833
4833
  self.load_markets()
4834
- rawNetwork = self.safe_string_upper(params, 'network')
4834
+ rawNetwork = self.safe_string(params, 'network') # some networks are like "Dora Vota Mainnet"
4835
4835
  params = self.omit(params, 'network')
4836
4836
  code = self.safe_currency_code(code)
4837
4837
  network = self.network_id_to_code(rawNetwork, code)
@@ -5401,7 +5401,7 @@ class okx(Exchange, ImplicitAPI):
5401
5401
  return None
5402
5402
  return self.parse_position(position, market)
5403
5403
 
5404
- def fetch_positions(self, symbols: Strings = None, params={}):
5404
+ def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
5405
5405
  """
5406
5406
 
5407
5407
  https://www.okx.com/docs-v5/en/#rest-api-account-get-positions
ccxt/oxfun.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.oxfun import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Account, Any, Balances, Bool, Currencies, Currency, DepositAddress, Int, LeverageTier, LeverageTiers, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, Transaction, TransferEntry
9
+ from ccxt.base.types import Account, Any, Balances, Bool, Currencies, Currency, DepositAddress, Int, LeverageTier, LeverageTiers, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import AuthenticationError
@@ -2129,7 +2129,7 @@ class oxfun(Exchange, ImplicitAPI):
2129
2129
  data['type'] = 'withdrawal'
2130
2130
  return self.parse_transaction(data, currency)
2131
2131
 
2132
- def fetch_positions(self, symbols: Strings = None, params={}):
2132
+ def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
2133
2133
  """
2134
2134
  fetch all open positions
2135
2135
 
ccxt/paradex.py CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.paradex import ImplicitAPI
8
- from ccxt.base.types import Any, Balances, Currency, Int, Leverage, MarginMode, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
8
+ from ccxt.base.types import Any, Balances, Currency, Int, Leverage, MarginMode, Market, Num, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, Transaction
9
9
  from typing import List
10
10
  from ccxt.base.errors import ExchangeError
11
11
  from ccxt.base.errors import AuthenticationError
@@ -1815,7 +1815,7 @@ class paradex(Exchange, ImplicitAPI):
1815
1815
  positions = self.fetch_positions([market['symbol']], params)
1816
1816
  return self.safe_dict(positions, 0, {})
1817
1817
 
1818
- def fetch_positions(self, symbols: Strings = None, params={}):
1818
+ def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
1819
1819
  """
1820
1820
  fetch all open positions
1821
1821
 
ccxt/phemex.py CHANGED
@@ -7,7 +7,7 @@ from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.phemex import ImplicitAPI
8
8
  import hashlib
9
9
  import numbers
10
- from ccxt.base.types import Any, Balances, Conversion, Currencies, Currency, DepositAddress, Int, LeverageTier, LeverageTiers, MarginModification, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, Trade, Transaction, TransferEntry
10
+ from ccxt.base.types import Any, Balances, Conversion, Currencies, Currency, DepositAddress, Int, LeverageTier, LeverageTiers, MarginModification, Market, Num, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, Trade, Transaction, TransferEntry
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import AuthenticationError
@@ -1166,7 +1166,8 @@ class phemex(Exchange, ImplicitAPI):
1166
1166
  },
1167
1167
  },
1168
1168
  'valueScale': valueScale,
1169
- 'networks': {},
1169
+ 'networks': None,
1170
+ 'type': 'crypto',
1170
1171
  }
1171
1172
  return result
1172
1173
 
@@ -3570,7 +3571,7 @@ class phemex(Exchange, ImplicitAPI):
3570
3571
  'fee': fee,
3571
3572
  }
3572
3573
 
3573
- def fetch_positions(self, symbols: Strings = None, params={}):
3574
+ def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
3574
3575
  """
3575
3576
  fetch all open positions
3576
3577
 
ccxt/poloniex.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.poloniex import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Any, Balances, Bool, Currencies, Currency, DepositAddress, Int, Leverage, MarginModification, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry
9
+ from ccxt.base.types import Any, Balances, Bool, Currencies, Currency, DepositAddress, Int, Leverage, MarginModification, Market, Num, Order, OrderBook, 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
@@ -1203,6 +1203,7 @@ class poloniex(Exchange, ImplicitAPI):
1203
1203
  'withdraw': withdrawEnabled,
1204
1204
  'fee': self.parse_number(feeString),
1205
1205
  'precision': None,
1206
+ 'type': 'crypto',
1206
1207
  'limits': {
1207
1208
  'amount': {
1208
1209
  'min': None,
@@ -1827,7 +1828,7 @@ class poloniex(Exchange, ImplicitAPI):
1827
1828
  isTrigger = self.safe_value_2(params, 'trigger', 'stop')
1828
1829
  params = self.omit(params, ['trigger', 'stop'])
1829
1830
  response = None
1830
- if not market['spot']:
1831
+ if marketType != 'spot':
1831
1832
  raw = self.swapPrivateGetV3TradeOrderOpens(self.extend(request, params))
1832
1833
  #
1833
1834
  # {
@@ -3284,7 +3285,7 @@ class poloniex(Exchange, ImplicitAPI):
3284
3285
  #
3285
3286
  return response
3286
3287
 
3287
- def fetch_positions(self, symbols: Strings = None, params={}):
3288
+ def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
3288
3289
  """
3289
3290
  fetch all open positions
3290
3291
 
ccxt/pro/__init__.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # ----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.4.77'
7
+ __version__ = '4.4.80'
8
8
 
9
9
  # ----------------------------------------------------------------------------
10
10
 
@@ -13,6 +13,7 @@ from ccxt.async_support.base.exchange import Exchange # noqa: F401
13
13
  # CCXT Pro exchanges (now this is mainly used for importing exchanges in WS tests)
14
14
 
15
15
  from ccxt.pro.alpaca import alpaca # noqa: F401
16
+ from ccxt.pro.apex import apex # noqa: F401
16
17
  from ccxt.pro.ascendex import ascendex # noqa: F401
17
18
  from ccxt.pro.bequant import bequant # noqa: F401
18
19
  from ccxt.pro.binance import binance # noqa: F401
@@ -76,6 +77,7 @@ from ccxt.pro.paradex import paradex # noqa
76
77
  from ccxt.pro.phemex import phemex # noqa: F401
77
78
  from ccxt.pro.poloniex import poloniex # noqa: F401
78
79
  from ccxt.pro.probit import probit # noqa: F401
80
+ from ccxt.pro.tradeogre import tradeogre # noqa: F401
79
81
  from ccxt.pro.upbit import upbit # noqa: F401
80
82
  from ccxt.pro.vertex import vertex # noqa: F401
81
83
  from ccxt.pro.whitebit import whitebit # noqa: F401
@@ -85,6 +87,7 @@ from ccxt.pro.xt import xt # noqa
85
87
 
86
88
  exchanges = [
87
89
  'alpaca',
90
+ 'apex',
88
91
  'ascendex',
89
92
  'bequant',
90
93
  'binance',
@@ -148,6 +151,7 @@ exchanges = [
148
151
  'phemex',
149
152
  'poloniex',
150
153
  'probit',
154
+ 'tradeogre',
151
155
  'upbit',
152
156
  'vertex',
153
157
  'whitebit',