ccxt 4.1.89__py2.py3-none-any.whl → 4.1.90__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ccxt might be problematic. Click here for more details.
- ccxt/__init__.py +1 -1
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +3 -3
- ccxt/async_support/binance.py +1 -1
- ccxt/async_support/bitforex.py +2 -0
- ccxt/async_support/bitget.py +9 -4
- ccxt/async_support/bitmex.py +2 -0
- ccxt/async_support/blockchaincom.py +0 -37
- ccxt/async_support/bybit.py +23 -14
- ccxt/async_support/coinlist.py +2 -0
- ccxt/async_support/coinsph.py +2 -0
- ccxt/async_support/cryptocom.py +2 -0
- ccxt/async_support/gate.py +258 -11
- ccxt/async_support/htx.py +223 -207
- ccxt/async_support/kuna.py +2 -0
- ccxt/async_support/mexc.py +2 -0
- ccxt/async_support/okcoin.py +3 -1
- ccxt/async_support/phemex.py +48 -1
- ccxt/async_support/poloniex.py +23 -2
- ccxt/async_support/tokocrypto.py +2 -0
- ccxt/async_support/wazirx.py +2 -0
- ccxt/async_support/whitebit.py +2 -0
- ccxt/base/exchange.py +3 -3
- ccxt/binance.py +1 -1
- ccxt/bitforex.py +2 -0
- ccxt/bitget.py +9 -4
- ccxt/bitmex.py +2 -0
- ccxt/blockchaincom.py +0 -37
- ccxt/bybit.py +23 -14
- ccxt/coinlist.py +2 -0
- ccxt/coinsph.py +2 -0
- ccxt/cryptocom.py +2 -0
- ccxt/gate.py +258 -11
- ccxt/htx.py +223 -207
- ccxt/kuna.py +2 -0
- ccxt/mexc.py +2 -0
- ccxt/okcoin.py +3 -1
- ccxt/phemex.py +48 -1
- ccxt/poloniex.py +23 -2
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/binance.py +6 -6
- ccxt/pro/poloniex.py +15 -11
- ccxt/tokocrypto.py +2 -0
- ccxt/wazirx.py +2 -0
- ccxt/whitebit.py +2 -0
- {ccxt-4.1.89.dist-info → ccxt-4.1.90.dist-info}/METADATA +4 -4
- {ccxt-4.1.89.dist-info → ccxt-4.1.90.dist-info}/RECORD +49 -49
- {ccxt-4.1.89.dist-info → ccxt-4.1.90.dist-info}/WHEEL +0 -0
- {ccxt-4.1.89.dist-info → ccxt-4.1.90.dist-info}/top_level.txt +0 -0
ccxt/async_support/htx.py
CHANGED
@@ -1243,22 +1243,23 @@ class htx(Exchange, ImplicitAPI):
|
|
1243
1243
|
await self.load_markets()
|
1244
1244
|
marketType = None
|
1245
1245
|
marketType, params = self.handle_market_type_and_params('fetchMyTrades', None, params)
|
1246
|
-
|
1246
|
+
response = None
|
1247
1247
|
if marketType != 'spot':
|
1248
1248
|
subType = self.safe_string(params, 'subType', self.options['defaultSubType'])
|
1249
1249
|
if marketType == 'swap':
|
1250
1250
|
if subType == 'linear':
|
1251
|
-
|
1251
|
+
response = await self.statusPublicSwapLinearGetApiV2SummaryJson()
|
1252
1252
|
elif subType == 'inverse':
|
1253
|
-
|
1253
|
+
response = await self.statusPublicSwapInverseGetApiV2SummaryJson()
|
1254
1254
|
elif marketType == 'future':
|
1255
1255
|
if subType == 'linear':
|
1256
|
-
|
1256
|
+
response = await self.statusPublicFutureLinearGetApiV2SummaryJson()
|
1257
1257
|
elif subType == 'inverse':
|
1258
|
-
|
1258
|
+
response = await self.statusPublicFutureInverseGetApiV2SummaryJson()
|
1259
1259
|
elif marketType == 'contract':
|
1260
|
-
|
1261
|
-
|
1260
|
+
response = await self.contractPublicGetHeartbeat()
|
1261
|
+
else:
|
1262
|
+
response = await self.statusPublicSpotGetApiV2SummaryJson()
|
1262
1263
|
#
|
1263
1264
|
# statusPublicSpotGetApiV2SummaryJson, statusPublicSwapInverseGetApiV2SummaryJson, statusPublicFutureLinearGetApiV2SummaryJson, statusPublicFutureInverseGetApiV2SummaryJson
|
1264
1265
|
#
|
@@ -1423,7 +1424,7 @@ class htx(Exchange, ImplicitAPI):
|
|
1423
1424
|
status = None
|
1424
1425
|
updated = None
|
1425
1426
|
url = None
|
1426
|
-
if
|
1427
|
+
if marketType == 'contract':
|
1427
1428
|
statusRaw = self.safe_string(response, 'status')
|
1428
1429
|
status = 'ok' if (statusRaw == 'ok') else 'maintenance' # 'ok', 'error'
|
1429
1430
|
updated = self.safe_string(response, 'ts')
|
@@ -1453,10 +1454,11 @@ class htx(Exchange, ImplicitAPI):
|
|
1453
1454
|
defaultType = self.safe_string(self.options, 'defaultType', 'spot')
|
1454
1455
|
type = self.safe_string(options, 'type', defaultType)
|
1455
1456
|
type = self.safe_string(params, 'type', type)
|
1456
|
-
|
1457
|
+
response = None
|
1457
1458
|
if (type == 'future') or (type == 'swap'):
|
1458
|
-
|
1459
|
-
|
1459
|
+
response = await self.contractPublicGetApiV1Timestamp(params)
|
1460
|
+
else:
|
1461
|
+
response = await self.spotPublicGetV1CommonTimestamp(params)
|
1460
1462
|
#
|
1461
1463
|
# spot
|
1462
1464
|
#
|
@@ -1612,7 +1614,6 @@ class htx(Exchange, ImplicitAPI):
|
|
1612
1614
|
return allMarkets
|
1613
1615
|
|
1614
1616
|
async def fetch_markets_by_type_and_sub_type(self, type, subType, params={}):
|
1615
|
-
method = 'spotPublicGetV1CommonSymbols'
|
1616
1617
|
query = self.omit(params, ['type', 'subType'])
|
1617
1618
|
spot = (type == 'spot')
|
1618
1619
|
contract = (type != 'spot')
|
@@ -1621,19 +1622,21 @@ class htx(Exchange, ImplicitAPI):
|
|
1621
1622
|
linear = None
|
1622
1623
|
inverse = None
|
1623
1624
|
request = {}
|
1625
|
+
response = None
|
1624
1626
|
if contract:
|
1625
1627
|
linear = (subType == 'linear')
|
1626
1628
|
inverse = (subType == 'inverse')
|
1627
1629
|
if linear:
|
1628
|
-
method = 'contractPublicGetLinearSwapApiV1SwapContractInfo'
|
1629
1630
|
if future:
|
1630
1631
|
request['business_type'] = 'futures'
|
1632
|
+
response = await self.contractPublicGetLinearSwapApiV1SwapContractInfo(self.extend(request, query))
|
1631
1633
|
elif inverse:
|
1632
1634
|
if future:
|
1633
|
-
|
1635
|
+
response = await self.contractPublicGetApiV1ContractContractInfo(self.extend(request, query))
|
1634
1636
|
elif swap:
|
1635
|
-
|
1636
|
-
|
1637
|
+
response = await self.contractPublicGetSwapApiV1SwapContractInfo(self.extend(request, query))
|
1638
|
+
else:
|
1639
|
+
response = await self.spotPublicGetV1CommonSymbols(self.extend(request, query))
|
1637
1640
|
#
|
1638
1641
|
# spot
|
1639
1642
|
#
|
@@ -1994,19 +1997,20 @@ class htx(Exchange, ImplicitAPI):
|
|
1994
1997
|
await self.load_markets()
|
1995
1998
|
market = self.market(symbol)
|
1996
1999
|
request = {}
|
1997
|
-
|
1998
|
-
method = 'spotPublicGetMarketDetailMerged'
|
2000
|
+
response = None
|
1999
2001
|
if market['linear']:
|
2000
|
-
|
2001
|
-
|
2002
|
+
request['contract_code'] = market['id']
|
2003
|
+
response = await self.contractPublicGetLinearSwapExMarketDetailMerged(self.extend(request, params))
|
2002
2004
|
elif market['inverse']:
|
2003
2005
|
if market['future']:
|
2004
|
-
|
2006
|
+
request['symbol'] = market['id']
|
2007
|
+
response = await self.contractPublicGetMarketDetailMerged(self.extend(request, params))
|
2005
2008
|
elif market['swap']:
|
2006
|
-
|
2007
|
-
|
2008
|
-
|
2009
|
-
|
2009
|
+
request['contract_code'] = market['id']
|
2010
|
+
response = await self.contractPublicGetSwapExMarketDetailMerged(self.extend(request, params))
|
2011
|
+
else:
|
2012
|
+
request['symbol'] = market['id']
|
2013
|
+
response = await self.spotPublicGetMarketDetailMerged(self.extend(request, params))
|
2010
2014
|
#
|
2011
2015
|
# spot
|
2012
2016
|
#
|
@@ -2076,7 +2080,6 @@ class htx(Exchange, ImplicitAPI):
|
|
2076
2080
|
market = self.market(first)
|
2077
2081
|
type = None
|
2078
2082
|
subType = None
|
2079
|
-
method = 'spotPublicGetMarketTickers'
|
2080
2083
|
type, params = self.handle_market_type_and_params('fetchTickers', market, params)
|
2081
2084
|
subType, params = self.handle_sub_type_and_params('fetchTickers', market, params)
|
2082
2085
|
request = {}
|
@@ -2084,18 +2087,20 @@ class htx(Exchange, ImplicitAPI):
|
|
2084
2087
|
swap = (type == 'swap')
|
2085
2088
|
linear = (subType == 'linear')
|
2086
2089
|
inverse = (subType == 'inverse')
|
2090
|
+
params = self.omit(params, ['type', 'subType'])
|
2091
|
+
response = None
|
2087
2092
|
if future or swap:
|
2088
2093
|
if linear:
|
2089
|
-
method = 'contractPublicGetLinearSwapExMarketDetailBatchMerged'
|
2090
2094
|
if future:
|
2091
2095
|
request['business_type'] = 'futures'
|
2096
|
+
response = await self.contractPublicGetLinearSwapExMarketDetailBatchMerged(self.extend(request, params))
|
2092
2097
|
elif inverse:
|
2093
2098
|
if future:
|
2094
|
-
|
2099
|
+
response = await self.contractPublicGetMarketDetailBatchMerged(self.extend(request, params))
|
2095
2100
|
elif swap:
|
2096
|
-
|
2097
|
-
|
2098
|
-
|
2101
|
+
response = await self.contractPublicGetSwapExMarketDetailBatchMerged(self.extend(request, params))
|
2102
|
+
else:
|
2103
|
+
response = await self.spotPublicGetMarketTickers(self.extend(request, params))
|
2099
2104
|
#
|
2100
2105
|
# spot
|
2101
2106
|
#
|
@@ -2219,17 +2224,17 @@ class htx(Exchange, ImplicitAPI):
|
|
2219
2224
|
# 'symbol': market['id'], # spot, future
|
2220
2225
|
# 'contract_code': market['id'], # swap
|
2221
2226
|
}
|
2222
|
-
|
2223
|
-
method = 'spotPublicGetMarketDepth'
|
2227
|
+
response = None
|
2224
2228
|
if market['linear']:
|
2225
|
-
|
2226
|
-
|
2229
|
+
request['contract_code'] = market['id']
|
2230
|
+
response = await self.contractPublicGetLinearSwapExMarketDepth(self.extend(request, params))
|
2227
2231
|
elif market['inverse']:
|
2228
2232
|
if market['future']:
|
2229
|
-
|
2233
|
+
request['symbol'] = market['id']
|
2234
|
+
response = await self.contractPublicGetMarketDepth(self.extend(request, params))
|
2230
2235
|
elif market['swap']:
|
2231
|
-
|
2232
|
-
|
2236
|
+
request['contract_code'] = market['id']
|
2237
|
+
response = await self.contractPublicGetSwapExMarketDepth(self.extend(request, params))
|
2233
2238
|
else:
|
2234
2239
|
if limit is not None:
|
2235
2240
|
# Valid depths are 5, 10, 20 or empty https://huobiapi.github.io/docs/spot/v1/en/#get-market-depth
|
@@ -2240,8 +2245,8 @@ class htx(Exchange, ImplicitAPI):
|
|
2240
2245
|
# it is not accepted by the exchange if you set it explicitly
|
2241
2246
|
if limit != 150:
|
2242
2247
|
request['depth'] = limit
|
2243
|
-
|
2244
|
-
|
2248
|
+
request['symbol'] = market['id']
|
2249
|
+
response = await self.spotPublicGetMarketDepth(self.extend(request, params))
|
2245
2250
|
#
|
2246
2251
|
# spot, future, swap
|
2247
2252
|
#
|
@@ -2477,7 +2482,7 @@ class htx(Exchange, ImplicitAPI):
|
|
2477
2482
|
# 'direct': 'prev', # next, prev
|
2478
2483
|
# 'size': limit, # default 20, max 50
|
2479
2484
|
}
|
2480
|
-
|
2485
|
+
response = None
|
2481
2486
|
if marketType == 'spot':
|
2482
2487
|
if symbol is not None:
|
2483
2488
|
market = self.market(symbol)
|
@@ -2488,7 +2493,7 @@ class htx(Exchange, ImplicitAPI):
|
|
2488
2493
|
request['start-time'] = since # a date within 120 days from today
|
2489
2494
|
# request['end-time'] = self.sum(since, 172800000) # 48 hours window
|
2490
2495
|
request, params = self.handle_until_option('end-time', request, params)
|
2491
|
-
|
2496
|
+
response = await self.spotPrivateGetV1OrderMatchresults(self.extend(request, params))
|
2492
2497
|
else:
|
2493
2498
|
if symbol is None:
|
2494
2499
|
raise ArgumentsRequired(self.id + ' fetchMyTrades() requires a symbol argument')
|
@@ -2505,18 +2510,17 @@ class htx(Exchange, ImplicitAPI):
|
|
2505
2510
|
marginMode, params = self.handle_margin_mode_and_params('fetchMyTrades', params)
|
2506
2511
|
marginMode = 'cross' if (marginMode is None) else marginMode
|
2507
2512
|
if marginMode == 'isolated':
|
2508
|
-
|
2513
|
+
response = await self.contractPrivatePostLinearSwapApiV3SwapMatchresultsExact(self.extend(request, params))
|
2509
2514
|
elif marginMode == 'cross':
|
2510
|
-
|
2515
|
+
response = await self.contractPrivatePostLinearSwapApiV3SwapCrossMatchresultsExact(self.extend(request, params))
|
2511
2516
|
elif market['inverse']:
|
2512
2517
|
if marketType == 'future':
|
2513
|
-
method = 'contractPrivatePostApiV3ContractMatchresultsExact'
|
2514
2518
|
request['symbol'] = market['settleId']
|
2519
|
+
response = await self.contractPrivatePostApiV3ContractMatchresultsExact(self.extend(request, params))
|
2515
2520
|
elif marketType == 'swap':
|
2516
|
-
|
2521
|
+
response = await self.contractPrivatePostSwapApiV3SwapMatchresultsExact(self.extend(request, params))
|
2517
2522
|
else:
|
2518
2523
|
raise NotSupported(self.id + ' fetchMyTrades() does not support ' + marketType + ' markets')
|
2519
|
-
response = await getattr(self, method)(self.extend(request, params))
|
2520
2524
|
#
|
2521
2525
|
# spot
|
2522
2526
|
#
|
@@ -2607,24 +2611,25 @@ class htx(Exchange, ImplicitAPI):
|
|
2607
2611
|
# 'symbol': market['id'], # spot, future
|
2608
2612
|
# 'contract_code': market['id'], # swap
|
2609
2613
|
}
|
2610
|
-
|
2611
|
-
|
2614
|
+
if limit is not None:
|
2615
|
+
request['size'] = min(limit, 2000) # max 2000
|
2616
|
+
response = None
|
2612
2617
|
if market['future']:
|
2613
2618
|
if market['inverse']:
|
2614
|
-
|
2619
|
+
request['symbol'] = market['id']
|
2620
|
+
response = await self.contractPublicGetMarketHistoryTrade(self.extend(request, params))
|
2615
2621
|
elif market['linear']:
|
2616
|
-
|
2617
|
-
|
2622
|
+
request['contract_code'] = market['id']
|
2623
|
+
response = await self.contractPublicGetLinearSwapExMarketHistoryTrade(self.extend(request, params))
|
2618
2624
|
elif market['swap']:
|
2625
|
+
request['contract_code'] = market['id']
|
2619
2626
|
if market['inverse']:
|
2620
|
-
|
2627
|
+
response = await self.contractPublicGetSwapExMarketHistoryTrade(self.extend(request, params))
|
2621
2628
|
elif market['linear']:
|
2622
|
-
|
2623
|
-
|
2624
|
-
|
2625
|
-
|
2626
|
-
request['size'] = min(limit, 2000) # max 2000
|
2627
|
-
response = await getattr(self, method)(self.extend(request, params))
|
2629
|
+
response = await self.contractPublicGetLinearSwapExMarketHistoryTrade(self.extend(request, params))
|
2630
|
+
else:
|
2631
|
+
request['symbol'] = market['id']
|
2632
|
+
response = await self.spotPublicGetMarketHistoryTrade(self.extend(request, params))
|
2628
2633
|
#
|
2629
2634
|
# {
|
2630
2635
|
# "status": "ok",
|
@@ -2710,77 +2715,78 @@ class htx(Exchange, ImplicitAPI):
|
|
2710
2715
|
# 'from': int((since / str(1000))), spot only
|
2711
2716
|
# 'to': self.seconds(), spot only
|
2712
2717
|
}
|
2713
|
-
fieldName = 'symbol'
|
2714
2718
|
price = self.safe_string(params, 'price')
|
2715
2719
|
params = self.omit(params, 'price')
|
2716
|
-
|
2717
|
-
if market['spot']:
|
2718
|
-
if timeframe == '1M' or timeframe == '1y':
|
2719
|
-
# for some reason 1M and 1Y does not work with the regular endpoint
|
2720
|
-
# https://github.com/ccxt/ccxt/issues/18006
|
2721
|
-
method = 'spotPublicGetMarketHistoryKline'
|
2722
|
-
if since is not None:
|
2723
|
-
request['from'] = self.parse_to_int(since / 1000)
|
2720
|
+
if market['contract']:
|
2724
2721
|
if limit is not None:
|
2725
|
-
request['size'] = limit #
|
2726
|
-
|
2722
|
+
request['size'] = limit # when using limit from and to are ignored
|
2723
|
+
# https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-get-kline-data
|
2724
|
+
else:
|
2725
|
+
limit = 2000 # only used for from/to calculation
|
2726
|
+
if price is None:
|
2727
|
+
duration = self.parse_timeframe(timeframe)
|
2728
|
+
if since is None:
|
2729
|
+
now = self.seconds()
|
2730
|
+
request['from'] = now - duration * (limit - 1)
|
2731
|
+
request['to'] = now
|
2732
|
+
else:
|
2733
|
+
start = self.parse_to_int(since / 1000)
|
2734
|
+
request['from'] = start
|
2735
|
+
request['to'] = self.sum(start, duration * (limit - 1))
|
2736
|
+
response = None
|
2737
|
+
if market['future']:
|
2727
2738
|
if market['inverse']:
|
2739
|
+
request['symbol'] = market['id']
|
2728
2740
|
if price == 'mark':
|
2729
|
-
|
2741
|
+
response = await self.contractPublicGetIndexMarketHistoryMarkPriceKline(self.extend(request, params))
|
2730
2742
|
elif price == 'index':
|
2731
|
-
|
2743
|
+
response = await self.contractPublicGetIndexMarketHistoryIndex(self.extend(request, params))
|
2732
2744
|
elif price == 'premiumIndex':
|
2733
2745
|
raise BadRequest(self.id + ' ' + market['type'] + ' has no api endpoint for ' + price + ' kline data')
|
2734
2746
|
else:
|
2735
|
-
|
2747
|
+
response = await self.contractPublicGetMarketHistoryKline(self.extend(request, params))
|
2736
2748
|
elif market['linear']:
|
2749
|
+
request['contract_code'] = market['id']
|
2737
2750
|
if price == 'mark':
|
2738
|
-
|
2751
|
+
response = await self.contractPublicGetIndexMarketHistoryLinearSwapMarkPriceKline(self.extend(request, params))
|
2739
2752
|
elif price == 'index':
|
2740
2753
|
raise BadRequest(self.id + ' ' + market['type'] + ' has no api endpoint for ' + price + ' kline data')
|
2741
2754
|
elif price == 'premiumIndex':
|
2742
|
-
|
2755
|
+
response = await self.contractPublicGetIndexMarketHistoryLinearSwapPremiumIndexKline(self.extend(request, params))
|
2743
2756
|
else:
|
2744
|
-
|
2745
|
-
fieldName = 'contract_code'
|
2757
|
+
response = await self.contractPublicGetLinearSwapExMarketHistoryKline(self.extend(request, params))
|
2746
2758
|
elif market['swap']:
|
2759
|
+
request['contract_code'] = market['id']
|
2747
2760
|
if market['inverse']:
|
2748
2761
|
if price == 'mark':
|
2749
|
-
|
2762
|
+
response = await self.contractPublicGetIndexMarketHistorySwapMarkPriceKline(self.extend(request, params))
|
2750
2763
|
elif price == 'index':
|
2751
2764
|
raise BadRequest(self.id + ' ' + market['type'] + ' has no api endpoint for ' + price + ' kline data')
|
2752
2765
|
elif price == 'premiumIndex':
|
2753
|
-
|
2766
|
+
response = await self.contractPublicGetIndexMarketHistorySwapPremiumIndexKline(self.extend(request, params))
|
2754
2767
|
else:
|
2755
|
-
|
2768
|
+
response = await self.contractPublicGetSwapExMarketHistoryKline(self.extend(request, params))
|
2756
2769
|
elif market['linear']:
|
2757
2770
|
if price == 'mark':
|
2758
|
-
|
2771
|
+
response = await self.contractPublicGetIndexMarketHistoryLinearSwapMarkPriceKline(self.extend(request, params))
|
2759
2772
|
elif price == 'index':
|
2760
2773
|
raise BadRequest(self.id + ' ' + market['type'] + ' has no api endpoint for ' + price + ' kline data')
|
2761
2774
|
elif price == 'premiumIndex':
|
2762
|
-
|
2775
|
+
response = await self.contractPublicGetIndexMarketHistoryLinearSwapPremiumIndexKline(self.extend(request, params))
|
2763
2776
|
else:
|
2764
|
-
|
2765
|
-
|
2766
|
-
|
2777
|
+
response = await self.contractPublicGetLinearSwapExMarketHistoryKline(self.extend(request, params))
|
2778
|
+
else:
|
2779
|
+
if since is not None:
|
2780
|
+
request['from'] = self.parse_to_int(since / 1000)
|
2767
2781
|
if limit is not None:
|
2768
|
-
request['size'] = limit #
|
2769
|
-
|
2782
|
+
request['size'] = limit # max 2000
|
2783
|
+
request['symbol'] = market['id']
|
2784
|
+
if timeframe == '1M' or timeframe == '1y':
|
2785
|
+
# for some reason 1M and 1Y does not work with the regular endpoint
|
2786
|
+
# https://github.com/ccxt/ccxt/issues/18006
|
2787
|
+
response = await self.spotPublicGetMarketHistoryKline(self.extend(request, params))
|
2770
2788
|
else:
|
2771
|
-
|
2772
|
-
if price is None:
|
2773
|
-
duration = self.parse_timeframe(timeframe)
|
2774
|
-
if since is None:
|
2775
|
-
now = self.seconds()
|
2776
|
-
request['from'] = now - duration * (limit - 1)
|
2777
|
-
request['to'] = now
|
2778
|
-
else:
|
2779
|
-
start = self.parse_to_int(since / 1000)
|
2780
|
-
request['from'] = start
|
2781
|
-
request['to'] = self.sum(start, duration * (limit - 1))
|
2782
|
-
request[fieldName] = market['id']
|
2783
|
-
response = await getattr(self, method)(self.extend(request, params))
|
2789
|
+
response = await self.spotPublicGetMarketHistoryCandles(self.extend(request, params))
|
2784
2790
|
#
|
2785
2791
|
# {
|
2786
2792
|
# "status":"ok",
|
@@ -3342,44 +3348,43 @@ class htx(Exchange, ImplicitAPI):
|
|
3342
3348
|
# 'pair': 'BTC-USDT',
|
3343
3349
|
# 'contract_type': 'this_week', # swap, self_week, next_week, quarter, next_ quarter
|
3344
3350
|
}
|
3345
|
-
|
3351
|
+
response = None
|
3346
3352
|
if marketType == 'spot':
|
3347
3353
|
clientOrderId = self.safe_string(params, 'clientOrderId')
|
3348
|
-
method = 'spotPrivateGetV1OrderOrdersOrderId'
|
3349
3354
|
if clientOrderId is not None:
|
3350
|
-
method = 'spotPrivateGetV1OrderOrdersGetClientOrder'
|
3351
3355
|
# will be filled below in self.extend()
|
3352
3356
|
# they expect clientOrderId instead of client-order-id
|
3353
3357
|
# request['clientOrderId'] = clientOrderId
|
3358
|
+
response = await self.spotPrivateGetV1OrderOrdersGetClientOrder(self.extend(request, params))
|
3354
3359
|
else:
|
3355
3360
|
request['order-id'] = id
|
3361
|
+
response = await self.spotPrivateGetV1OrderOrdersOrderId(self.extend(request, params))
|
3356
3362
|
else:
|
3357
3363
|
if symbol is None:
|
3358
3364
|
raise ArgumentsRequired(self.id + ' fetchOrder() requires a symbol argument')
|
3365
|
+
clientOrderId = self.safe_string_2(params, 'client_order_id', 'clientOrderId')
|
3366
|
+
if clientOrderId is None:
|
3367
|
+
request['order_id'] = id
|
3368
|
+
else:
|
3369
|
+
request['client_order_id'] = clientOrderId
|
3370
|
+
params = self.omit(params, ['client_order_id', 'clientOrderId'])
|
3359
3371
|
request['contract_code'] = market['id']
|
3360
3372
|
if market['linear']:
|
3361
3373
|
marginMode = None
|
3362
3374
|
marginMode, params = self.handle_margin_mode_and_params('fetchOrder', params)
|
3363
3375
|
marginMode = 'cross' if (marginMode is None) else marginMode
|
3364
3376
|
if marginMode == 'isolated':
|
3365
|
-
|
3377
|
+
response = await self.contractPrivatePostLinearSwapApiV1SwapOrderInfo(self.extend(request, params))
|
3366
3378
|
elif marginMode == 'cross':
|
3367
|
-
|
3379
|
+
response = await self.contractPrivatePostLinearSwapApiV1SwapCrossOrderInfo(self.extend(request, params))
|
3368
3380
|
elif market['inverse']:
|
3369
3381
|
if marketType == 'future':
|
3370
|
-
method = 'contractPrivatePostApiV1ContractOrderInfo'
|
3371
3382
|
request['symbol'] = market['settleId']
|
3383
|
+
response = await self.contractPrivatePostApiV1ContractOrderInfo(self.extend(request, params))
|
3372
3384
|
elif marketType == 'swap':
|
3373
|
-
|
3385
|
+
response = await self.contractPrivatePostSwapApiV1SwapOrderInfo(self.extend(request, params))
|
3374
3386
|
else:
|
3375
3387
|
raise NotSupported(self.id + ' fetchOrder() does not support ' + marketType + ' markets')
|
3376
|
-
clientOrderId = self.safe_string_2(params, 'client_order_id', 'clientOrderId')
|
3377
|
-
if clientOrderId is None:
|
3378
|
-
request['order_id'] = id
|
3379
|
-
else:
|
3380
|
-
request['client_order_id'] = clientOrderId
|
3381
|
-
params = self.omit(params, ['client_order_id', 'clientOrderId'])
|
3382
|
-
response = await getattr(self, method)(self.extend(request, params))
|
3383
3388
|
#
|
3384
3389
|
# spot
|
3385
3390
|
#
|
@@ -5774,7 +5779,6 @@ class htx(Exchange, ImplicitAPI):
|
|
5774
5779
|
}
|
5775
5780
|
subType = None
|
5776
5781
|
subType, params = self.handle_sub_type_and_params('transfer', None, params)
|
5777
|
-
method = None
|
5778
5782
|
fromAccountId = self.convert_type_to_account(fromAccount)
|
5779
5783
|
toAccountId = self.convert_type_to_account(toAccount)
|
5780
5784
|
toCross = toAccountId == 'cross'
|
@@ -5786,23 +5790,23 @@ class htx(Exchange, ImplicitAPI):
|
|
5786
5790
|
if fromSpot and toSpot:
|
5787
5791
|
raise BadRequest(self.id + ' transfer() cannot make a transfer between ' + fromAccount + ' and ' + toAccount)
|
5788
5792
|
fromOrToFuturesAccount = (fromAccountId == 'futures') or (toAccountId == 'futures')
|
5793
|
+
response = None
|
5789
5794
|
if fromOrToFuturesAccount:
|
5790
5795
|
type = fromAccountId + '-to-' + toAccountId
|
5791
5796
|
type = self.safe_string(params, 'type', type)
|
5792
5797
|
request['type'] = type
|
5793
|
-
|
5798
|
+
response = await self.spotPrivatePostV1FuturesTransfer(self.extend(request, params))
|
5794
5799
|
elif fromSpot and toCross:
|
5795
|
-
|
5800
|
+
response = await self.privatePostCrossMarginTransferIn(self.extend(request, params))
|
5796
5801
|
elif fromCross and toSpot:
|
5797
|
-
|
5802
|
+
response = await self.privatePostCrossMarginTransferOut(self.extend(request, params))
|
5798
5803
|
elif fromSpot and toIsolated:
|
5799
5804
|
request['symbol'] = toAccountId
|
5800
|
-
|
5805
|
+
response = await self.privatePostDwTransferInMargin(self.extend(request, params))
|
5801
5806
|
elif fromIsolated and toSpot:
|
5802
5807
|
request['symbol'] = fromAccountId
|
5803
|
-
|
5808
|
+
response = await self.privatePostDwTransferOutMargin(self.extend(request, params))
|
5804
5809
|
else:
|
5805
|
-
method = 'v2PrivatePostAccountTransfer'
|
5806
5810
|
if subType == 'linear':
|
5807
5811
|
if (fromAccountId == 'swap') or (fromAccount == 'linear-swap'):
|
5808
5812
|
fromAccountId = 'linear-swap'
|
@@ -5818,7 +5822,7 @@ class htx(Exchange, ImplicitAPI):
|
|
5818
5822
|
request['margin-account'] = 'USDT' # cross-margin
|
5819
5823
|
request['from'] = 'spot' if fromSpot else fromAccountId
|
5820
5824
|
request['to'] = 'spot' if toSpot else toAccountId
|
5821
|
-
|
5825
|
+
response = await self.v2PrivatePostAccountTransfer(self.extend(request, params))
|
5822
5826
|
#
|
5823
5827
|
# {
|
5824
5828
|
# "code": "200",
|
@@ -5938,14 +5942,13 @@ class htx(Exchange, ImplicitAPI):
|
|
5938
5942
|
request = {
|
5939
5943
|
'contract_code': market['id'],
|
5940
5944
|
}
|
5941
|
-
|
5945
|
+
response = None
|
5942
5946
|
if market['inverse']:
|
5943
|
-
|
5947
|
+
response = await self.contractPublicGetSwapApiV1SwapHistoricalFundingRate(self.extend(request, params))
|
5944
5948
|
elif market['linear']:
|
5945
|
-
|
5949
|
+
response = await self.contractPublicGetLinearSwapApiV1SwapHistoricalFundingRate(self.extend(request, params))
|
5946
5950
|
else:
|
5947
5951
|
raise NotSupported(self.id + ' fetchFundingRateHistory() supports inverse and linear swaps only')
|
5948
|
-
response = await getattr(self, method)(self.extend(request, params))
|
5949
5952
|
#
|
5950
5953
|
# {
|
5951
5954
|
# "status": "ok",
|
@@ -6038,17 +6041,16 @@ class htx(Exchange, ImplicitAPI):
|
|
6038
6041
|
"""
|
6039
6042
|
await self.load_markets()
|
6040
6043
|
market = self.market(symbol)
|
6041
|
-
|
6044
|
+
request = {
|
6045
|
+
'contract_code': market['id'],
|
6046
|
+
}
|
6047
|
+
response = None
|
6042
6048
|
if market['inverse']:
|
6043
|
-
|
6049
|
+
response = await self.contractPublicGetSwapApiV1SwapFundingRate(self.extend(request, params))
|
6044
6050
|
elif market['linear']:
|
6045
|
-
|
6051
|
+
response = await self.contractPublicGetLinearSwapApiV1SwapFundingRate(self.extend(request, params))
|
6046
6052
|
else:
|
6047
6053
|
raise NotSupported(self.id + ' fetchFundingRate() supports inverse and linear swaps only')
|
6048
|
-
request = {
|
6049
|
-
'contract_code': market['id'],
|
6050
|
-
}
|
6051
|
-
response = await getattr(self, method)(self.extend(request, params))
|
6052
6054
|
#
|
6053
6055
|
# {
|
6054
6056
|
# "status": "ok",
|
@@ -6083,12 +6085,14 @@ class htx(Exchange, ImplicitAPI):
|
|
6083
6085
|
request = {
|
6084
6086
|
# 'contract_code': market['id'],
|
6085
6087
|
}
|
6086
|
-
method = self.get_supported_mapping(subType, {
|
6087
|
-
'linear': 'contractPublicGetLinearSwapApiV1SwapBatchFundingRate',
|
6088
|
-
'inverse': 'contractPublicGetSwapApiV1SwapBatchFundingRate',
|
6089
|
-
})
|
6090
6088
|
params = self.omit(params, 'subType')
|
6091
|
-
response =
|
6089
|
+
response = None
|
6090
|
+
if subType == 'linear':
|
6091
|
+
response = await self.contractPublicGetLinearSwapApiV1SwapBatchFundingRate(self.extend(request, params))
|
6092
|
+
elif subType == 'inverse':
|
6093
|
+
response = await self.contractPublicGetSwapApiV1SwapBatchFundingRate(self.extend(request, params))
|
6094
|
+
else:
|
6095
|
+
raise NotSupported(self.id + ' fetchFundingRates() not support self market type')
|
6092
6096
|
#
|
6093
6097
|
# {
|
6094
6098
|
# "status": "ok",
|
@@ -6131,18 +6135,17 @@ class htx(Exchange, ImplicitAPI):
|
|
6131
6135
|
if limit is not None:
|
6132
6136
|
request['size'] = limit
|
6133
6137
|
market = None
|
6134
|
-
|
6138
|
+
response = None
|
6135
6139
|
if marginMode == 'isolated':
|
6136
|
-
method = 'privateGetMarginLoanOrders'
|
6137
6140
|
if symbol is not None:
|
6138
6141
|
market = self.market(symbol)
|
6139
6142
|
request['symbol'] = market['id']
|
6143
|
+
response = await self.privateGetMarginLoanOrders(self.extend(request, params))
|
6140
6144
|
else: # Cross
|
6141
|
-
method = 'privateGetCrossMarginLoanOrders'
|
6142
6145
|
if code is not None:
|
6143
6146
|
currency = self.currency(code)
|
6144
6147
|
request['currency'] = currency['id']
|
6145
|
-
|
6148
|
+
response = await self.privateGetCrossMarginLoanOrders(self.extend(request, params))
|
6146
6149
|
#
|
6147
6150
|
# {
|
6148
6151
|
# "status":"ok",
|
@@ -6375,16 +6378,15 @@ class htx(Exchange, ImplicitAPI):
|
|
6375
6378
|
await self.load_markets()
|
6376
6379
|
market = self.market(symbol)
|
6377
6380
|
marketType, query = self.handle_market_type_and_params('fetchFundingHistory', market, params)
|
6378
|
-
method = None
|
6379
6381
|
request = {
|
6380
6382
|
'type': '30,31',
|
6381
6383
|
}
|
6382
6384
|
if since is not None:
|
6383
6385
|
request['start_date'] = since
|
6386
|
+
response = None
|
6384
6387
|
if marketType == 'swap':
|
6385
6388
|
request['contract'] = market['id']
|
6386
6389
|
if market['linear']:
|
6387
|
-
method = 'contractPrivatePostLinearSwapApiV3SwapFinancialRecordExact'
|
6388
6390
|
#
|
6389
6391
|
# {
|
6390
6392
|
# "status": "ok",
|
@@ -6414,8 +6416,8 @@ class htx(Exchange, ImplicitAPI):
|
|
6414
6416
|
request['mar_acct'] = market['id']
|
6415
6417
|
else:
|
6416
6418
|
request['mar_acct'] = market['quoteId']
|
6419
|
+
response = await self.contractPrivatePostLinearSwapApiV3SwapFinancialRecordExact(self.extend(request, query))
|
6417
6420
|
else:
|
6418
|
-
method = 'contractPrivatePostSwapApiV3SwapFinancialRecordExact'
|
6419
6421
|
#
|
6420
6422
|
# {
|
6421
6423
|
# "code": 200,
|
@@ -6436,10 +6438,10 @@ class htx(Exchange, ImplicitAPI):
|
|
6436
6438
|
# "ts": 1604312615051
|
6437
6439
|
# }
|
6438
6440
|
#
|
6441
|
+
response = await self.contractPrivatePostSwapApiV3SwapFinancialRecordExact(self.extend(request, query))
|
6439
6442
|
else:
|
6440
|
-
method = 'contractPrivatePostApiV3ContractFinancialRecordExact'
|
6441
6443
|
request['symbol'] = market['id']
|
6442
|
-
|
6444
|
+
response = await self.contractPrivatePostApiV3ContractFinancialRecordExact(self.extend(request, query))
|
6443
6445
|
data = self.safe_value(response, 'data', [])
|
6444
6446
|
return self.parse_incomes(data, market, since, limit)
|
6445
6447
|
|
@@ -6456,15 +6458,24 @@ class htx(Exchange, ImplicitAPI):
|
|
6456
6458
|
await self.load_markets()
|
6457
6459
|
market = self.market(symbol)
|
6458
6460
|
marketType, query = self.handle_market_type_and_params('setLeverage', market, params)
|
6459
|
-
|
6461
|
+
request = {
|
6462
|
+
'lever_rate': leverage,
|
6463
|
+
}
|
6464
|
+
if marketType == 'future' and market['inverse']:
|
6465
|
+
request['symbol'] = market['settleId']
|
6466
|
+
else:
|
6467
|
+
request['contract_code'] = market['id']
|
6468
|
+
response = None
|
6460
6469
|
if market['linear']:
|
6461
6470
|
marginMode = None
|
6462
6471
|
marginMode, params = self.handle_margin_mode_and_params('setLeverage', params)
|
6463
6472
|
marginMode = 'cross' if (marginMode is None) else marginMode
|
6464
|
-
|
6465
|
-
|
6466
|
-
|
6467
|
-
|
6473
|
+
if marginMode == 'isolated':
|
6474
|
+
response = await self.contractPrivatePostLinearSwapApiV1SwapSwitchLeverRate(self.extend(request, query))
|
6475
|
+
elif marginMode == 'cross':
|
6476
|
+
response = await self.contractPrivatePostLinearSwapApiV1SwapCrossSwitchLeverRate(self.extend(request, query))
|
6477
|
+
else:
|
6478
|
+
raise NotSupported(self.id + ' setLeverage() not support self market type')
|
6468
6479
|
#
|
6469
6480
|
# {
|
6470
6481
|
# "status": "ok",
|
@@ -6477,10 +6488,12 @@ class htx(Exchange, ImplicitAPI):
|
|
6477
6488
|
# }
|
6478
6489
|
#
|
6479
6490
|
else:
|
6480
|
-
|
6481
|
-
|
6482
|
-
|
6483
|
-
|
6491
|
+
if marketType == 'future':
|
6492
|
+
response = await self.contractPrivatePostApiV1ContractSwitchLeverRate(self.extend(request, query))
|
6493
|
+
elif marketType == 'swap':
|
6494
|
+
response = await self.contractPrivatePostSwapApiV1SwapSwitchLeverRate(self.extend(request, query))
|
6495
|
+
else:
|
6496
|
+
raise NotSupported(self.id + ' setLeverage() not support self market type')
|
6484
6497
|
#
|
6485
6498
|
# future
|
6486
6499
|
# {
|
@@ -6497,14 +6510,6 @@ class htx(Exchange, ImplicitAPI):
|
|
6497
6510
|
# "ts": "1641184652979"
|
6498
6511
|
# }
|
6499
6512
|
#
|
6500
|
-
request = {
|
6501
|
-
'lever_rate': leverage,
|
6502
|
-
}
|
6503
|
-
if marketType == 'future' and market['inverse']:
|
6504
|
-
request['symbol'] = market['settleId']
|
6505
|
-
else:
|
6506
|
-
request['contract_code'] = market['id']
|
6507
|
-
response = await getattr(self, method)(self.extend(request, query))
|
6508
6513
|
return response
|
6509
6514
|
|
6510
6515
|
def parse_income(self, income, market: Market = None):
|
@@ -6646,12 +6651,14 @@ class htx(Exchange, ImplicitAPI):
|
|
6646
6651
|
marketType, params = self.handle_market_type_and_params('fetchPositions', market, params)
|
6647
6652
|
if marketType == 'spot':
|
6648
6653
|
marketType = 'future'
|
6649
|
-
|
6654
|
+
response = None
|
6650
6655
|
if subType == 'linear':
|
6651
|
-
|
6652
|
-
|
6653
|
-
|
6654
|
-
|
6656
|
+
if marginMode == 'isolated':
|
6657
|
+
response = await self.contractPrivatePostLinearSwapApiV1SwapPositionInfo(params)
|
6658
|
+
elif marginMode == 'cross':
|
6659
|
+
response = await self.contractPrivatePostLinearSwapApiV1SwapCrossPositionInfo(params)
|
6660
|
+
else:
|
6661
|
+
raise NotSupported(self.id + ' fetchPositions() not support self market type')
|
6655
6662
|
#
|
6656
6663
|
# {
|
6657
6664
|
# "status": "ok",
|
@@ -6680,10 +6687,12 @@ class htx(Exchange, ImplicitAPI):
|
|
6680
6687
|
# }
|
6681
6688
|
#
|
6682
6689
|
else:
|
6683
|
-
|
6684
|
-
|
6685
|
-
|
6686
|
-
|
6690
|
+
if marketType == 'future':
|
6691
|
+
response = await self.contractPrivatePostApiV1ContractPositionInfo(params)
|
6692
|
+
elif marketType == 'swap':
|
6693
|
+
response = await self.contractPrivatePostSwapApiV1SwapPositionInfo(params)
|
6694
|
+
else:
|
6695
|
+
raise NotSupported(self.id + ' fetchPositions() not support self market type')
|
6687
6696
|
#
|
6688
6697
|
# future
|
6689
6698
|
# {
|
@@ -6734,7 +6743,6 @@ class htx(Exchange, ImplicitAPI):
|
|
6734
6743
|
# "ts": "1641109636572"
|
6735
6744
|
# }
|
6736
6745
|
#
|
6737
|
-
response = await getattr(self, method)(params)
|
6738
6746
|
data = self.safe_value(response, 'data', [])
|
6739
6747
|
timestamp = self.safe_integer(response, 'ts')
|
6740
6748
|
result = []
|
@@ -6760,12 +6768,21 @@ class htx(Exchange, ImplicitAPI):
|
|
6760
6768
|
marginMode, params = self.handle_margin_mode_and_params('fetchPosition', params)
|
6761
6769
|
marginMode = 'cross' if (marginMode is None) else marginMode
|
6762
6770
|
marketType, query = self.handle_market_type_and_params('fetchPosition', market, params)
|
6763
|
-
|
6771
|
+
request = {}
|
6772
|
+
if market['future'] and market['inverse']:
|
6773
|
+
request['symbol'] = market['settleId']
|
6774
|
+
else:
|
6775
|
+
if marginMode == 'cross':
|
6776
|
+
request['margin_account'] = 'USDT' # only allowed value
|
6777
|
+
request['contract_code'] = market['id']
|
6778
|
+
response = None
|
6764
6779
|
if market['linear']:
|
6765
|
-
|
6766
|
-
|
6767
|
-
|
6768
|
-
|
6780
|
+
if marginMode == 'isolated':
|
6781
|
+
response = await self.contractPrivatePostLinearSwapApiV1SwapAccountPositionInfo(self.extend(request, query))
|
6782
|
+
elif marginMode == 'cross':
|
6783
|
+
response = await self.contractPrivatePostLinearSwapApiV1SwapCrossAccountPositionInfo(self.extend(request, query))
|
6784
|
+
else:
|
6785
|
+
raise NotSupported(self.id + ' fetchPosition() not support self market type')
|
6769
6786
|
#
|
6770
6787
|
# isolated
|
6771
6788
|
#
|
@@ -6884,10 +6901,12 @@ class htx(Exchange, ImplicitAPI):
|
|
6884
6901
|
# }
|
6885
6902
|
#
|
6886
6903
|
else:
|
6887
|
-
|
6888
|
-
|
6889
|
-
|
6890
|
-
|
6904
|
+
if marketType == 'future':
|
6905
|
+
response = await self.contractPrivatePostApiV1ContractAccountPositionInfo(self.extend(request, query))
|
6906
|
+
elif marketType == 'swap':
|
6907
|
+
response = await self.contractPrivatePostSwapApiV1SwapAccountPositionInfo(self.extend(request, query))
|
6908
|
+
else:
|
6909
|
+
raise NotSupported(self.id + ' setLeverage() not support self market type')
|
6891
6910
|
#
|
6892
6911
|
# future, swap
|
6893
6912
|
#
|
@@ -6957,14 +6976,6 @@ class htx(Exchange, ImplicitAPI):
|
|
6957
6976
|
# "ts":"1645521118946"
|
6958
6977
|
# }
|
6959
6978
|
#
|
6960
|
-
request = {}
|
6961
|
-
if market['future'] and market['inverse']:
|
6962
|
-
request['symbol'] = market['settleId']
|
6963
|
-
else:
|
6964
|
-
if marginMode == 'cross':
|
6965
|
-
request['margin_account'] = 'USDT' # only allowed value
|
6966
|
-
request['contract_code'] = market['id']
|
6967
|
-
response = await getattr(self, method)(self.extend(request, query))
|
6968
6979
|
data = self.safe_value(response, 'data')
|
6969
6980
|
account = None
|
6970
6981
|
if marginMode == 'cross':
|
@@ -7270,22 +7281,24 @@ class htx(Exchange, ImplicitAPI):
|
|
7270
7281
|
'period': timeframes[timeframe],
|
7271
7282
|
'amount_type': amountType,
|
7272
7283
|
}
|
7273
|
-
|
7284
|
+
if limit is not None:
|
7285
|
+
request['size'] = limit
|
7286
|
+
response = None
|
7274
7287
|
if market['future']:
|
7275
7288
|
request['contract_type'] = self.safe_string(market['info'], 'contract_type')
|
7276
7289
|
request['symbol'] = market['baseId'] # currency code on coin-m futures
|
7277
|
-
|
7290
|
+
# coin-m futures
|
7291
|
+
response = await self.contractPublicGetApiV1ContractHisOpenInterest(self.extend(request, params))
|
7278
7292
|
elif market['linear']:
|
7279
7293
|
request['contract_type'] = 'swap'
|
7280
7294
|
request['contract_code'] = market['id']
|
7281
7295
|
request['contract_code'] = market['id']
|
7282
|
-
|
7296
|
+
# USDT-M
|
7297
|
+
response = await self.contractPublicGetLinearSwapApiV1SwapHisOpenInterest(self.extend(request, params))
|
7283
7298
|
else:
|
7284
7299
|
request['contract_code'] = market['id']
|
7285
|
-
|
7286
|
-
|
7287
|
-
request['size'] = limit
|
7288
|
-
response = await getattr(self, method)(self.extend(request, params))
|
7300
|
+
# coin-m swaps
|
7301
|
+
response = await self.contractPublicGetSwapApiV1SwapHisOpenInterest(self.extend(request, params))
|
7289
7302
|
#
|
7290
7303
|
# contractPublicGetlinearSwapApiV1SwapHisOpenInterest
|
7291
7304
|
# {
|
@@ -7369,17 +7382,19 @@ class htx(Exchange, ImplicitAPI):
|
|
7369
7382
|
request = {
|
7370
7383
|
'contract_code': market['id'],
|
7371
7384
|
}
|
7372
|
-
|
7385
|
+
response = None
|
7373
7386
|
if market['future']:
|
7374
7387
|
request['contract_type'] = self.safe_string(market['info'], 'contract_type')
|
7375
7388
|
request['symbol'] = market['baseId']
|
7376
|
-
|
7389
|
+
# COIN-M futures
|
7390
|
+
response = await self.contractPublicGetApiV1ContractOpenInterest(self.extend(request, params))
|
7377
7391
|
elif market['linear']:
|
7378
7392
|
request['contract_type'] = 'swap'
|
7379
|
-
|
7393
|
+
# USDT-M
|
7394
|
+
response = await self.contractPublicGetLinearSwapApiV1SwapOpenInterest(self.extend(request, params))
|
7380
7395
|
else:
|
7381
|
-
|
7382
|
-
|
7396
|
+
# COIN-M swaps
|
7397
|
+
response = await self.contractPublicGetSwapApiV1SwapOpenInterest(self.extend(request, params))
|
7383
7398
|
#
|
7384
7399
|
# USDT-M contractPublicGetLinearSwapApiV1SwapOpenInterest
|
7385
7400
|
#
|
@@ -7713,13 +7728,14 @@ class htx(Exchange, ImplicitAPI):
|
|
7713
7728
|
request['page_size'] = limit
|
7714
7729
|
if until is not None:
|
7715
7730
|
request['end_at'] = until
|
7716
|
-
|
7731
|
+
response = None
|
7717
7732
|
if market['swap']:
|
7718
7733
|
if market['linear']:
|
7719
|
-
|
7734
|
+
response = await self.contractPublicGetLinearSwapApiV1SwapSettlementRecords(self.extend(request, params))
|
7720
7735
|
else:
|
7721
|
-
|
7722
|
-
|
7736
|
+
response = await self.contractPublicGetSwapApiV1SwapSettlementRecords(self.extend(request, params))
|
7737
|
+
else:
|
7738
|
+
response = await self.contractPublicGetApiV1ContractSettlementRecords(self.extend(request, params))
|
7723
7739
|
#
|
7724
7740
|
# linear swap, coin-m swap
|
7725
7741
|
#
|