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