ccxt 4.4.88__py2.py3-none-any.whl → 4.4.91__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 (101) hide show
  1. ccxt/__init__.py +1 -3
  2. ccxt/abstract/bitget.py +58 -0
  3. ccxt/abstract/bitrue.py +65 -65
  4. ccxt/abstract/cryptocom.py +2 -0
  5. ccxt/abstract/luno.py +1 -0
  6. ccxt/async_support/__init__.py +1 -3
  7. ccxt/async_support/base/exchange.py +6 -3
  8. ccxt/async_support/base/ws/client.py +173 -64
  9. ccxt/async_support/base/ws/future.py +23 -50
  10. ccxt/async_support/binance.py +2 -2
  11. ccxt/async_support/bingx.py +55 -29
  12. ccxt/async_support/bitget.py +469 -147
  13. ccxt/async_support/bitmex.py +2 -1
  14. ccxt/async_support/bitrue.py +72 -66
  15. ccxt/async_support/bitvavo.py +34 -0
  16. ccxt/async_support/btcalpha.py +35 -0
  17. ccxt/async_support/btcbox.py +35 -0
  18. ccxt/async_support/btcmarkets.py +35 -0
  19. ccxt/async_support/btcturk.py +35 -0
  20. ccxt/async_support/bybit.py +9 -3
  21. ccxt/async_support/cex.py +61 -0
  22. ccxt/async_support/coinbase.py +1 -3
  23. ccxt/async_support/cryptocom.py +66 -2
  24. ccxt/async_support/cryptomus.py +1 -1
  25. ccxt/async_support/delta.py +2 -2
  26. ccxt/async_support/digifinex.py +39 -99
  27. ccxt/async_support/exmo.py +14 -7
  28. ccxt/async_support/gate.py +14 -7
  29. ccxt/async_support/hashkey.py +15 -28
  30. ccxt/async_support/hollaex.py +27 -22
  31. ccxt/async_support/hyperliquid.py +104 -53
  32. ccxt/async_support/kraken.py +54 -50
  33. ccxt/async_support/luno.py +87 -1
  34. ccxt/async_support/mexc.py +1 -0
  35. ccxt/async_support/modetrade.py +2 -2
  36. ccxt/async_support/okx.py +2 -1
  37. ccxt/async_support/paradex.py +1 -1
  38. ccxt/async_support/phemex.py +16 -8
  39. ccxt/async_support/tradeogre.py +3 -3
  40. ccxt/async_support/xt.py +1 -1
  41. ccxt/base/exchange.py +20 -8
  42. ccxt/binance.py +2 -2
  43. ccxt/bingx.py +55 -29
  44. ccxt/bitget.py +469 -147
  45. ccxt/bitmex.py +2 -1
  46. ccxt/bitrue.py +72 -66
  47. ccxt/bitvavo.py +34 -0
  48. ccxt/btcalpha.py +35 -0
  49. ccxt/btcbox.py +35 -0
  50. ccxt/btcmarkets.py +35 -0
  51. ccxt/btcturk.py +35 -0
  52. ccxt/bybit.py +9 -3
  53. ccxt/cex.py +61 -0
  54. ccxt/coinbase.py +1 -3
  55. ccxt/cryptocom.py +66 -2
  56. ccxt/cryptomus.py +1 -1
  57. ccxt/delta.py +2 -2
  58. ccxt/digifinex.py +39 -99
  59. ccxt/exmo.py +13 -7
  60. ccxt/gate.py +14 -7
  61. ccxt/hashkey.py +15 -28
  62. ccxt/hollaex.py +27 -22
  63. ccxt/hyperliquid.py +104 -53
  64. ccxt/kraken.py +53 -50
  65. ccxt/luno.py +87 -1
  66. ccxt/mexc.py +1 -0
  67. ccxt/modetrade.py +2 -2
  68. ccxt/okx.py +2 -1
  69. ccxt/paradex.py +1 -1
  70. ccxt/phemex.py +16 -8
  71. ccxt/pro/__init__.py +1 -127
  72. ccxt/pro/bitstamp.py +1 -1
  73. ccxt/pro/bybit.py +6 -136
  74. ccxt/pro/coinbase.py +2 -0
  75. ccxt/pro/cryptocom.py +27 -0
  76. ccxt/pro/kraken.py +249 -267
  77. ccxt/pro/mexc.py +0 -1
  78. ccxt/tradeogre.py +3 -3
  79. ccxt/xt.py +1 -1
  80. {ccxt-4.4.88.dist-info → ccxt-4.4.91.dist-info}/METADATA +64 -23
  81. {ccxt-4.4.88.dist-info → ccxt-4.4.91.dist-info}/RECORD +84 -101
  82. ccxt/abstract/coinlist.py +0 -57
  83. ccxt/async_support/base/ws/aiohttp_client.py +0 -147
  84. ccxt/async_support/bitcoincom.py +0 -18
  85. ccxt/async_support/bitfinex1.py +0 -1711
  86. ccxt/async_support/bitpanda.py +0 -17
  87. ccxt/async_support/coinlist.py +0 -2542
  88. ccxt/async_support/poloniexfutures.py +0 -1875
  89. ccxt/bitcoincom.py +0 -18
  90. ccxt/bitfinex1.py +0 -1710
  91. ccxt/bitpanda.py +0 -17
  92. ccxt/coinlist.py +0 -2542
  93. ccxt/poloniexfutures.py +0 -1875
  94. ccxt/pro/bitcoincom.py +0 -35
  95. ccxt/pro/bitfinex1.py +0 -635
  96. ccxt/pro/bitpanda.py +0 -16
  97. ccxt/pro/poloniexfutures.py +0 -1004
  98. ccxt/pro/wazirx.py +0 -766
  99. {ccxt-4.4.88.dist-info → ccxt-4.4.91.dist-info}/LICENSE.txt +0 -0
  100. {ccxt-4.4.88.dist-info → ccxt-4.4.91.dist-info}/WHEEL +0 -0
  101. {ccxt-4.4.88.dist-info → ccxt-4.4.91.dist-info}/top_level.txt +0 -0
