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.
- ccxt/__init__.py +1 -1
- ccxt/alpaca.py +1 -1
- ccxt/ascendex.py +1 -1
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/alpaca.py +1 -1
- ccxt/async_support/ascendex.py +1 -1
- ccxt/async_support/base/exchange.py +4 -2
- ccxt/async_support/binance.py +1 -1
- ccxt/async_support/bingx.py +1 -1
- ccxt/async_support/bitget.py +1 -2
- ccxt/async_support/bitmex.py +1 -1
- ccxt/async_support/bybit.py +2 -4
- ccxt/async_support/coinex.py +1 -1
- ccxt/async_support/cryptocom.py +2 -2
- ccxt/async_support/digifinex.py +119 -103
- ccxt/async_support/hitbtc.py +1 -1
- ccxt/async_support/htx.py +1 -1
- ccxt/async_support/kraken.py +1 -1
- ccxt/async_support/krakenfutures.py +2 -2
- ccxt/async_support/kucoin.py +1 -5
- ccxt/async_support/latoken.py +1 -1
- ccxt/async_support/mexc.py +76 -49
- ccxt/async_support/okx.py +3 -3
- ccxt/async_support/p2b.py +0 -2
- ccxt/async_support/poloniex.py +42 -42
- ccxt/async_support/probit.py +25 -17
- ccxt/async_support/tokocrypto.py +6 -3
- ccxt/base/exchange.py +18 -8
- ccxt/binance.py +1 -1
- ccxt/bingx.py +1 -1
- ccxt/bitget.py +1 -2
- ccxt/bitmex.py +1 -1
- ccxt/bybit.py +2 -4
- ccxt/coinex.py +1 -1
- ccxt/cryptocom.py +2 -2
- ccxt/digifinex.py +119 -103
- ccxt/hitbtc.py +1 -1
- ccxt/htx.py +1 -1
- ccxt/kraken.py +1 -1
- ccxt/krakenfutures.py +2 -2
- ccxt/kucoin.py +1 -5
- ccxt/latoken.py +1 -1
- ccxt/mexc.py +76 -49
- ccxt/okx.py +3 -3
- ccxt/p2b.py +0 -2
- ccxt/poloniex.py +42 -42
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/bitmex.py +200 -2
- ccxt/pro/krakenfutures.py +4 -4
- ccxt/pro/mexc.py +1 -1
- ccxt/pro/poloniex.py +1 -1
- ccxt/pro/poloniexfutures.py +3 -3
- ccxt/probit.py +25 -17
- ccxt/tokocrypto.py +6 -3
- {ccxt-4.1.85.dist-info → ccxt-4.1.86.dist-info}/METADATA +4 -4
- {ccxt-4.1.85.dist-info → ccxt-4.1.86.dist-info}/RECORD +58 -58
- {ccxt-4.1.85.dist-info → ccxt-4.1.86.dist-info}/WHEEL +0 -0
- {ccxt-4.1.85.dist-info → ccxt-4.1.86.dist-info}/top_level.txt +0 -0
ccxt/__init__.py
CHANGED
ccxt/alpaca.py
CHANGED
@@ -492,7 +492,7 @@ class alpaca(Exchange, ImplicitAPI):
|
|
492
492
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
493
493
|
:param str [params.loc]: crypto location, default: us
|
494
494
|
:returns dict: A dictionary of `order book structures <https://github.com/ccxt/ccxt/wiki/Manual#order-book-structure>` indexed by market symbols
|
495
|
-
|
495
|
+
"""
|
496
496
|
self.load_markets()
|
497
497
|
market = self.market(symbol)
|
498
498
|
id = market['id']
|
ccxt/ascendex.py
CHANGED
@@ -1593,7 +1593,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1593
1593
|
create a list of trade orders
|
1594
1594
|
:see: https://ascendex.github.io/ascendex-pro-api/#place-batch-orders
|
1595
1595
|
:see: https://ascendex.github.io/ascendex-futures-pro-api-v2/#place-batch-orders
|
1596
|
-
:param
|
1596
|
+
: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
|
1597
1597
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1598
1598
|
:param str [params.timeInForce]: "GTC", "IOC", "FOK", or "PO"
|
1599
1599
|
:param bool [params.postOnly]: True or False
|
ccxt/async_support/__init__.py
CHANGED
ccxt/async_support/alpaca.py
CHANGED
@@ -492,7 +492,7 @@ class alpaca(Exchange, ImplicitAPI):
|
|
492
492
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
493
493
|
:param str [params.loc]: crypto location, default: us
|
494
494
|
:returns dict: A dictionary of `order book structures <https://github.com/ccxt/ccxt/wiki/Manual#order-book-structure>` indexed by market symbols
|
495
|
-
|
495
|
+
"""
|
496
496
|
await self.load_markets()
|
497
497
|
market = self.market(symbol)
|
498
498
|
id = market['id']
|
ccxt/async_support/ascendex.py
CHANGED
@@ -1593,7 +1593,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1593
1593
|
create a list of trade orders
|
1594
1594
|
:see: https://ascendex.github.io/ascendex-pro-api/#place-batch-orders
|
1595
1595
|
:see: https://ascendex.github.io/ascendex-futures-pro-api-v2/#place-batch-orders
|
1596
|
-
:param
|
1596
|
+
: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
|
1597
1597
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1598
1598
|
:param str [params.timeInForce]: "GTC", "IOC", "FOK", or "PO"
|
1599
1599
|
:param bool [params.postOnly]: True or False
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# -----------------------------------------------------------------------------
|
4
4
|
|
5
|
-
__version__ = '4.1.
|
5
|
+
__version__ = '4.1.86'
|
6
6
|
|
7
7
|
# -----------------------------------------------------------------------------
|
8
8
|
|
@@ -370,11 +370,13 @@ class Exchange(BaseExchange):
|
|
370
370
|
|
371
371
|
def set_client_session_proxy(self, url):
|
372
372
|
final_proxy = None # set default
|
373
|
-
httpProxy, httpsProxy = self.check_ws_proxy_settings()
|
373
|
+
httpProxy, httpsProxy, socksProxy = self.check_ws_proxy_settings()
|
374
374
|
if httpProxy:
|
375
375
|
final_proxy = httpProxy
|
376
376
|
elif httpsProxy:
|
377
377
|
final_proxy = httpsProxy
|
378
|
+
elif socksProxy:
|
379
|
+
final_proxy = socksProxy
|
378
380
|
if (final_proxy):
|
379
381
|
self.clients[url].proxy = final_proxy
|
380
382
|
else:
|
ccxt/async_support/binance.py
CHANGED
@@ -4182,7 +4182,7 @@ class binance(Exchange, ImplicitAPI):
|
|
4182
4182
|
"""
|
4183
4183
|
*contract only* create a list of trade orders
|
4184
4184
|
:see: https://binance-docs.github.io/apidocs/futures/en/#place-multiple-orders-trade
|
4185
|
-
:param
|
4185
|
+
: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
|
4186
4186
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
4187
4187
|
"""
|
4188
4188
|
await self.load_markets()
|
ccxt/async_support/bingx.py
CHANGED
@@ -1722,7 +1722,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1722
1722
|
create a list of trade orders
|
1723
1723
|
:see: https://bingx-api.github.io/docs/#/spot/trade-api.html#Batch%20Placing%20Orders
|
1724
1724
|
:see: https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Bulk%20order
|
1725
|
-
:param
|
1725
|
+
: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
|
1726
1726
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1727
1727
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1728
1728
|
"""
|
ccxt/async_support/bitget.py
CHANGED
@@ -3554,7 +3554,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
3554
3554
|
:see: https://bitgetlimited.github.io/apidoc/en/mix/#batch-order
|
3555
3555
|
:see: https://bitgetlimited.github.io/apidoc/en/margin/#isolated-batch-order
|
3556
3556
|
:see: https://bitgetlimited.github.io/apidoc/en/margin/#cross-batch-order
|
3557
|
-
:param
|
3557
|
+
: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
|
3558
3558
|
:param dict [params]: extra parameters specific to the api endpoint
|
3559
3559
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
3560
3560
|
"""
|
@@ -5572,7 +5572,6 @@ class bitget(Exchange, ImplicitAPI):
|
|
5572
5572
|
:param str symbol: not used by bitget setPositionMode()
|
5573
5573
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
5574
5574
|
:returns dict: response from the exchange
|
5575
|
-
*
|
5576
5575
|
"""
|
5577
5576
|
await self.load_markets()
|
5578
5577
|
sandboxMode = self.safe_value(self.options, 'sandboxMode', False)
|
ccxt/async_support/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.
|
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/async_support/bybit.py
CHANGED
@@ -3486,7 +3486,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
3486
3486
|
"""
|
3487
3487
|
create a list of trade orders
|
3488
3488
|
:see: https://bybit-exchange.github.io/docs/v5/order/batch-place
|
3489
|
-
:param
|
3489
|
+
: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
|
3490
3490
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
3491
3491
|
"""
|
3492
3492
|
await self.load_markets()
|
@@ -4416,7 +4416,6 @@ class bybit(Exchange, ImplicitAPI):
|
|
4416
4416
|
:param int [limit]: the maximum number of trades to retrieve
|
4417
4417
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4418
4418
|
:returns dict[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
|
4419
|
-
*
|
4420
4419
|
"""
|
4421
4420
|
request = {}
|
4422
4421
|
clientOrderId = self.safe_string_2(params, 'clientOrderId', 'orderLinkId')
|
@@ -4680,12 +4679,11 @@ class bybit(Exchange, ImplicitAPI):
|
|
4680
4679
|
:param int [limit]: the maximum number of deposits structures to retrieve, default = 50, max = 50
|
4681
4680
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4682
4681
|
:param int [params.until]: the latest time in ms to fetch deposits for, default = 30 days after since
|
4683
|
-
*
|
4684
4682
|
* EXCHANGE SPECIFIC PARAMETERS
|
4685
4683
|
: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)
|
4686
4684
|
:param str [params.cursor]: used for pagination
|
4687
4685
|
:returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
|
4688
|
-
|
4686
|
+
"""
|
4689
4687
|
await self.load_markets()
|
4690
4688
|
paginate = False
|
4691
4689
|
paginate, params = self.handle_option_and_params(params, 'fetchDeposits', 'paginate')
|
ccxt/async_support/coinex.py
CHANGED
@@ -2143,7 +2143,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
2143
2143
|
"""
|
2144
2144
|
create a list of trade orders(all orders should be of the same symbol)
|
2145
2145
|
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade002_batch_limit_orders
|
2146
|
-
:param
|
2146
|
+
: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
|
2147
2147
|
:param dict [params]: extra parameters specific to the api endpoint
|
2148
2148
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
2149
2149
|
"""
|
ccxt/async_support/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
|
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
|
await 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
|
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/async_support/digifinex.py
CHANGED
@@ -536,9 +536,13 @@ class digifinex(Exchange, ImplicitAPI):
|
|
536
536
|
async def fetch_markets_v2(self, params={}):
|
537
537
|
defaultType = self.safe_string(self.options, 'defaultType')
|
538
538
|
marginMode, query = self.handle_margin_mode_and_params('fetchMarketsV2', params)
|
539
|
-
|
540
|
-
|
541
|
-
|
539
|
+
promisesRaw = []
|
540
|
+
if marginMode is not None:
|
541
|
+
promisesRaw.append(self.publicSpotGetMarginSymbols(query))
|
542
|
+
else:
|
543
|
+
promisesRaw.append(self.publicSpotGetTradesSymbols(query))
|
544
|
+
promisesRaw.append(self.publicSwapGetPublicInstruments(params))
|
545
|
+
promises = await asyncio.gather(*promisesRaw)
|
542
546
|
spotMarkets = promises[0]
|
543
547
|
swapMarkets = promises[1]
|
544
548
|
#
|
@@ -809,16 +813,17 @@ class digifinex(Exchange, ImplicitAPI):
|
|
809
813
|
await self.load_markets()
|
810
814
|
marketType = None
|
811
815
|
marketType, params = self.handle_market_type_and_params('fetchBalance', None, params)
|
812
|
-
method = self.get_supported_mapping(marketType, {
|
813
|
-
'spot': 'privateSpotGetSpotAssets',
|
814
|
-
'margin': 'privateSpotGetMarginAssets',
|
815
|
-
'swap': 'privateSwapGetAccountBalance',
|
816
|
-
})
|
817
816
|
marginMode, query = self.handle_margin_mode_and_params('fetchBalance', params)
|
818
|
-
|
819
|
-
|
817
|
+
response = None
|
818
|
+
if marginMode is not None or marketType == 'margin':
|
820
819
|
marketType = 'margin'
|
821
|
-
|
820
|
+
response = await self.privateSpotGetMarginAssets(query)
|
821
|
+
elif marketType == 'spot':
|
822
|
+
response = await self.privateSpotGetSpotAssets(query)
|
823
|
+
elif marketType == 'swap':
|
824
|
+
response = await self.privateSwapGetAccountBalance(query)
|
825
|
+
else:
|
826
|
+
raise NotSupported(self.id + ' fetchBalance() not support self market type')
|
822
827
|
#
|
823
828
|
# spot and margin
|
824
829
|
#
|
@@ -873,16 +878,15 @@ class digifinex(Exchange, ImplicitAPI):
|
|
873
878
|
market = self.market(symbol)
|
874
879
|
marketType, query = self.handle_market_type_and_params('fetchOrderBook', market, params)
|
875
880
|
request = {}
|
876
|
-
|
881
|
+
if limit is not None:
|
882
|
+
request['limit'] = limit
|
883
|
+
response = None
|
877
884
|
if marketType == 'swap':
|
878
|
-
method = 'publicSwapGetPublicDepth'
|
879
885
|
request['instrument_id'] = market['id']
|
886
|
+
response = await self.publicSwapGetPublicDepth(self.extend(request, query))
|
880
887
|
else:
|
881
|
-
method = 'publicSpotGetOrderBook'
|
882
888
|
request['symbol'] = market['id']
|
883
|
-
|
884
|
-
request['limit'] = limit
|
885
|
-
response = await getattr(self, method)(self.extend(request, query))
|
889
|
+
response = await self.publicSpotGetOrderBook(self.extend(request, query))
|
886
890
|
#
|
887
891
|
# spot
|
888
892
|
#
|
@@ -948,11 +952,12 @@ class digifinex(Exchange, ImplicitAPI):
|
|
948
952
|
market = self.market(first)
|
949
953
|
type = None
|
950
954
|
type, params = self.handle_market_type_and_params('fetchTickers', market, params)
|
951
|
-
method = 'publicSpotGetTicker'
|
952
955
|
request = {}
|
956
|
+
response = None
|
953
957
|
if type == 'swap':
|
954
|
-
|
955
|
-
|
958
|
+
response = await self.publicSwapGetPublicTickers(self.extend(request, params))
|
959
|
+
else:
|
960
|
+
response = await self.publicSpotGetTicker(self.extend(request, params))
|
956
961
|
#
|
957
962
|
# spot
|
958
963
|
#
|
@@ -1024,14 +1029,14 @@ class digifinex(Exchange, ImplicitAPI):
|
|
1024
1029
|
"""
|
1025
1030
|
await self.load_markets()
|
1026
1031
|
market = self.market(symbol)
|
1027
|
-
method = 'publicSpotGetTicker'
|
1028
1032
|
request = {}
|
1033
|
+
response = None
|
1029
1034
|
if market['swap']:
|
1030
|
-
method = 'publicSwapGetPublicTicker'
|
1031
1035
|
request['instrument_id'] = market['id']
|
1036
|
+
response = await self.publicSwapGetPublicTicker(self.extend(request, params))
|
1032
1037
|
else:
|
1033
1038
|
request['symbol'] = market['id']
|
1034
|
-
|
1039
|
+
response = await self.publicSpotGetTicker(self.extend(request, params))
|
1035
1040
|
#
|
1036
1041
|
# spot
|
1037
1042
|
#
|
@@ -1337,16 +1342,16 @@ class digifinex(Exchange, ImplicitAPI):
|
|
1337
1342
|
"""
|
1338
1343
|
await self.load_markets()
|
1339
1344
|
market = self.market(symbol)
|
1340
|
-
method = 'publicSpotGetTrades'
|
1341
1345
|
request = {}
|
1346
|
+
if limit is not None:
|
1347
|
+
request['limit'] = min(limit, 100) if market['swap'] else limit
|
1348
|
+
response = None
|
1342
1349
|
if market['swap']:
|
1343
|
-
method = 'publicSwapGetPublicTrades'
|
1344
1350
|
request['instrument_id'] = market['id']
|
1351
|
+
response = await self.publicSwapGetPublicTrades(self.extend(request, params))
|
1345
1352
|
else:
|
1346
1353
|
request['symbol'] = market['id']
|
1347
|
-
|
1348
|
-
request['limit'] = min(limit, 100) if market['swap'] else limit
|
1349
|
-
response = await getattr(self, method)(self.extend(request, params))
|
1354
|
+
response = await self.publicSpotGetTrades(self.extend(request, params))
|
1350
1355
|
#
|
1351
1356
|
# spot
|
1352
1357
|
#
|
@@ -1435,14 +1440,14 @@ class digifinex(Exchange, ImplicitAPI):
|
|
1435
1440
|
"""
|
1436
1441
|
await self.load_markets()
|
1437
1442
|
market = self.market(symbol)
|
1438
|
-
method = 'publicSpotGetKline'
|
1439
1443
|
request = {}
|
1444
|
+
response = None
|
1440
1445
|
if market['swap']:
|
1441
|
-
method = 'publicSwapGetPublicCandles'
|
1442
1446
|
request['instrument_id'] = market['id']
|
1443
1447
|
request['granularity'] = timeframe
|
1444
1448
|
if limit is not None:
|
1445
1449
|
request['limit'] = limit
|
1450
|
+
response = await self.publicSwapGetPublicCandles(self.extend(request, params))
|
1446
1451
|
else:
|
1447
1452
|
request['symbol'] = market['id']
|
1448
1453
|
request['period'] = self.safe_string(self.timeframes, timeframe, timeframe)
|
@@ -1456,7 +1461,7 @@ class digifinex(Exchange, ImplicitAPI):
|
|
1456
1461
|
endTime = self.seconds()
|
1457
1462
|
duration = self.parse_timeframe(timeframe)
|
1458
1463
|
request['start_time'] = self.sum(endTime, -limit * duration)
|
1459
|
-
|
1464
|
+
response = await self.publicSpotGetKline(self.extend(request, params))
|
1460
1465
|
#
|
1461
1466
|
# spot
|
1462
1467
|
#
|
@@ -1551,7 +1556,7 @@ class digifinex(Exchange, ImplicitAPI):
|
|
1551
1556
|
create a list of trade orders(all orders should be of the same symbol)
|
1552
1557
|
:see: https://docs.digifinex.com/en-ww/spot/v3/rest.html#create-multiple-order
|
1553
1558
|
:see: https://docs.digifinex.com/en-ww/swap/v2/rest.html#batchorder
|
1554
|
-
:param
|
1559
|
+
: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
|
1555
1560
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1556
1561
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1557
1562
|
"""
|
@@ -1750,18 +1755,9 @@ class digifinex(Exchange, ImplicitAPI):
|
|
1750
1755
|
market = None
|
1751
1756
|
if symbol is not None:
|
1752
1757
|
market = self.market(symbol)
|
1758
|
+
id = str(id)
|
1753
1759
|
marketType = None
|
1754
1760
|
marketType, params = self.handle_market_type_and_params('cancelOrder', market, params)
|
1755
|
-
method = self.get_supported_mapping(marketType, {
|
1756
|
-
'spot': 'privateSpotPostSpotOrderCancel',
|
1757
|
-
'margin': 'privateSpotPostMarginOrderCancel',
|
1758
|
-
'swap': 'privateSwapPostTradeCancelOrder',
|
1759
|
-
})
|
1760
|
-
marginMode, query = self.handle_margin_mode_and_params('cancelOrder', params)
|
1761
|
-
if marginMode is not None:
|
1762
|
-
method = 'privateSpotPostMarginOrderCancel'
|
1763
|
-
marketType = 'margin'
|
1764
|
-
id = str(id)
|
1765
1761
|
request = {
|
1766
1762
|
'order_id': id,
|
1767
1763
|
}
|
@@ -1771,7 +1767,17 @@ class digifinex(Exchange, ImplicitAPI):
|
|
1771
1767
|
request['instrument_id'] = market['id']
|
1772
1768
|
else:
|
1773
1769
|
request['market'] = marketType
|
1774
|
-
|
1770
|
+
marginMode, query = self.handle_margin_mode_and_params('cancelOrder', params)
|
1771
|
+
response = None
|
1772
|
+
if marginMode is not None or marketType == 'margin':
|
1773
|
+
marketType = 'margin'
|
1774
|
+
response = await self.privateSpotPostMarginOrderCancel(self.extend(request, query))
|
1775
|
+
elif marketType == 'spot':
|
1776
|
+
response = await self.privateSpotPostSpotOrderCancel(self.extend(request, query))
|
1777
|
+
elif marketType == 'swap':
|
1778
|
+
response = await self.privateSwapPostTradeCancelOrder(self.extend(request, query))
|
1779
|
+
else:
|
1780
|
+
raise NotSupported(self.id + ' cancelOrder() not support self market type')
|
1775
1781
|
#
|
1776
1782
|
# spot and margin
|
1777
1783
|
#
|
@@ -1995,15 +2001,7 @@ class digifinex(Exchange, ImplicitAPI):
|
|
1995
2001
|
market = self.market(symbol)
|
1996
2002
|
marketType = None
|
1997
2003
|
marketType, params = self.handle_market_type_and_params('fetchOpenOrders', market, params)
|
1998
|
-
method = self.get_supported_mapping(marketType, {
|
1999
|
-
'spot': 'privateSpotGetSpotOrderCurrent',
|
2000
|
-
'margin': 'privateSpotGetMarginOrderCurrent',
|
2001
|
-
'swap': 'privateSwapGetTradeOpenOrders',
|
2002
|
-
})
|
2003
2004
|
marginMode, query = self.handle_margin_mode_and_params('fetchOpenOrders', params)
|
2004
|
-
if marginMode is not None:
|
2005
|
-
method = 'privateSpotGetMarginOrderCurrent'
|
2006
|
-
marketType = 'margin'
|
2007
2005
|
request = {}
|
2008
2006
|
swap = (marketType == 'swap')
|
2009
2007
|
if swap:
|
@@ -2016,7 +2014,16 @@ class digifinex(Exchange, ImplicitAPI):
|
|
2016
2014
|
if market is not None:
|
2017
2015
|
marketIdRequest = 'instrument_id' if swap else 'symbol'
|
2018
2016
|
request[marketIdRequest] = market['id']
|
2019
|
-
response =
|
2017
|
+
response = None
|
2018
|
+
if marginMode is not None or marketType == 'margin':
|
2019
|
+
marketType = 'margin'
|
2020
|
+
response = await self.privateSpotGetMarginOrderCurrent(self.extend(request, query))
|
2021
|
+
elif marketType == 'spot':
|
2022
|
+
response = await self.privateSpotGetSpotOrderCurrent(self.extend(request, query))
|
2023
|
+
elif marketType == 'swap':
|
2024
|
+
response = await self.privateSwapGetTradeOpenOrders(self.extend(request, query))
|
2025
|
+
else:
|
2026
|
+
raise NotSupported(self.id + ' fetchOpenOrders() not support self market type')
|
2020
2027
|
#
|
2021
2028
|
# spot and margin
|
2022
2029
|
#
|
@@ -2088,15 +2095,7 @@ class digifinex(Exchange, ImplicitAPI):
|
|
2088
2095
|
market = self.market(symbol)
|
2089
2096
|
marketType = None
|
2090
2097
|
marketType, params = self.handle_market_type_and_params('fetchOrders', market, params)
|
2091
|
-
method = self.get_supported_mapping(marketType, {
|
2092
|
-
'spot': 'privateSpotGetSpotOrderHistory',
|
2093
|
-
'margin': 'privateSpotGetMarginOrderHistory',
|
2094
|
-
'swap': 'privateSwapGetTradeHistoryOrders',
|
2095
|
-
})
|
2096
2098
|
marginMode, query = self.handle_margin_mode_and_params('fetchOrders', params)
|
2097
|
-
if marginMode is not None:
|
2098
|
-
method = 'privateSpotGetMarginOrderHistory'
|
2099
|
-
marketType = 'margin'
|
2100
2099
|
request = {}
|
2101
2100
|
if marketType == 'swap':
|
2102
2101
|
if since is not None:
|
@@ -2110,7 +2109,16 @@ class digifinex(Exchange, ImplicitAPI):
|
|
2110
2109
|
request[marketIdRequest] = market['id']
|
2111
2110
|
if limit is not None:
|
2112
2111
|
request['limit'] = limit
|
2113
|
-
response =
|
2112
|
+
response = None
|
2113
|
+
if marginMode is not None or marketType == 'margin':
|
2114
|
+
marketType = 'margin'
|
2115
|
+
response = await self.privateSpotGetMarginOrderHistory(self.extend(request, query))
|
2116
|
+
elif marketType == 'spot':
|
2117
|
+
response = await self.privateSpotGetSpotOrderHistory(self.extend(request, query))
|
2118
|
+
elif marketType == 'swap':
|
2119
|
+
response = await self.privateSwapGetTradeHistoryOrders(self.extend(request, query))
|
2120
|
+
else:
|
2121
|
+
raise NotSupported(self.id + ' fetchOrders() not support self market type')
|
2114
2122
|
#
|
2115
2123
|
# spot and margin
|
2116
2124
|
#
|
@@ -2181,15 +2189,7 @@ class digifinex(Exchange, ImplicitAPI):
|
|
2181
2189
|
market = self.market(symbol)
|
2182
2190
|
marketType = None
|
2183
2191
|
marketType, params = self.handle_market_type_and_params('fetchOrder', market, params)
|
2184
|
-
method = self.get_supported_mapping(marketType, {
|
2185
|
-
'spot': 'privateSpotGetSpotOrder',
|
2186
|
-
'margin': 'privateSpotGetMarginOrder',
|
2187
|
-
'swap': 'privateSwapGetTradeOrderInfo',
|
2188
|
-
})
|
2189
2192
|
marginMode, query = self.handle_margin_mode_and_params('fetchOrder', params)
|
2190
|
-
if marginMode is not None:
|
2191
|
-
method = 'privateSpotGetMarginOrder'
|
2192
|
-
marketType = 'margin'
|
2193
2193
|
request = {
|
2194
2194
|
'order_id': id,
|
2195
2195
|
}
|
@@ -2198,7 +2198,16 @@ class digifinex(Exchange, ImplicitAPI):
|
|
2198
2198
|
request['instrument_id'] = market['id']
|
2199
2199
|
else:
|
2200
2200
|
request['market'] = marketType
|
2201
|
-
response =
|
2201
|
+
response = None
|
2202
|
+
if (marginMode is not None) or (marketType == 'margin'):
|
2203
|
+
marketType = 'margin'
|
2204
|
+
response = await self.privateSpotGetMarginOrder(self.extend(request, query))
|
2205
|
+
elif marketType == 'spot':
|
2206
|
+
response = await self.privateSpotGetSpotOrder(self.extend(request, query))
|
2207
|
+
elif marketType == 'swap':
|
2208
|
+
response = await self.privateSwapGetTradeOrderInfo(self.extend(request, query))
|
2209
|
+
else:
|
2210
|
+
raise NotSupported(self.id + ' fetchOrder() not support self market type')
|
2202
2211
|
#
|
2203
2212
|
# spot and margin
|
2204
2213
|
#
|
@@ -2271,15 +2280,7 @@ class digifinex(Exchange, ImplicitAPI):
|
|
2271
2280
|
market = self.market(symbol)
|
2272
2281
|
marketType = None
|
2273
2282
|
marketType, params = self.handle_market_type_and_params('fetchMyTrades', market, params)
|
2274
|
-
method = self.get_supported_mapping(marketType, {
|
2275
|
-
'spot': 'privateSpotGetSpotMytrades',
|
2276
|
-
'margin': 'privateSpotGetMarginMytrades',
|
2277
|
-
'swap': 'privateSwapGetTradeHistoryTrades',
|
2278
|
-
})
|
2279
2283
|
marginMode, query = self.handle_margin_mode_and_params('fetchMyTrades', params)
|
2280
|
-
if marginMode is not None:
|
2281
|
-
method = 'privateSpotGetMarginMytrades'
|
2282
|
-
marketType = 'margin'
|
2283
2284
|
if marketType == 'swap':
|
2284
2285
|
if since is not None:
|
2285
2286
|
request['start_timestamp'] = since
|
@@ -2292,7 +2293,16 @@ class digifinex(Exchange, ImplicitAPI):
|
|
2292
2293
|
request[marketIdRequest] = market['id']
|
2293
2294
|
if limit is not None:
|
2294
2295
|
request['limit'] = limit
|
2295
|
-
response =
|
2296
|
+
response = None
|
2297
|
+
if marginMode is not None or marketType == 'margin':
|
2298
|
+
marketType = 'margin'
|
2299
|
+
response = await self.privateSpotGetMarginMytrades(self.extend(request, query))
|
2300
|
+
elif marketType == 'spot':
|
2301
|
+
response = await self.privateSpotGetSpotMytrades(self.extend(request, query))
|
2302
|
+
elif marketType == 'swap':
|
2303
|
+
response = await self.privateSwapGetTradeHistoryTrades(self.extend(request, query))
|
2304
|
+
else:
|
2305
|
+
raise NotSupported(self.id + ' fetchMyTrades() not support self market type')
|
2296
2306
|
#
|
2297
2307
|
# spot and margin
|
2298
2308
|
#
|
@@ -2407,15 +2417,7 @@ class digifinex(Exchange, ImplicitAPI):
|
|
2407
2417
|
request = {}
|
2408
2418
|
marketType = None
|
2409
2419
|
marketType, params = self.handle_market_type_and_params('fetchLedger', None, params)
|
2410
|
-
method = self.get_supported_mapping(marketType, {
|
2411
|
-
'spot': 'privateSpotGetSpotFinancelog',
|
2412
|
-
'margin': 'privateSpotGetMarginFinancelog',
|
2413
|
-
'swap': 'privateSwapGetAccountFinanceRecord',
|
2414
|
-
})
|
2415
2420
|
marginMode, query = self.handle_margin_mode_and_params('fetchLedger', params)
|
2416
|
-
if marginMode is not None:
|
2417
|
-
method = 'privateSpotGetMarginFinancelog'
|
2418
|
-
marketType = 'margin'
|
2419
2421
|
if marketType == 'swap':
|
2420
2422
|
if since is not None:
|
2421
2423
|
request['start_timestamp'] = since
|
@@ -2430,7 +2432,16 @@ class digifinex(Exchange, ImplicitAPI):
|
|
2430
2432
|
request[currencyIdRequest] = currency['id']
|
2431
2433
|
if limit is not None:
|
2432
2434
|
request['limit'] = limit
|
2433
|
-
response =
|
2435
|
+
response = None
|
2436
|
+
if marginMode is not None or marketType == 'margin':
|
2437
|
+
marketType = 'margin'
|
2438
|
+
response = await self.privateSpotGetMarginFinancelog(self.extend(request, query))
|
2439
|
+
elif marketType == 'spot':
|
2440
|
+
response = await self.privateSpotGetSpotFinancelog(self.extend(request, query))
|
2441
|
+
elif marketType == 'swap':
|
2442
|
+
response = await self.privateSwapGetAccountFinanceRecord(self.extend(request, query))
|
2443
|
+
else:
|
2444
|
+
raise NotSupported(self.id + ' fetchLedger() not support self market type')
|
2434
2445
|
#
|
2435
2446
|
# spot and margin
|
2436
2447
|
#
|
@@ -2540,8 +2551,11 @@ class digifinex(Exchange, ImplicitAPI):
|
|
2540
2551
|
request['currency'] = currency['id']
|
2541
2552
|
if limit is not None:
|
2542
2553
|
request['size'] = min(500, limit)
|
2543
|
-
|
2544
|
-
|
2554
|
+
response = None
|
2555
|
+
if type == 'deposit':
|
2556
|
+
response = await self.privateSpotGetDepositHistory(self.extend(request, params))
|
2557
|
+
else:
|
2558
|
+
response = await self.privateSpotGetWithdrawHistory(self.extend(request, params))
|
2545
2559
|
#
|
2546
2560
|
# {
|
2547
2561
|
# "code": 200,
|
@@ -3134,12 +3148,13 @@ class digifinex(Exchange, ImplicitAPI):
|
|
3134
3148
|
if market is not None:
|
3135
3149
|
marketIdRequest = 'instrument_id' if (marketType == 'swap') else 'symbol'
|
3136
3150
|
request[marketIdRequest] = market['id']
|
3137
|
-
|
3138
|
-
|
3139
|
-
|
3140
|
-
|
3141
|
-
|
3142
|
-
|
3151
|
+
response = None
|
3152
|
+
if marketType == 'spot' or marketType == 'margin':
|
3153
|
+
response = await self.privateSpotGetMarginPositions(self.extend(request, query))
|
3154
|
+
elif marketType == 'swap':
|
3155
|
+
response = await self.privateSwapGetAccountPositions(self.extend(request, query))
|
3156
|
+
else:
|
3157
|
+
raise NotSupported(self.id + ' fetchPositions() not support self market type')
|
3143
3158
|
#
|
3144
3159
|
# swap
|
3145
3160
|
#
|
@@ -3217,14 +3232,15 @@ class digifinex(Exchange, ImplicitAPI):
|
|
3217
3232
|
marginMode, query = self.handle_margin_mode_and_params('fetchPosition', params)
|
3218
3233
|
if marginMode is not None:
|
3219
3234
|
marketType = 'margin'
|
3220
|
-
method = self.get_supported_mapping(marketType, {
|
3221
|
-
'spot': 'privateSpotGetMarginPositions',
|
3222
|
-
'margin': 'privateSpotGetMarginPositions',
|
3223
|
-
'swap': 'privateSwapGetAccountPositions',
|
3224
|
-
})
|
3225
3235
|
marketIdRequest = 'instrument_id' if (marketType == 'swap') else 'symbol'
|
3226
3236
|
request[marketIdRequest] = market['id']
|
3227
|
-
response =
|
3237
|
+
response = None
|
3238
|
+
if marketType == 'spot' or marketType == 'margin':
|
3239
|
+
response = await self.privateSpotGetMarginPositions(self.extend(request, query))
|
3240
|
+
elif marketType == 'swap':
|
3241
|
+
response = await self.privateSwapGetAccountPositions(self.extend(request, query))
|
3242
|
+
else:
|
3243
|
+
raise NotSupported(self.id + ' fetchPosition() not support self market type')
|
3228
3244
|
#
|
3229
3245
|
# swap
|
3230
3246
|
#
|
@@ -3635,7 +3651,7 @@ class digifinex(Exchange, ImplicitAPI):
|
|
3635
3651
|
* @ignore
|
3636
3652
|
marginMode specified by params["marginMode"], self.options["marginMode"], self.options["defaultMarginMode"], params["margin"] = True or self.options["defaultType"] = 'margin'
|
3637
3653
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3638
|
-
:returns
|
3654
|
+
:returns Array: the marginMode in lowercase
|
3639
3655
|
"""
|
3640
3656
|
defaultType = self.safe_string(self.options, 'defaultType')
|
3641
3657
|
isMargin = self.safe_value(params, 'margin', False)
|
ccxt/async_support/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
|
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/async_support/htx.py
CHANGED
@@ -4881,7 +4881,7 @@ class htx(Exchange, ImplicitAPI):
|
|
4881
4881
|
:see: https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#place-a-batch-of-orders
|
4882
4882
|
:see: https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-place-a-batch-of-orders
|
4883
4883
|
:see: https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-place-a-batch-of-orders
|
4884
|
-
:param
|
4884
|
+
: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
|
4885
4885
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4886
4886
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
4887
4887
|
"""
|