ccxt 4.1.85__py2.py3-none-any.whl → 4.1.86__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 (58) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/alpaca.py +1 -1
  3. ccxt/ascendex.py +1 -1
  4. ccxt/async_support/__init__.py +1 -1
  5. ccxt/async_support/alpaca.py +1 -1
  6. ccxt/async_support/ascendex.py +1 -1
  7. ccxt/async_support/base/exchange.py +4 -2
  8. ccxt/async_support/binance.py +1 -1
  9. ccxt/async_support/bingx.py +1 -1
  10. ccxt/async_support/bitget.py +1 -2
  11. ccxt/async_support/bitmex.py +1 -1
  12. ccxt/async_support/bybit.py +2 -4
  13. ccxt/async_support/coinex.py +1 -1
  14. ccxt/async_support/cryptocom.py +2 -2
  15. ccxt/async_support/digifinex.py +119 -103
  16. ccxt/async_support/hitbtc.py +1 -1
  17. ccxt/async_support/htx.py +1 -1
  18. ccxt/async_support/kraken.py +1 -1
  19. ccxt/async_support/krakenfutures.py +2 -2
  20. ccxt/async_support/kucoin.py +1 -5
  21. ccxt/async_support/latoken.py +1 -1
  22. ccxt/async_support/mexc.py +76 -49
  23. ccxt/async_support/okx.py +3 -3
  24. ccxt/async_support/p2b.py +0 -2
  25. ccxt/async_support/poloniex.py +42 -42
  26. ccxt/async_support/probit.py +25 -17
  27. ccxt/async_support/tokocrypto.py +6 -3
  28. ccxt/base/exchange.py +18 -8
  29. ccxt/binance.py +1 -1
  30. ccxt/bingx.py +1 -1
  31. ccxt/bitget.py +1 -2
  32. ccxt/bitmex.py +1 -1
  33. ccxt/bybit.py +2 -4
  34. ccxt/coinex.py +1 -1
  35. ccxt/cryptocom.py +2 -2
  36. ccxt/digifinex.py +119 -103
  37. ccxt/hitbtc.py +1 -1
  38. ccxt/htx.py +1 -1
  39. ccxt/kraken.py +1 -1
  40. ccxt/krakenfutures.py +2 -2
  41. ccxt/kucoin.py +1 -5
  42. ccxt/latoken.py +1 -1
  43. ccxt/mexc.py +76 -49
  44. ccxt/okx.py +3 -3
  45. ccxt/p2b.py +0 -2
  46. ccxt/poloniex.py +42 -42
  47. ccxt/pro/__init__.py +1 -1
  48. ccxt/pro/bitmex.py +200 -2
  49. ccxt/pro/krakenfutures.py +4 -4
  50. ccxt/pro/mexc.py +1 -1
  51. ccxt/pro/poloniex.py +1 -1
  52. ccxt/pro/poloniexfutures.py +3 -3
  53. ccxt/probit.py +25 -17
  54. ccxt/tokocrypto.py +6 -3
  55. {ccxt-4.1.85.dist-info → ccxt-4.1.86.dist-info}/METADATA +4 -4
  56. {ccxt-4.1.85.dist-info → ccxt-4.1.86.dist-info}/RECORD +58 -58
  57. {ccxt-4.1.85.dist-info → ccxt-4.1.86.dist-info}/WHEEL +0 -0
  58. {ccxt-4.1.85.dist-info → ccxt-4.1.86.dist-info}/top_level.txt +0 -0
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.1.85'
7
+ __version__ = '4.1.86'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -171,6 +171,8 @@ class Exchange(object):
171
171
  ws_proxy = None
172
172
  wssProxy = None
173
173
  wss_proxy = None
174
+ wsSocksProxy = None
175
+ ws_socks_proxy = None
174
176
  #