ccxt/btcturk.py CHANGED
@@ -34,35 +34,64 @@ class btcturk(Exchange, ImplicitAPI):
34
34
  'future': False,
35
35
  'option': False,
36
36
  'addMargin': False,
37
+ 'borrowCrossMargin': False,
38
+ 'borrowIsolatedMargin': False,
39
+ 'borrowMargin': False,
37
40
  'cancelOrder': True,
38
41
  'closeAllPositions': False,
39
42
  'closePosition': False,
40
43
  'createDepositAddress': False,
41
44
  'createOrder': True,
45
+ 'createOrderWithTakeProfitAndStopLoss': False,
46
+ 'createOrderWithTakeProfitAndStopLossWs': False,
47
+ 'createPostOnlyOrder': False,
42
48
  'createReduceOnlyOrder': False,
43
49
  'fetchBalance': True,
50
+ 'fetchBorrowInterest': False,
51
+ 'fetchBorrowRate': False,
44
52
  'fetchBorrowRateHistories': False,
45
53
  'fetchBorrowRateHistory': False,
54
+ 'fetchBorrowRates': False,
55
+ 'fetchBorrowRatesPerSymbol': False,
46
56
  'fetchCrossBorrowRate': False,
47
57
  'fetchCrossBorrowRates': False,
48
58
  'fetchDepositAddress': False,
49
59
  'fetchDepositAddresses': False,
50
60
  'fetchDepositAddressesByNetwork': False,
51
61
  'fetchFundingHistory': False,
62
+ 'fetchFundingInterval': False,
63
+ 'fetchFundingIntervals': False,
52
64
  'fetchFundingRate': False,
53
65
  'fetchFundingRateHistory': False,
54
66
  'fetchFundingRates': False,
67
+ 'fetchGreeks': False,
55
68
  'fetchIndexOHLCV': False,
56
69
  'fetchIsolatedBorrowRate': False,
57
70
  'fetchIsolatedBorrowRates': False,
71
+ 'fetchIsolatedPositions': False,
58
72
  'fetchLeverage': False,
73
+ 'fetchLeverages': False,
74
+ 'fetchLeverageTiers': False,
75
+ 'fetchLiquidations': False,
76
+ 'fetchLongShortRatio': False,
77
+ 'fetchLongShortRatioHistory': False,
78
+ 'fetchMarginAdjustmentHistory': False,
59
79
  'fetchMarginMode': False,
80
+ 'fetchMarginModes': False,
81
+ 'fetchMarketLeverageTiers': False,
60
82
  'fetchMarkets': True,
61
83
  'fetchMarkOHLCV': False,
84
+ 'fetchMarkPrices': False,
85
+ 'fetchMyLiquidations': False,
86
+ 'fetchMySettlementHistory': False,
62
87
  'fetchMyTrades': True,
63
88
  'fetchOHLCV': True,
89
+ 'fetchOpenInterest': False,
64
90
  'fetchOpenInterestHistory': False,
91
+ 'fetchOpenInterests': False,
65
92
  'fetchOpenOrders': True,
93
+ 'fetchOption': False,
94
+ 'fetchOptionChain': False,
66
95
  'fetchOrderBook': True,
67
96
  'fetchOrders': True,
68
97
  'fetchPosition': False,
@@ -73,11 +102,17 @@ class btcturk(Exchange, ImplicitAPI):
73
102
  'fetchPositionsHistory': False,
74
103
  'fetchPositionsRisk': False,
75
104
  'fetchPremiumIndexOHLCV': False,
105
+ 'fetchSettlementHistory': False,
76
106
  'fetchTicker': True,
77
107
  'fetchTickers': True,
78
108
  'fetchTrades': True,
109
+ 'fetchVolatilityHistory': False,
79
110
  'reduceMargin': False,
111
+ 'repayCrossMargin': False,
112
+ 'repayIsolatedMargin': False,
113
+ 'repayMargin': False,
80
114
  'setLeverage': False,
115
+ 'setMargin': False,
81
116
  'setMarginMode': False,
82
117
  'setPositionMode': False,
83
118
  'ws': False,
ccxt/bybit.py CHANGED
@@ -3675,7 +3675,10 @@ class bybit(Exchange, ImplicitAPI):
3675
3675
  market = self.market(symbol)
3676
3676
  if not market['spot']:
3677
3677
  raise NotSupported(self.id + ' createMarketBuyOrderWithCost() supports spot orders only')
3678
- return self.create_order(symbol, 'market', 'buy', cost, 1, params)
3678
+ req = {
3679
+ 'cost': cost,
3680
+ }
3681
+ return self.create_order(symbol, 'market', 'buy', -1, None, self.extend(req, params))
3679
3682
 
3680
3683
  def create_market_sell_order_with_cost(self, symbol: str, cost: float, params={}) -> Order:
3681
3684
  """
@@ -3696,7 +3699,10 @@ class bybit(Exchange, ImplicitAPI):
3696
3699
  market = self.market(symbol)
3697
3700
  if not market['spot']:
3698
3701
  raise NotSupported(self.id + ' createMarketSellOrderWithCost() supports spot orders only')
3699
- return self.create_order(symbol, 'market', 'sell', cost, 1, params)
3702
+ req = {
3703
+ 'cost': cost,
3704
+ }
3705
+ return self.create_order(symbol, 'market', 'sell', -1, None, self.extend(req, params))
3700
3706
 
3701
3707
  def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}) -> Order:
3702
3708
  """
@@ -3904,7 +3910,7 @@ class bybit(Exchange, ImplicitAPI):
3904
3910
  if (price is None) and (cost is None):