175
177
  userAgents = {
176
178
  'chrome': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36',
@@ -1822,26 +1824,34 @@ class Exchange(object):
1822
1824
  usedProxies = []
1823
1825
  wsProxy = None
1824
1826
  wssProxy = None
1825
- # wsProxy
1827
+ wsSocksProxy = None
1828
+ # ws proxy
1826
1829
  if self.wsProxy is not None:
1827
1830
  usedProxies.append('wsProxy')
1828
1831
  wsProxy = self.wsProxy
1829
1832
  if self.ws_proxy is not None:
1830
1833
  usedProxies.append('ws_proxy')
1831
1834
  wsProxy = self.ws_proxy
1832
- # wsProxy
1835
+ # wss proxy
1833
1836
  if self.wssProxy is not None:
1834
1837
  usedProxies.append('wssProxy')
1835
1838
  wssProxy = self.wssProxy
1836
1839
  if self.wss_proxy is not None:
1837
1840
  usedProxies.append('wss_proxy')
1838
1841
  wssProxy = self.wss_proxy
1842
+ # ws socks proxy
1843
+ if self.wsSocksProxy is not None:
1844
+ usedProxies.append('wsSocksProxy')
1845
+ wsSocksProxy = self.wsSocksProxy
1846
+ if self.ws_socks_proxy is not None:
1847
+ usedProxies.append('ws_socks_proxy')
1848
+ wsSocksProxy = self.ws_socks_proxy
1839
1849
  # check
1840
1850
  length = len(usedProxies)
1841
1851
  if length > 1:
1842
1852
  joinedProxyNames = ','.join(usedProxies)
1843
- raise ExchangeError(self.id + ' you have multiple conflicting settings(' + joinedProxyNames + '), please use only one from: wsProxy, wssProxy')
1844
- return [wsProxy, wssProxy]
1853
+ raise ExchangeError(self.id + ' you have multiple conflicting settings(' + joinedProxyNames + '), please use only one from: wsProxy, wssProxy, socksProxy')
1854
+ return [wsProxy, wssProxy, wsSocksProxy]
1845
1855
 
1846
1856
  def check_conflicting_proxies(self, proxyAgentSet, proxyUrlSet):
1847
1857
  if proxyAgentSet and proxyUrlSet:
@@ -4339,8 +4349,8 @@ class Exchange(object):
4339
4349
  def handle_time_in_force(self, params={}):
4340
4350
  """
4341
4351
  * @ignore
4342
- * * Must add timeInForce to self.options to use self method
4343
- :return string returns: the exchange specific value for timeInForce
4352
+ * Must add timeInForce to self.options to use self method
4353
+ :returns str: returns the exchange specific value for timeInForce
4344
4354
  """
4345
4355
  timeInForce = self.safe_string_upper(params, 'timeInForce') # supported values GTC, IOC, PO
4346
4356
  if timeInForce is not None:
@@ -4353,7 +4363,7 @@ class Exchange(object):
4353
4363
  def convert_type_to_account(self, account):
4354
4364
  """
4355
4365
  * @ignore
4356
- * * Must add accountsByType to self.options to use self method
4366
+ * Must add accountsByType to self.options to use self method
4357
4367
  :param str account: key for account name in self.options['accountsByType']
4358
4368
  :returns: the exchange specific account name or the isolated margin id for transfers
4359
4369
  """
ccxt/binance.py CHANGED
@@ -4181,7 +4181,7 @@ class binance(Exchange, ImplicitAPI):
4181
4181
  """
4182
4182
  *contract only* create a list of trade orders
4183
4183
  :see: https://binance-docs.github.io/apidocs/futures/en/#place-multiple-orders-trade
4184
- :param array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
4184
+ :param Array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
4185
4185
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
4186
4186
  """
4187
4187
  self.load_markets()
ccxt/bingx.py CHANGED
@@ -1721,7 +1721,7 @@ class bingx(Exchange, ImplicitAPI):
1721
1721
  create a list of trade orders
1722
1722
  :see: https://bingx-api.github.io/docs/#/spot/trade-api.html#Batch%20Placing%20Orders
1723
1723
  :see: https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Bulk%20order
1724
- :param array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
1724
+ :param Array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
1725
1725
  :param dict [params]: extra parameters specific to the exchange API endpoint
1726
1726
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1727
1727
  """
ccxt/bitget.py CHANGED
@@ -3553,7 +3553,7 @@ class bitget(Exchange, ImplicitAPI):
3553
3553
  :see: https://bitgetlimited.github.io/apidoc/en/mix/#batch-order
3554
3554
  :see: https://bitgetlimited.github.io/apidoc/en/margin/#isolated-batch-order
3555
3555
  :see: https://bitgetlimited.github.io/apidoc/en/margin/#cross-batch-order
3556
- :param array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
3556
+ :param Array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
3557
3557
  :param dict [params]: extra parameters specific to the api endpoint
3558
3558
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
3559
3559
  """
@@ -5571,7 +5571,6 @@ class bitget(Exchange, ImplicitAPI):
5571
5571
  :param str symbol: not used by bitget setPositionMode()
5572
5572
  :param dict [params]: extra parameters specific to the exchange API endpoint
5573
5573
  :returns dict: response from the exchange
5574
- *
5575
5574
  """
5576
5575
  self.load_markets()
5577
5576
  sandboxMode = self.safe_value(self.options, 'sandboxMode', False)
ccxt/bitmex.py CHANGED
@@ -2118,7 +2118,7 @@ class bitmex(Exchange, ImplicitAPI):
2118
2118
  datetime = self.safe_string(position, 'timestamp')
2119
2119
  crossMargin = self.safe_value(position, 'crossMargin')
2120
2120
  marginMode = 'cross' if (crossMargin is True) else 'isolated'
2121
- notionalString = Precise.string_abs(self.safe_string(position, 'foreignNotional', 'homeNotional'))
2121
+ notionalString = Precise.string_abs(self.safe_string_2(position, 'foreignNotional', 'homeNotional'))
2122
2122
  settleCurrencyCode = self.safe_string(market, 'settle')
2123
2123
  maintenanceMargin = self.convert_to_real_amount(settleCurrencyCode, self.safe_string(position, 'maintMargin'))
2124
2124
  unrealisedPnl = self.convert_to_real_amount(settleCurrencyCode, self.safe_string(position, 'unrealisedPnl'))
ccxt/bybit.py CHANGED
@@ -3485,7 +3485,7 @@ class bybit(Exchange, ImplicitAPI):
3485
3485
  """
3486
3486
  create a list of trade orders
3487
3487
  :see: https://bybit-exchange.github.io/docs/v5/order/batch-place
3488
- :param array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
3488
+ :param Array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
3489
3489
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
3490
3490
  """
3491
3491
  self.load_markets()
@@ -4415,7 +4415,6 @@ class bybit(Exchange, ImplicitAPI):
4415
4415
  :param int [limit]: the maximum number of trades to retrieve
4416
4416
  :param dict [params]: extra parameters specific to the exchange API endpoint
4417
4417
  :returns dict[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
4418
- *
4419
4418
  """
4420
4419
  request = {}
4421
4420
  clientOrderId = self.safe_string_2(params, 'clientOrderId', 'orderLinkId')
@@ -4679,12 +4678,11 @@ class bybit(Exchange, ImplicitAPI):
4679
4678
  :param int [limit]: the maximum number of deposits structures to retrieve, default = 50, max = 50
4680
4679
  :param dict [params]: extra parameters specific to the exchange API endpoint
4681
4680
  :param int [params.until]: the latest time in ms to fetch deposits for, default = 30 days after since
4682
- *
4683
4681
  * EXCHANGE SPECIFIC PARAMETERS
4684
4682
  :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
4685
4683
  :param str [params.cursor]: used for pagination
4686
4684
  :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
4687
- """
4685
+ """
4688
4686
  self.load_markets()
4689
4687
  paginate = False
4690
4688
  paginate, params = self.handle_option_and_params(params, 'fetchDeposits', 'paginate')
ccxt/coinex.py CHANGED
@@ -2142,7 +2142,7 @@ class coinex(Exchange, ImplicitAPI):
2142
2142
  """
2143
2143
  create a list of trade orders(all orders should be of the same symbol)
2144
2144
  :see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade002_batch_limit_orders
2145
- :param array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
2145
+ :param Array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
2146
2146
  :param dict [params]: extra parameters specific to the api endpoint
2147
2147
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
2148
2148
  """
ccxt/cryptocom.py CHANGED
@@ -1103,7 +1103,7 @@ class cryptocom(Exchange, ImplicitAPI):
1103
1103
  create a list of trade orders
1104
1104
  :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-create-order-list-list
1105
1105
  :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-create-order-list-oco
1106
- :param array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
1106
+ :param Array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
1107
1107
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1108
1108
  """
1109
1109
  self.load_markets()
@@ -2074,7 +2074,7 @@ class cryptocom(Exchange, ImplicitAPI):
2074
2074
  * @ignore
2075
2075
  marginMode specified by params["marginMode"], self.options["marginMode"], self.options["defaultMarginMode"], params["margin"] = True or self.options["defaultType"] = 'margin'
2076
2076
  :param dict [params]: extra parameters specific to the exchange API endpoint
2077
- :returns array: the marginMode in lowercase
2077
+ :returns Array: the marginMode in lowercase
2078
2078
  """
2079
2079
  defaultType = self.safe_string(self.options, 'defaultType')
2080
2080
  isMargin = self.safe_value(params, 'margin', False)
ccxt/digifinex.py CHANGED
@@ -535,9 +535,13 @@ class digifinex(Exchange, ImplicitAPI):
535
535
  def fetch_markets_v2(self, params={}):
536
536
  defaultType = self.safe_string(self.options, 'defaultType')
537
537
  marginMode, query = self.handle_margin_mode_and_params('fetchMarketsV2', params)
538
- method = 'publicSpotGetMarginSymbols' if (marginMode is not None) else 'publicSpotGetTradesSymbols'
539
- promises = [getattr(self, method)(query), self.publicSwapGetPublicInstruments(params)]
540
- promises = promises
538
+ promisesRaw = []
539
+ if marginMode is not None:
540
+ promisesRaw.append(self.publicSpotGetMarginSymbols(query))
541
+ else:
542
+ promisesRaw.append(self.publicSpotGetTradesSymbols(query))
543
+ promisesRaw.append(self.publicSwapGetPublicInstruments(params))
544
+ promises = promisesRaw
541
545
  spotMarkets = promises[0]
542
546
  swapMarkets = promises[1]
543
547
  #
@@ -808,16 +812,17 @@ class digifinex(Exchange, ImplicitAPI):
808
812
  self.load_markets()
809
813
  marketType = None
810
814
  marketType, params = self.handle_market_type_and_params('fetchBalance', None, params)
811
- method = self.get_supported_mapping(marketType, {
812
- 'spot': 'privateSpotGetSpotAssets',
813
- 'margin': 'privateSpotGetMarginAssets',
814
- 'swap': 'privateSwapGetAccountBalance',
815
- })
816
815
  marginMode, query = self.handle_margin_mode_and_params('fetchBalance', params)
817
- if marginMode is not None:
818
- method = 'privateSpotGetMarginAssets'
816
+ response = None
817
+ if marginMode is not None or marketType == 'margin':
819
818
  marketType = 'margin'
820
- response = getattr(self, method)(query)
819
+ response = self.privateSpotGetMarginAssets(query)
820
+ elif marketType == 'spot':
821
+ response = self.privateSpotGetSpotAssets(query)
822
+ elif marketType == 'swap':
823
+ response = self.privateSwapGetAccountBalance(query)
824
+ else:
825
+ raise NotSupported(self.id + ' fetchBalance() not support self market type')
821
826
  #
822
827
  # spot and margin
823
828
  #
@@ -872,16 +877,15 @@ class digifinex(Exchange, ImplicitAPI):
872
877
  market = self.market(symbol)
873
878
  marketType, query = self.handle_market_type_and_params('fetchOrderBook', market, params)
874
879
  request = {}
875
- method = None
880
+ if limit is not None:
881
+ request['limit'] = limit
882
+ response = None
876
883
  if marketType == 'swap':
877
- method = 'publicSwapGetPublicDepth'
878
884
  request['instrument_id'] = market['id']
885
+ response = self.publicSwapGetPublicDepth(self.extend(request, query))
879
886
  else:
880
- method = 'publicSpotGetOrderBook'
881
887
  request['symbol'] = market['id']
882
- if limit is not None:
883
- request['limit'] = limit
884
- response = getattr(self, method)(self.extend(request, query))
888
+ response = self.publicSpotGetOrderBook(self.extend(request, query))
885
889
  #
886
890
  # spot
887
891
  #
@@ -947,11 +951,12 @@ class digifinex(Exchange, ImplicitAPI):
947
951
  market = self.market(first)
948
952
  type = None
949
953
  type, params = self.handle_market_type_and_params('fetchTickers', market, params)
950
- method = 'publicSpotGetTicker'
951
954
  request = {}
955
+ response = None
952
956
  if type == 'swap':
953
- method = 'publicSwapGetPublicTickers'
954
- response = getattr(self, method)(self.extend(request, params))
957
+ response = self.publicSwapGetPublicTickers(self.extend(request, params))
958
+ else:
959
+ response = self.publicSpotGetTicker(self.extend(request, params))
955
960
  #
956
961
  # spot
957
962
  #
@@ -1023,14 +1028,14 @@ class digifinex(Exchange, ImplicitAPI):
1023
1028
  """
1024
1029
  self.load_markets()
1025
1030
  market = self.market(symbol)
1026
- method = 'publicSpotGetTicker'
1027
1031
  request = {}
1032
+ response = None
1028
1033
  if market['swap']:
1029
- method = 'publicSwapGetPublicTicker'
1030
1034
  request['instrument_id'] = market['id']
1035
+ response = self.publicSwapGetPublicTicker(self.extend(request, params))
1031
1036
  else:
1032
1037
  request['symbol'] = market['id']
1033
- response = getattr(self, method)(self.extend(request, params))
1038
+ response = self.publicSpotGetTicker(self.extend(request, params))
1034
1039
  #
1035
1040
  # spot
1036
1041
  #
@@ -1336,16 +1341,16 @@ class digifinex(Exchange, ImplicitAPI):
1336
1341
  """
1337
1342
  self.load_markets()
1338
1343
  market = self.market(symbol)
1339
- method = 'publicSpotGetTrades'
1340
1344
  request = {}
1345
+ if limit is not None:
1346
+ request['limit'] = min(limit, 100) if market['swap'] else limit
1347
+ response = None
1341
1348
  if market['swap']:
1342
- method = 'publicSwapGetPublicTrades'
1343
1349
  request['instrument_id'] = market['id']
1350
+ response = self.publicSwapGetPublicTrades(self.extend(request, params))
1344
1351
  else:
1345
1352
  request['symbol'] = market['id']
1346
- if limit is not None:
1347
- request['limit'] = min(limit, 100) if market['swap'] else limit
1348
- response = getattr(self, method)(self.extend(request, params))
1353
+ response = self.publicSpotGetTrades(self.extend(request, params))
1349
1354
  #
1350
1355
  # spot
1351
1356
  #
@@ -1434,14 +1439,14 @@ class digifinex(Exchange, ImplicitAPI):
1434
1439
  """
1435
1440
  self.load_markets()
1436
1441
  market = self.market(symbol)
1437
- method = 'publicSpotGetKline'
1438
1442
  request = {}
1443
+ response = None
1439
1444
  if market['swap']:
1440
- method = 'publicSwapGetPublicCandles'
1441
1445
  request['instrument_id'] = market['id']
1442
1446
  request['granularity'] = timeframe
1443
1447
  if limit is not None:
1444
1448
  request['limit'] = limit
1449
+ response = self.publicSwapGetPublicCandles(self.extend(request, params))
1445
1450
  else:
1446
1451
  request['symbol'] = market['id']
1447
1452
  request['period'] = self.safe_string(self.timeframes, timeframe, timeframe)
@@ -1455,7 +1460,7 @@ class digifinex(Exchange, ImplicitAPI):
1455
1460
  endTime = self.seconds()
1456
1461
  duration = self.parse_timeframe(timeframe)
1457
1462
  request['start_time'] = self.sum(endTime, -limit * duration)
1458
- response = getattr(self, method)(self.extend(request, params))
1463
+ response = self.publicSpotGetKline(self.extend(request, params))
1459
1464
  #
1460
1465
  # spot
1461
1466
  #
@@ -1550,7 +1555,7 @@ class digifinex(Exchange, ImplicitAPI):
1550
1555
  create a list of trade orders(all orders should be of the same symbol)
1551
1556
  :see: https://docs.digifinex.com/en-ww/spot/v3/rest.html#create-multiple-order
1552
1557
  :see: https://docs.digifinex.com/en-ww/swap/v2/rest.html#batchorder
1553
- :param array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
1558
+ :param Array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
1554
1559
  :param dict [params]: extra parameters specific to the exchange API endpoint
1555
1560
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1556
1561
  """
@@ -1749,18 +1754,9 @@ class digifinex(Exchange, ImplicitAPI):
1749
1754
  market = None
1750
1755
  if symbol is not None:
1751
1756
  market = self.market(symbol)
1757
+ id = str(id)
1752
1758
  marketType = None
1753
1759
  marketType, params = self.handle_market_type_and_params('cancelOrder', market, params)
1754
- method = self.get_supported_mapping(marketType, {
1755
- 'spot': 'privateSpotPostSpotOrderCancel',
1756
- 'margin': 'privateSpotPostMarginOrderCancel',
1757
- 'swap': 'privateSwapPostTradeCancelOrder',
1758
- })
1759
- marginMode, query = self.handle_margin_mode_and_params('cancelOrder', params)
1760
- if marginMode is not None:
1761
- method = 'privateSpotPostMarginOrderCancel'
1762
- marketType = 'margin'
1763
- id = str(id)
1764
1760
  request = {
1765
1761
  'order_id': id,
1766
1762
  }
@@ -1770,7 +1766,17 @@ class digifinex(Exchange, ImplicitAPI):
1770
1766
  request['instrument_id'] = market['id']
1771
1767
  else:
1772
1768
  request['market'] = marketType
1773
- response = getattr(self, method)(self.extend(request, query))
1769
+ marginMode, query = self.handle_margin_mode_and_params('cancelOrder', params)
1770
+ response = None
1771
+ if marginMode is not None or marketType == 'margin':
1772
+ marketType = 'margin'
1773
+ response = self.privateSpotPostMarginOrderCancel(self.extend(request, query))
1774
+ elif marketType == 'spot':
1775
+ response = self.privateSpotPostSpotOrderCancel(self.extend(request, query))
1776
+ elif marketType == 'swap':
1777
+ response = self.privateSwapPostTradeCancelOrder(self.extend(request, query))
1778
+ else:
1779
+ raise NotSupported(self.id + ' cancelOrder() not support self market type')
1774
1780
  #
1775
1781
  # spot and margin
1776
1782
  #
@@ -1994,15 +2000,7 @@ class digifinex(Exchange, ImplicitAPI):
1994
2000
  market = self.market(symbol)
1995
2001
  marketType = None
1996
2002
  marketType, params = self.handle_market_type_and_params('fetchOpenOrders', market, params)
1997
- method = self.get_supported_mapping(marketType, {
1998
- 'spot': 'privateSpotGetSpotOrderCurrent',
1999
- 'margin': 'privateSpotGetMarginOrderCurrent',
2000
- 'swap': 'privateSwapGetTradeOpenOrders',
2001
- })
2002
2003
  marginMode, query = self.handle_margin_mode_and_params('fetchOpenOrders', params)
2003
- if marginMode is not None:
2004
- method = 'privateSpotGetMarginOrderCurrent'
2005
- marketType = 'margin'
2006
2004
  request = {}
2007
2005
  swap = (marketType == 'swap')
2008
2006
  if swap:
@@ -2015,7 +2013,16 @@ class digifinex(Exchange, ImplicitAPI):
2015
2013
  if market is not None:
2016
2014
  marketIdRequest = 'instrument_id' if swap else 'symbol'
2017
2015
  request[marketIdRequest] = market['id']
2018
- response = getattr(self, method)(self.extend(request, query))
2016
+ response = None
2017
+ if marginMode is not None or marketType == 'margin':
2018
+ marketType = 'margin'
2019
+ response = self.privateSpotGetMarginOrderCurrent(self.extend(request, query))
2020
+ elif marketType == 'spot':
2021
+ response = self.privateSpotGetSpotOrderCurrent(self.extend(request, query))
2022
+ elif marketType == 'swap':
2023
+ response = self.privateSwapGetTradeOpenOrders(self.extend(request, query))
2024
+ else:
2025
+ raise NotSupported(self.id + ' fetchOpenOrders() not support self market type')
2019
2026
  #
2020
2027
  # spot and margin
2021
2028
  #
@@ -2087,15 +2094,7 @@ class digifinex(Exchange, ImplicitAPI):
2087
2094
  market = self.market(symbol)
2088
2095
  marketType = None
2089
2096
  marketType, params = self.handle_market_type_and_params('fetchOrders', market, params)
2090
- method = self.get_supported_mapping(marketType, {
2091
- 'spot': 'privateSpotGetSpotOrderHistory',
2092
- 'margin': 'privateSpotGetMarginOrderHistory',
2093
- 'swap': 'privateSwapGetTradeHistoryOrders',
2094
- })
2095
2097
  marginMode, query = self.handle_margin_mode_and_params('fetchOrders', params)
2096
- if marginMode is not None:
2097
- method = 'privateSpotGetMarginOrderHistory'
2098
- marketType = 'margin'
2099
2098
  request = {}
2100
2099
  if marketType == 'swap':
2101
2100
  if since is not None:
@@ -2109,7 +2108,16 @@ class digifinex(Exchange, ImplicitAPI):
2109
2108
  request[marketIdRequest] = market['id']
2110
2109
  if limit is not None:
2111
2110
  request['limit'] = limit
2112
- response = getattr(self, method)(self.extend(request, query))
2111
+ response = None
2112
+ if marginMode is not None or marketType == 'margin':
2113
+ marketType = 'margin'
2114
+ response = self.privateSpotGetMarginOrderHistory(self.extend(request, query))
2115
+ elif marketType == 'spot':
2116
+ response = self.privateSpotGetSpotOrderHistory(self.extend(request, query))
2117
+ elif marketType == 'swap':
2118
+ response = self.privateSwapGetTradeHistoryOrders(self.extend(request, query))
2119
+ else:
2120
+ raise NotSupported(self.id + ' fetchOrders() not support self market type')
2113
2121
  #
2114
2122
  # spot and margin
2115
2123
  #
@@ -2180,15 +2188,7 @@ class digifinex(Exchange, ImplicitAPI):
2180
2188
  market = self.market(symbol)
2181
2189
  marketType = None
2182
2190
  marketType, params = self.handle_market_type_and_params('fetchOrder', market, params)
2183
- method = self.get_supported_mapping(marketType, {
2184
- 'spot': 'privateSpotGetSpotOrder',
2185
- 'margin': 'privateSpotGetMarginOrder',
2186
- 'swap': 'privateSwapGetTradeOrderInfo',
2187
- })
2188
2191
  marginMode, query = self.handle_margin_mode_and_params('fetchOrder', params)
2189
- if marginMode is not None:
2190
- method = 'privateSpotGetMarginOrder'
2191
- marketType = 'margin'
2192
2192
  request = {
2193
2193
  'order_id': id,
2194
2194
  }
@@ -2197,7 +2197,16 @@ class digifinex(Exchange, ImplicitAPI):
2197
2197
  request['instrument_id'] = market['id']
2198
2198
  else:
2199
2199
  request['market'] = marketType
2200
- response = getattr(self, method)(self.extend(request, query))
2200
+ response = None
2201
+ if (marginMode is not None) or (marketType == 'margin'):
2202
+ marketType = 'margin'
2203
+ response = self.privateSpotGetMarginOrder(self.extend(request, query))
2204
+ elif marketType == 'spot':
2205
+ response = self.privateSpotGetSpotOrder(self.extend(request, query))
2206
+ elif marketType == 'swap':
2207
+ response = self.privateSwapGetTradeOrderInfo(self.extend(request, query))
2208
+ else:
2209
+ raise NotSupported(self.id + ' fetchOrder() not support self market type')
2201
2210
  #
2202
2211
  # spot and margin
2203
2212
  #
@@ -2270,15 +2279,7 @@ class digifinex(Exchange, ImplicitAPI):
2270
2279
  market = self.market(symbol)
2271
2280
  marketType = None
2272
2281
  marketType, params = self.handle_market_type_and_params('fetchMyTrades', market, params)
2273
- method = self.get_supported_mapping(marketType, {
2274
- 'spot': 'privateSpotGetSpotMytrades',
2275
- 'margin': 'privateSpotGetMarginMytrades',
2276
- 'swap': 'privateSwapGetTradeHistoryTrades',
2277
- })
2278
2282
  marginMode, query = self.handle_margin_mode_and_params('fetchMyTrades', params)
2279
- if marginMode is not None:
2280
- method = 'privateSpotGetMarginMytrades'
2281
- marketType = 'margin'
2282
2283
  if marketType == 'swap':
2283
2284
  if since is not None:
2284
2285
  request['start_timestamp'] = since
@@ -2291,7 +2292,16 @@ class digifinex(Exchange, ImplicitAPI):
2291
2292
  request[marketIdRequest] = market['id']
2292
2293
  if limit is not None:
2293
2294
  request['limit'] = limit
2294
- response = getattr(self, method)(self.extend(request, query))
2295
+ response = None
2296
+ if marginMode is not None or marketType == 'margin':
2297
+ marketType = 'margin'
2298
+ response = self.privateSpotGetMarginMytrades(self.extend(request, query))
2299
+ elif marketType == 'spot':
2300
+ response = self.privateSpotGetSpotMytrades(self.extend(request, query))
2301
+ elif marketType == 'swap':
2302
+ response = self.privateSwapGetTradeHistoryTrades(self.extend(request, query))
2303
+ else:
2304
+ raise NotSupported(self.id + ' fetchMyTrades() not support self market type')
2295
2305
  #
2296
2306
  # spot and margin
2297
2307
  #
@@ -2406,15 +2416,7 @@ class digifinex(Exchange, ImplicitAPI):
2406
2416
  request = {}
2407
2417
  marketType = None
2408
2418
  marketType, params = self.handle_market_type_and_params('fetchLedger', None, params)
2409
- method = self.get_supported_mapping(marketType, {
2410
- 'spot': 'privateSpotGetSpotFinancelog',
2411
- 'margin': 'privateSpotGetMarginFinancelog',
2412
- 'swap': 'privateSwapGetAccountFinanceRecord',
2413
- })
2414
2419
  marginMode, query = self.handle_margin_mode_and_params('fetchLedger', params)
2415
- if marginMode is not None:
2416
- method = 'privateSpotGetMarginFinancelog'
2417
- marketType = 'margin'
2418
2420
  if marketType == 'swap':
2419
2421
  if since is not None:
2420
2422
  request['start_timestamp'] = since
@@ -2429,7 +2431,16 @@ class digifinex(Exchange, ImplicitAPI):
2429
2431
  request[currencyIdRequest] = currency['id']
2430
2432
  if limit is not None:
2431
2433
  request['limit'] = limit
2432
- response = getattr(self, method)(self.extend(request, query))
2434
+ response = None
2435
+ if marginMode is not None or marketType == 'margin':
2436
+ marketType = 'margin'
2437
+ response = self.privateSpotGetMarginFinancelog(self.extend(request, query))
2438
+ elif marketType == 'spot':
2439
+ response = self.privateSpotGetSpotFinancelog(self.extend(request, query))
2440
+ elif marketType == 'swap':
2441
+ response = self.privateSwapGetAccountFinanceRecord(self.extend(request, query))
2442
+ else:
2443
+ raise NotSupported(self.id + ' fetchLedger() not support self market type')
2433
2444
  #
2434
2445
  # spot and margin
2435
2446
  #
@@ -2539,8 +2550,11 @@ class digifinex(Exchange, ImplicitAPI):
2539
2550
  request['currency'] = currency['id']
2540
2551
  if limit is not None:
2541
2552
  request['size'] = min(500, limit)
2542
- method = 'privateSpotGetDepositHistory' if (type == 'deposit') else 'privateSpotGetWithdrawHistory'
2543
- response = getattr(self, method)(self.extend(request, params))
2553
+ response = None
2554
+ if type == 'deposit':
2555
+ response = self.privateSpotGetDepositHistory(self.extend(request, params))
2556
+ else:
2557
+ response = self.privateSpotGetWithdrawHistory(self.extend(request, params))
2544
2558
  #
2545
2559
  # {
2546
2560
  # "code": 200,
@@ -3133,12 +3147,13 @@ class digifinex(Exchange, ImplicitAPI):
3133
3147
  if market is not None:
3134
3148
  marketIdRequest = 'instrument_id' if (marketType == 'swap') else 'symbol'
3135
3149
  request[marketIdRequest] = market['id']
3136
- method = self.get_supported_mapping(marketType, {
3137
- 'spot': 'privateSpotGetMarginPositions',
3138
- 'margin': 'privateSpotGetMarginPositions',
3139
- 'swap': 'privateSwapGetAccountPositions',
3140
- })
3141
- response = getattr(self, method)(self.extend(request, query))
3150
+ response = None
3151
+ if marketType == 'spot' or marketType == 'margin':
3152
+ response = self.privateSpotGetMarginPositions(self.extend(request, query))
3153
+ elif marketType == 'swap':
3154
+ response = self.privateSwapGetAccountPositions(self.extend(request, query))
3155
+ else:
3156
+ raise NotSupported(self.id + ' fetchPositions() not support self market type')
3142
3157
  #
3143
3158
  # swap
3144
3159
  #
@@ -3216,14 +3231,15 @@ class digifinex(Exchange, ImplicitAPI):
3216
3231
  marginMode, query = self.handle_margin_mode_and_params('fetchPosition', params)
3217
3232
  if marginMode is not None:
3218
3233
  marketType = 'margin'
3219
- method = self.get_supported_mapping(marketType, {
3220
- 'spot': 'privateSpotGetMarginPositions',
3221
- 'margin': 'privateSpotGetMarginPositions',
3222
- 'swap': 'privateSwapGetAccountPositions',
3223
- })
3224
3234
  marketIdRequest = 'instrument_id' if (marketType == 'swap') else 'symbol'
3225
3235
  request[marketIdRequest] = market['id']
3226
- response = getattr(self, method)(self.extend(request, query))
3236
+ response = None
3237
+ if marketType == 'spot' or marketType == 'margin':
3238
+ response = self.privateSpotGetMarginPositions(self.extend(request, query))
3239
+ elif marketType == 'swap':
3240
+ response = self.privateSwapGetAccountPositions(self.extend(request, query))
3241
+ else:
3242
+ raise NotSupported(self.id + ' fetchPosition() not support self market type')
3227
3243
  #
3228
3244
  # swap
3229
3245
  #
@@ -3634,7 +3650,7 @@ class digifinex(Exchange, ImplicitAPI):
3634
3650
  * @ignore
3635
3651
  marginMode specified by params["marginMode"], self.options["marginMode"], self.options["defaultMarginMode"], params["margin"] = True or self.options["defaultType"] = 'margin'
3636
3652
  :param dict [params]: extra parameters specific to the exchange API endpoint
3637
- :returns array: the marginMode in lowercase
3653
+ :returns Array: the marginMode in lowercase
3638
3654
  """
3639
3655
  defaultType = self.safe_string(self.options, 'defaultType')
3640
3656
  isMargin = self.safe_value(params, 'margin', False)
ccxt/hitbtc.py CHANGED
@@ -3269,7 +3269,7 @@ class hitbtc(Exchange, ImplicitAPI):
3269
3269
  * @ignore
3270
3270
  marginMode specified by params["marginMode"], self.options["marginMode"], self.options["defaultMarginMode"], params["margin"] = True or self.options["defaultType"] = 'margin'
3271
3271
  :param dict [params]: extra parameters specific to the exchange API endpoint
3272
- :returns array: the marginMode in lowercase
3272
+ :returns Array: the marginMode in lowercase
3273
3273
  """
3274
3274
  defaultType = self.safe_string(self.options, 'defaultType')
3275
3275
  isMargin = self.safe_value(params, 'margin', False)
ccxt/htx.py CHANGED
@@ -4880,7 +4880,7 @@ class htx(Exchange, ImplicitAPI):
4880
4880
  :see: https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#place-a-batch-of-orders
4881
4881
  :see: https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-place-a-batch-of-orders
4882
4882
  :see: https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-place-a-batch-of-orders
4883
- :param array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
4883
+ :param Array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
4884
4884
  :param dict [params]: extra parameters specific to the exchange API endpoint
4885
4885
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
4886
4886
  """
ccxt/kraken.py CHANGED
@@ -2211,7 +2211,7 @@ class kraken(Exchange, ImplicitAPI):
2211
2211
  :param dict [params.end]: End timestamp, withdrawals created strictly after will be not be included in the response
2212
2212
  :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times
2213
2213
  :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
2214
- """
2214
+ """
2215
2215
  self.load_markets()
2216
2216
  paginate = False
2217
2217
  paginate, params = self.handle_option_and_params(params, 'fetchWithdrawals', 'paginate')