3905
3911
  raise InvalidOrder(self.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend(amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to False and pass the cost to spend in the amount argument')
3906
3912
  else:
3907
- quoteAmount = Precise.string_mul(amountString, priceString)
3913
+ quoteAmount = Precise.string_mul(self.number_to_string(amount), priceString)
3908
3914
  costRequest = cost if (cost is not None) else quoteAmount
3909
3915
  request['qty'] = self.get_cost(symbol, costRequest)
3910
3916
  else:
ccxt/cex.py CHANGED
@@ -35,34 +35,95 @@ class cex(Exchange, ImplicitAPI):
35
35
  'swap': False,
36
36
  'future': False,
37
37
  'option': False,
38
+ 'addMargin': False,
39
+ 'borrowCrossMargin': False,
40
+ 'borrowIsolatedMargin': False,
41
+ 'borrowMargin': False,
38
42
  'cancelAllOrders': True,
39
43
  'cancelOrder': True,
44
+ 'closeAllPositions': False,
45
+ 'closePosition': False,
40
46
  'createOrder': True,
47
+ 'createOrderWithTakeProfitAndStopLoss': False,
48
+ 'createOrderWithTakeProfitAndStopLossWs': False,
49
+ 'createPostOnlyOrder': False,
41
50
  'createReduceOnlyOrder': False,
42
51
  'createStopOrder': True,
43
52
  'createTriggerOrder': True,
44
53
  'fetchAccounts': True,
45
54
  'fetchBalance': True,
55
+ 'fetchBorrowInterest': False,
56
+ 'fetchBorrowRate': False,
57
+ 'fetchBorrowRateHistories': False,
58
+ 'fetchBorrowRateHistory': False,
59
+ 'fetchBorrowRates': False,
60
+ 'fetchBorrowRatesPerSymbol': False,
46
61
  'fetchClosedOrder': True,
47
62
  'fetchClosedOrders': True,
63
+ 'fetchCrossBorrowRate': False,
64
+ 'fetchCrossBorrowRates': False,
48
65
  'fetchCurrencies': True,
49
66
  'fetchDepositAddress': True,
50
67
  'fetchDepositsWithdrawals': True,
51
68
  'fetchFundingHistory': False,
69
+ 'fetchFundingInterval': False,
70
+ 'fetchFundingIntervals': False,
52
71
  'fetchFundingRate': False,
53
72
  'fetchFundingRateHistory': False,
54
73
  'fetchFundingRates': False,
74
+ 'fetchGreeks': False,
75
+ 'fetchIndexOHLCV': False,
76
+ 'fetchIsolatedBorrowRate': False,
77
+ 'fetchIsolatedBorrowRates': False,
78
+ 'fetchIsolatedPositions': False,
55
79
  'fetchLedger': True,
80
+ 'fetchLeverage': False,
81
+ 'fetchLeverages': False,
82
+ 'fetchLeverageTiers': False,
83
+ 'fetchLiquidations': False,
84
+ 'fetchLongShortRatio': False,
85
+ 'fetchLongShortRatioHistory': False,
86
+ 'fetchMarginAdjustmentHistory': False,
87
+ 'fetchMarginMode': False,
88
+ 'fetchMarginModes': False,
89
+ 'fetchMarketLeverageTiers': False,
56
90
  'fetchMarkets': True,
91
+ 'fetchMarkOHLCV': False,
92
+ 'fetchMarkPrices': False,
93
+ 'fetchMyLiquidations': False,
94
+ 'fetchMySettlementHistory': False,
57
95
  'fetchOHLCV': True,
96
+ 'fetchOpenInterest': False,
97
+ 'fetchOpenInterestHistory': False,
98
+ 'fetchOpenInterests': False,
58
99
  'fetchOpenOrder': True,
59
100
  'fetchOpenOrders': True,
101
+ 'fetchOption': False,
102
+ 'fetchOptionChain': False,
60
103
  'fetchOrderBook': True,
104
+ 'fetchPosition': False,
105
+ 'fetchPositionHistory': False,
106
+ 'fetchPositionMode': False,
107
+ 'fetchPositions': False,
108
+ 'fetchPositionsForSymbol': False,
109
+ 'fetchPositionsHistory': False,
110
+ 'fetchPositionsRisk': False,
111
+ 'fetchPremiumIndexOHLCV': False,
112
+ 'fetchSettlementHistory': False,
61
113
  'fetchTicker': True,
62
114
  'fetchTickers': True,
63
115
  'fetchTime': True,
64
116
  'fetchTrades': True,
65
117
  'fetchTradingFees': True,
118
+ 'fetchVolatilityHistory': False,
119
+ 'reduceMargin': False,
120
+ 'repayCrossMargin': False,
121
+ 'repayIsolatedMargin': False,
122
+ 'repayMargin': False,
123
+ 'setLeverage': False,
124
+ 'setMargin': False,
125
+ 'setMarginMode': False,
126
+ 'setPositionMode': False,
66
127
  'transfer': True,
67
128
  },
68
129
  'urls': {
ccxt/coinbase.py CHANGED
@@ -4408,7 +4408,7 @@ class coinbase(Exchange, ImplicitAPI):
4408
4408
  """
4409
4409
  *futures only* closes open positions for a market
4410
4410
 
4411
- https://coinbase-api.github.io/docs/#/en-us/swapV2/trade-api.html#One-Click%20Close%20All%20Positions
4411
+ https://docs.cdp.coinbase.com/coinbase-app/trade/reference/retailbrokerageapi_closeposition
4412
4412
 
4413
4413
  :param str symbol: Unified CCXT market symbol
4414
4414
  :param str [side]: not used by coinbase
@@ -4419,8 +4419,6 @@ class coinbase(Exchange, ImplicitAPI):
4419
4419
  """
4420
4420
  self.load_markets()
4421
4421
  market = self.market(symbol)
4422
- if not market['future']:
4423
- raise NotSupported(self.id + ' closePosition() only supported for futures markets')
4424
4422
  clientOrderId = self.safe_string_2(params, 'client_order_id', 'clientOrderId')
4425
4423
  params = self.omit(params, 'clientOrderId')
4426
4424
  request: dict = {
ccxt/cryptocom.py CHANGED
@@ -60,6 +60,7 @@ class cryptocom(Exchange, ImplicitAPI):
60
60
  'createOrders': True,
61
61
  'createStopOrder': True,
62
62
  'createTriggerOrder': True,
63
+ 'editOrder': True,
63
64
  'fetchAccounts': True,
64
65
  'fetchBalance': True,
65
66
  'fetchBidsAsks': False,
@@ -152,6 +153,7 @@ class cryptocom(Exchange, ImplicitAPI):
152
153
  'derivatives': 'https://uat-api.3ona.co/v2',
153
154
  },
154
155
  'api': {
156
+ 'base': 'https://api.crypto.com',
155
157
  'v1': 'https://api.crypto.com/exchange/v1',
156
158
  'v2': 'https://api.crypto.com/v2',
157
159
  'derivatives': 'https://deriv-api.crypto.com/v1',
@@ -169,6 +171,13 @@ class cryptocom(Exchange, ImplicitAPI):
169
171
  'fees': 'https://crypto.com/exchange/document/fees-limits',
170
172
  },
171
173
  'api': {
174
+ 'base': {
175
+ 'public': {
176
+ 'get': {
177
+ 'v1/public/get-announcements': 1, # no description of rate limit
178
+ },
179
+ },
180
+ },
172
181
  'v1': {
173
182
  'public': {
174
183
  'get': {
@@ -195,6 +204,7 @@ class cryptocom(Exchange, ImplicitAPI):
195
204
  'private/user-balance-history': 10 / 3,
196
205
  'private/get-positions': 10 / 3,
197
206
  'private/create-order': 2 / 3,
207
+ 'private/amend-order': 4 / 3, # no description of rate limit
198
208
  'private/create-order-list': 10 / 3,
199
209
  'private/cancel-order': 2 / 3,
200
210
  'private/cancel-order-list': 10 / 3,
@@ -538,7 +548,22 @@ class cryptocom(Exchange, ImplicitAPI):
538
548
  # self endpoint requires authentication
539
549
  if not self.check_required_credentials(False):
540
550
  return None
541
- response = self.v1PrivatePostPrivateGetCurrencyNetworks(params)
551
+ skipFetchCurrencies = False
552
+ skipFetchCurrencies, params = self.handle_option_and_params(params, 'fetchCurrencies', 'skipFetchCurrencies', False)
553
+ if skipFetchCurrencies:
554
+ # sub-accounts can't access self endpoint
555
+ return None
556
+ response = {}
557
+ try:
558
+ response = self.v1PrivatePostPrivateGetCurrencyNetworks(params)
559
+ except Exception as e:
560
+ if isinstance(e, ExchangeError):
561
+ # sub-accounts can't access self endpoint
562
+ # {"code":"10001","msg":"SYS_ERROR"}
563
+ return None
564
+ raise e
565
+ # do nothing
566
+ # sub-accounts can't access self endpoint
542
567
  #
543
568
  # {
544
569
  # "id": "1747502328559",
@@ -563,7 +588,7 @@ class cryptocom(Exchange, ImplicitAPI):
563
588
  # "network_id": "CRONOS",
564
589
  # "withdrawal_fee": "0.18000000",
565
590
  # "withdraw_enabled": True,
566
- # "min_withdrawal_amount": "0.36",
591
+ # "min_withdrawal_amount": "0.35",
567
592
  # "deposit_enabled": True,
568
593
  # "confirmation_required": "15"
569
594
  # },
@@ -1551,6 +1576,45 @@ class cryptocom(Exchange, ImplicitAPI):
1551
1576
  params = self.omit(params, ['postOnly', 'clientOrderId', 'timeInForce', 'stopPrice', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice'])
1552
1577
  return self.extend(request, params)
1553
1578
 
1579
+ def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
1580
+ """
1581
+ edit a trade order
1582
+
1583
+ https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-amend-order
1584
+
1585
+ :param str id: order id
1586
+ :param str symbol: unified market symbol of the order to edit
1587
+ :param str [type]: not used by cryptocom editOrder
1588
+ :param str [side]: not used by cryptocom editOrder
1589
+ :param float amount:(mandatory) how much of the currency you want to trade in units of the base currency
1590
+ :param float price:(mandatory) the price for the order, in units of the quote currency, ignored in market orders
1591
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1592
+ :param str [params.clientOrderId]: the original client order id of the order to edit, required if id is not provided
1593
+ :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1594
+ """
1595
+ self.load_markets()
1596
+ request = self.edit_order_request(id, symbol, amount, price, params)
1597
+ response = self.v1PrivatePostPrivateAmendOrder(request)
1598
+ result = self.safe_dict(response, 'result', {})
1599
+ return self.parse_order(result)
1600
+
1601
+ def edit_order_request(self, id: str, symbol: str, amount: float, price: Num = None, params={}):
1602
+ request: dict = {}
1603
+ if id is not None:
1604
+ request['order_id'] = id
1605
+ else:
1606
+ originalClientOrderId = self.safe_string_2(params, 'orig_client_oid', 'clientOrderId')
1607
+ if originalClientOrderId is None:
1608
+ raise ArgumentsRequired(self.id + ' editOrder() requires an id argument or orig_client_oid parameter')
1609
+ else:
1610
+ request['orig_client_oid'] = originalClientOrderId
1611
+ params = self.omit(params, ['orig_client_oid', 'clientOrderId'])
1612
+ if (amount is None) or (price is None):
1613
+ raise ArgumentsRequired(self.id + ' editOrder() requires both amount and price arguments. If you do not want to change the amount or price, you should pass the original values')
1614
+ request['new_quantity'] = self.amount_to_precision(symbol, amount)
1615
+ request['new_price'] = self.price_to_precision(symbol, price)
1616
+ return self.extend(request, params)
1617
+
1554
1618
  def cancel_all_orders(self, symbol: Str = None, params={}):
1555
1619
  """
1556
1620
  cancel all open orders
ccxt/cryptomus.py CHANGED
@@ -461,7 +461,7 @@ class cryptomus(Exchange, ImplicitAPI):
461
461
  #
462
462
  # {
463
463
  # "currency_pair": "XMR_USDT",
464
- # "last_price": "158.04829771",
464
+ # "last_price": "158.04829772",
465
465
  # "base_volume": "0.35185785",
466
466
  # "quote_volume": "55.523761128544"
467
467
  # }
ccxt/delta.py CHANGED
@@ -906,9 +906,9 @@ class delta(Exchange, ImplicitAPI):
906
906
  'inverse': None if spot else not linear,
907
907
  'taker': self.safe_number(market, 'taker_commission_rate'),
908
908
  'maker': self.safe_number(market, 'maker_commission_rate'),
909
- 'contractSize': contractSize,
909
+ 'contractSize': None if spot else contractSize,
910
910
  'expiry': expiry,
911
- 'expiryDatetime': expiryDatetime,
911
+ 'expiryDatetime': self.iso8601(expiry), # do not use raw expiry string
912
912
  'strike': self.parse_number(strike),
913
913
  'optionType': optionType,
914
914
  'precision': {
ccxt/digifinex.py CHANGED
@@ -466,6 +466,16 @@ class digifinex(Exchange, ImplicitAPI):
466
466
  'TRX': 'TRC20',
467
467
  'VECHAIN': 'Vechain', # VET
468
468
  },
469
+ 'networksById': {
470
+ 'TRC20': 'TRC20',
471
+ 'TRX': 'TRC20',
472
+ 'BEP20': 'BEP20',
473
+ 'BSC': 'BEP20',
474
+ 'ERC20': 'ERC20',
475
+ 'ETH': 'ERC20',
476
+ 'Polygon': 'POLYGON',
477
+ 'Crypto.com': 'CRONOS',
478
+ },
469
479
  },
470
480
  'commonCurrencies': {
471
481
  'BHT': 'Black House Test',
@@ -493,6 +503,7 @@ class digifinex(Exchange, ImplicitAPI):
493
503
  # "min_withdraw_amount":10,
494
504
  # "min_withdraw_fee":5,
495
505
  # "currency":"USDT",
506
+ # "withdraw_fee_currency":"USDT",
496
507
  # "withdraw_status":0,
497
508
  # "chain":"OMNI"
498
509
  # },
@@ -503,6 +514,7 @@ class digifinex(Exchange, ImplicitAPI):
503
514
  # "min_withdraw_amount":10,
504
515
  # "min_withdraw_fee":3,
505
516
  # "currency":"USDT",
517
+ # "withdraw_fee_currency":"USDT",
506
518
  # "withdraw_status":1,
507
519
  # "chain":"ERC20"
508
520
  # },
@@ -513,6 +525,7 @@ class digifinex(Exchange, ImplicitAPI):
513
525
  # "min_withdraw_amount":0,
514
526
  # "min_withdraw_fee":0,
515
527
  # "currency":"DGF13",
528
+ # "withdraw_fee_currency":"DGF13",
516
529
  # "withdraw_status":0,
517
530
  # "chain":""
518
531
  # },
@@ -520,118 +533,45 @@ class digifinex(Exchange, ImplicitAPI):
520
533
  # "code":200
521
534
  # }
522
535
  #
523
- data = self.safe_value(response, 'data', [])
536
+ data = self.safe_list(response, 'data', [])
537
+ groupedById = self.group_by(data, 'currency')
538
+ keys = list(groupedById.keys())
524
539
  result: dict = {}
525
- for i in range(0, len(data)):
526
- currency = data[i]
527
- id = self.safe_string(currency, 'currency')
540
+ for i in range(0, len(keys)):
541
+ id = keys[i]
542
+ networkEntries = groupedById[id]
528
543
  code = self.safe_currency_code(id)
529
- depositStatus = self.safe_integer(currency, 'deposit_status', 1)
530
- withdrawStatus = self.safe_integer(currency, 'withdraw_status', 1)
531
- deposit = depositStatus > 0
532
- withdraw = withdrawStatus > 0
533
- active = deposit and withdraw
534
- feeString = self.safe_string(currency, 'min_withdraw_fee') # withdraw_fee_rate was zero for all currencies, so self was the worst case scenario
535
- minWithdrawString = self.safe_string(currency, 'min_withdraw_amount')
536
- minDepositString = self.safe_string(currency, 'min_deposit_amount')
537
- minDeposit = self.parse_number(minDepositString)
538
- minWithdraw = self.parse_number(minWithdrawString)
539
- fee = self.parse_number(feeString)
540
- # define precision with temporary way
541
- minFoundPrecision = Precise.string_min(feeString, Precise.string_min(minDepositString, minWithdrawString))
542
- precision = self.parse_number(minFoundPrecision)
543
- networkId = self.safe_string(currency, 'chain')
544
- networkCode = None
545
- if networkId is not None:
544
+ networks = {}
545
+ for j in range(0, len(networkEntries)):
546
+ networkEntry = networkEntries[j]
547
+ networkId = self.safe_string(networkEntry, 'chain')
546
548
  networkCode = self.network_id_to_code(networkId)
547
- network: dict = {
548
- 'info': currency,
549
- 'id': networkId,
550
- 'network': networkCode,
551
- 'active': active,
552
- 'fee': fee,
553
- 'precision': precision,
554
- 'deposit': deposit,
555
- 'withdraw': withdraw,
556
- 'limits': {
557
- 'amount': {
558
- 'min': None,
559
- 'max': None,
560
- },
561
- 'withdraw': {
562
- 'min': minWithdraw,
563
- 'max': None,
564
- },
565
- 'deposit': {
566
- 'min': minDeposit,
567
- 'max': None,
568
- },
569
- },
570
- }
571
- if code in result:
572
- resultCodeInfo = result[code]['info']
573
- if isinstance(resultCodeInfo, list):
574
- resultCodeInfo.append(currency)
575
- else:
576
- resultCodeInfo = [resultCodeInfo, currency]
577
- if withdraw:
578
- result[code]['withdraw'] = True
579
- result[code]['limits']['withdraw']['min'] = min(result[code]['limits']['withdraw']['min'], minWithdraw)
580
- if deposit:
581
- result[code]['deposit'] = True
582
- result[code]['limits']['deposit']['min'] = min(result[code]['limits']['deposit']['min'], minDeposit)
583
- if active:
584
- result[code]['active'] = True
585
- else:
586
- result[code] = {
587
- 'id': id,
588
- 'code': code,
589
- 'info': currency,
590
- 'type': None,
591
- 'name': None,
592
- 'active': active,
593
- 'deposit': deposit,
594
- 'withdraw': withdraw,
595
- 'fee': self.parse_number(feeString),
549
+ networks[networkCode] = {
550
+ 'id': networkId,
551
+ 'network': networkCode,
552
+ 'active': None,
553
+ 'deposit': self.safe_integer(networkEntry, 'deposit_status') == 1,
554
+ 'withdraw': self.safe_integer(networkEntry, 'withdraw_status') == 1,
555
+ 'fee': self.safe_number(networkEntry, 'min_withdraw_fee'),
596
556
  'precision': None,
597
557
  'limits': {
598
- 'amount': {
599
- 'min': None,
600
- 'max': None,
601
- },
602
558
  'withdraw': {
603
- 'min': minWithdraw,
559
+ 'min': self.safe_number(networkEntry, 'min_withdraw_amount'),
604
560
  'max': None,
605
561
  },
606
562
  'deposit': {
607
- 'min': minDeposit,
563
+ 'min': self.safe_number(networkEntry, 'min_deposit_amount'),
608
564
  'max': None,
609
565
  },
610
566
  },
611
- 'networks': {},
612
- }
613
- if networkId is not None:
614
- result[code]['networks'][networkId] = network
615
- else:
616
- result[code]['active'] = active
617
- result[code]['fee'] = self.parse_number(feeString)
618
- result[code]['deposit'] = deposit
619
- result[code]['withdraw'] = withdraw
620
- result[code]['limits'] = {
621
- 'amount': {
622
- 'min': None,
623
- 'max': None,
624
- },
625
- 'withdraw': {
626
- 'min': minWithdraw,
627
- 'max': None,
628
- },
629
- 'deposit': {
630
- 'min': minDeposit,
631
- 'max': None,
632
- },
567
+ 'info': networkEntry,
633
568
  }
634
- result[code]['precision'] = precision if (result[code]['precision'] is None) else max(result[code]['precision'], precision)
569
+ result[code] = self.safe_currency_structure({
570
+ 'id': id,
571
+ 'code': code,
572
+ 'info': networkEntries,
573
+ 'networks': networks,
574
+ })
635
575
  return result
636
576
 
637
577
  def fetch_markets(self, params={}) -> List[Market]:
ccxt/exmo.py CHANGED
@@ -779,7 +779,8 @@ class exmo(Exchange, ImplicitAPI):
779
779
  :param dict [params]: extra parameters specific to the exchange API endpoint
780
780
  :returns dict[]: an array of objects representing market data
781
781
  """
782
- response = self.publicGetPairSettings(params)
782
+ promises = []
783
+ promises.append(self.publicGetPairSettings(params))
783
784
  #
784
785
  # {
785
786
  # "BTC_USD":{
@@ -796,8 +797,9 @@ class exmo(Exchange, ImplicitAPI):
796
797
  # }
797
798
  #
798
799
  marginPairsDict: dict = {}
799
- if self.check_required_credentials(False):
800
- marginPairs = self.privatePostMarginPairList(params)
800
+ fetchMargin = self.check_required_credentials(False)
801
+ if fetchMargin:
802
+ promises.append(self.privatePostMarginPairList(params))
801
803
  #
802
804
  # {
803
805
  # "pairs": [
@@ -827,14 +829,18 @@ class exmo(Exchange, ImplicitAPI):
827
829
  # ]
828
830
  # }
829
831
  #
830
- pairs = self.safe_value(marginPairs, 'pairs')
832
+ responses = promises
833
+ spotResponse = responses[0]
834
+ if fetchMargin:
835
+ marginPairs = responses[1]
836
+ pairs = self.safe_list(marginPairs, 'pairs')
831
837
  marginPairsDict = self.index_by(pairs, 'name')
832
- keys = list(response.keys())
838
+ keys = list(spotResponse.keys())
833
839
  result = []
834
840
  for i in range(0, len(keys)):
835
841
  id = keys[i]
836
- market = response[id]
837
- marginMarket = self.safe_value(marginPairsDict, id)
842
+ market = spotResponse[id]
843
+ marginMarket = self.safe_dict(marginPairsDict, id)
838
844
  symbol = id.replace('_', '/')
839
845
  baseId, quoteId = symbol.split('/')
840
846
  base = self.safe_currency_code(baseId)