ccxt 4.4.73__py2.py3-none-any.whl → 4.4.74__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.
- ccxt/__init__.py +1 -5
- ccxt/abstract/bitmart.py +2 -0
- ccxt/ace.py +3 -0
- ccxt/alpaca.py +3 -0
- ccxt/ascendex.py +6 -0
- ccxt/async_support/__init__.py +1 -5
- ccxt/async_support/ace.py +3 -0
- ccxt/async_support/alpaca.py +3 -0
- ccxt/async_support/ascendex.py +6 -0
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/bequant.py +1 -0
- ccxt/async_support/binanceusdm.py +1 -1
- ccxt/async_support/bit2c.py +26 -0
- ccxt/async_support/bitbank.py +32 -0
- ccxt/async_support/bitbns.py +1 -1
- ccxt/async_support/bitflyer.py +1 -0
- ccxt/async_support/bithumb.py +34 -0
- ccxt/async_support/bitmart.py +70 -6
- ccxt/async_support/blofin.py +1 -1
- ccxt/async_support/bybit.py +10 -1
- ccxt/async_support/coinlist.py +81 -11
- ccxt/async_support/deribit.py +19 -0
- ccxt/async_support/gate.py +11 -7
- ccxt/async_support/hitbtc.py +7 -1
- ccxt/async_support/okx.py +4 -0
- ccxt/base/errors.py +0 -6
- ccxt/base/exchange.py +25 -7
- ccxt/bequant.py +1 -0
- ccxt/binanceusdm.py +1 -1
- ccxt/bit2c.py +26 -0
- ccxt/bitbank.py +32 -0
- ccxt/bitbns.py +1 -1
- ccxt/bitflyer.py +1 -0
- ccxt/bithumb.py +34 -0
- ccxt/bitmart.py +70 -6
- ccxt/blofin.py +1 -1
- ccxt/bybit.py +10 -1
- ccxt/coinlist.py +81 -11
- ccxt/deribit.py +19 -0
- ccxt/gate.py +11 -7
- ccxt/hitbtc.py +7 -1
- ccxt/okx.py +4 -0
- ccxt/pro/__init__.py +1 -5
- ccxt/pro/ascendex.py +1 -1
- ccxt/pro/bingx.py +9 -1
- ccxt/pro/bitget.py +9 -1
- ccxt/pro/bitmart.py +9 -1
- ccxt/pro/bitopro.py +5 -4
- {ccxt-4.4.73.dist-info → ccxt-4.4.74.dist-info}/METADATA +5 -5
- {ccxt-4.4.73.dist-info → ccxt-4.4.74.dist-info}/RECORD +53 -55
- ccxt/abstract/bitcoincom.py +0 -115
- ccxt/abstract/bitpanda.py +0 -23
- {ccxt-4.4.73.dist-info → ccxt-4.4.74.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.73.dist-info → ccxt-4.4.74.dist-info}/WHEEL +0 -0
- {ccxt-4.4.73.dist-info → ccxt-4.4.74.dist-info}/top_level.txt +0 -0
ccxt/bithumb.py
CHANGED
@@ -39,30 +39,59 @@ class bithumb(Exchange, ImplicitAPI):
|
|
39
39
|
'future': False,
|
40
40
|
'option': False,
|
41
41
|
'addMargin': False,
|
42
|
+
'borrowCrossMargin': False,
|
43
|
+
'borrowIsolatedMargin': False,
|
44
|
+
'borrowMargin': False,
|
42
45
|
'cancelOrder': True,
|
43
46
|
'closeAllPositions': False,
|
44
47
|
'closePosition': False,
|
45
48
|
'createMarketOrder': True,
|
46
49
|
'createOrder': True,
|
50
|
+
'createOrderWithTakeProfitAndStopLoss': False,
|
51
|
+
'createOrderWithTakeProfitAndStopLossWs': False,
|
47
52
|
'createReduceOnlyOrder': False,
|
48
53
|
'fetchBalance': True,
|
54
|
+
'fetchBorrowInterest': False,
|
55
|
+
'fetchBorrowRate': False,
|
49
56
|
'fetchBorrowRateHistories': False,
|
50
57
|
'fetchBorrowRateHistory': False,
|
58
|
+
'fetchBorrowRates': False,
|
59
|
+
'fetchBorrowRatesPerSymbol': False,
|
51
60
|
'fetchCrossBorrowRate': False,
|
52
61
|
'fetchCrossBorrowRates': False,
|
53
62
|
'fetchFundingHistory': False,
|
63
|
+
'fetchFundingInterval': False,
|
64
|
+
'fetchFundingIntervals': False,
|
54
65
|
'fetchFundingRate': False,
|
55
66
|
'fetchFundingRateHistory': False,
|
56
67
|
'fetchFundingRates': False,
|
68
|
+
'fetchGreeks': False,
|
57
69
|
'fetchIndexOHLCV': False,
|
58
70
|
'fetchIsolatedBorrowRate': False,
|
59
71
|
'fetchIsolatedBorrowRates': False,
|
72
|
+
'fetchIsolatedPositions': False,
|
60
73
|
'fetchLeverage': False,
|
74
|
+
'fetchLeverages': False,
|
75
|
+
'fetchLeverageTiers': False,
|
76
|
+
'fetchLiquidations': False,
|
77
|
+
'fetchLongShortRatio': False,
|
78
|
+
'fetchLongShortRatioHistory': False,
|
79
|
+
'fetchMarginAdjustmentHistory': False,
|
80
|
+
'fetchMarginMode': False,
|
81
|
+
'fetchMarginModes': False,
|
82
|
+
'fetchMarketLeverageTiers': False,
|
61
83
|
'fetchMarkets': True,
|
62
84
|
'fetchMarkOHLCV': False,
|
85
|
+
'fetchMarkPrices': False,
|
86
|
+
'fetchMyLiquidations': False,
|
87
|
+
'fetchMySettlementHistory': False,
|
63
88
|
'fetchOHLCV': True,
|
89
|
+
'fetchOpenInterest': False,
|
64
90
|
'fetchOpenInterestHistory': False,
|
91
|
+
'fetchOpenInterests': False,
|
65
92
|
'fetchOpenOrders': True,
|
93
|
+
'fetchOption': False,
|
94
|
+
'fetchOptionChain': False,
|
66
95
|
'fetchOrder': True,
|
67
96
|
'fetchOrderBook': True,
|
68
97
|
'fetchPosition': False,
|
@@ -73,13 +102,18 @@ class bithumb(Exchange, ImplicitAPI):
|
|
73
102
|
'fetchPositionsHistory': False,
|
74
103
|
'fetchPositionsRisk': False,
|
75
104
|
'fetchPremiumIndexOHLCV': False,
|
105
|
+
'fetchSettlementHistory': False,
|
76
106
|
'fetchTicker': True,
|
77
107
|
'fetchTickers': True,
|
78
108
|
'fetchTrades': True,
|
79
109
|
'fetchTransfer': False,
|
80
110
|
'fetchTransfers': False,
|
111
|
+
'fetchVolatilityHistory': False,
|
81
112
|
'reduceMargin': False,
|
113
|
+
'repayCrossMargin': False,
|
114
|
+
'repayIsolatedMargin': False,
|
82
115
|
'setLeverage': False,
|
116
|
+
'setMargin': False,
|
83
117
|
'setMarginMode': False,
|
84
118
|
'setPositionMode': False,
|
85
119
|
'transfer': False,
|
ccxt/bitmart.py
CHANGED
@@ -104,7 +104,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
104
104
|
'fetchOrders': False,
|
105
105
|
'fetchOrderTrades': True,
|
106
106
|
'fetchPosition': True,
|
107
|
-
'fetchPositionMode':
|
107
|
+
'fetchPositionMode': True,
|
108
108
|
'fetchPositions': True,
|
109
109
|
'fetchStatus': True,
|
110
110
|
'fetchTicker': True,
|
@@ -126,6 +126,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
126
126
|
'repayIsolatedMargin': True,
|
127
127
|
'setLeverage': True,
|
128
128
|
'setMarginMode': False,
|
129
|
+
'setPositionMode': True,
|
129
130
|
'transfer': True,
|
130
131
|
'withdraw': True,
|
131
132
|
},
|
@@ -231,6 +232,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
231
232
|
'contract/private/affilate/rebate-list': 10,
|
232
233
|
'contract/private/affilate/trade-list': 10,
|
233
234
|
'contract/private/transaction-history': 10,
|
235
|
+
'contract/private/get-position-mode': 1,
|
234
236
|
},
|
235
237
|
'post': {
|
236
238
|
# sub-account endpoints
|
@@ -283,6 +285,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
283
285
|
'contract/private/modify-tp-sl-order': 2.5,
|
284
286
|
'contract/private/submit-trail-order': 2.5, # weight is not provided by the exchange, is set order
|
285
287
|
'contract/private/cancel-trail-order': 1.5, # weight is not provided by the exchange, is set order
|
288
|
+
'contract/private/set-position-mode': 1,
|
286
289
|
},
|
287
290
|
},
|
288
291
|
},
|
@@ -1205,7 +1208,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1205
1208
|
# {
|
1206
1209
|
# "message": "OK",
|
1207
1210
|
# "code": 1000,
|
1208
|
-
# "trace": "619294ecef584282b26a3be322b1e01f.66.
|
1211
|
+
# "trace": "619294ecef584282b26a3be322b1e01f.66.17403093228242229",
|
1209
1212
|
# "data": {
|
1210
1213
|
# "currencies": [
|
1211
1214
|
# {
|
@@ -3847,10 +3850,11 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3847
3850
|
timestamp = self.safe_integer(transaction, 'apply_time')
|
3848
3851
|
currencyId = self.safe_string(transaction, 'currency')
|
3849
3852
|
networkId: Str = None
|
3850
|
-
if currencyId
|
3851
|
-
|
3852
|
-
|
3853
|
-
|
3853
|
+
if currencyId is not None:
|
3854
|
+
if currencyId.find('NFT') < 0:
|
3855
|
+
parts = currencyId.split('-')
|
3856
|
+
currencyId = self.safe_string(parts, 0)
|
3857
|
+
networkId = self.safe_string(parts, 1)
|
3854
3858
|
code = self.safe_currency_code(currencyId, currency)
|
3855
3859
|
status = self.parse_transaction_status(self.safe_string(transaction, 'status'))
|
3856
3860
|
feeCost = self.safe_number(transaction, 'fee')
|
@@ -5212,6 +5216,66 @@ class bitmart(Exchange, ImplicitAPI):
|
|
5212
5216
|
addresses.append(address)
|
5213
5217
|
return addresses
|
5214
5218
|
|
5219
|
+
def set_position_mode(self, hedged: bool, symbol: Str = None, params={}):
|
5220
|
+
"""
|
5221
|
+
set hedged to True or False for a market
|
5222
|
+
|
5223
|
+
https://developer-pro.bitmart.com/en/futuresv2/#submit-leverage-signed
|
5224
|
+
|
5225
|
+
:param bool hedged: set to True to use dualSidePosition
|
5226
|
+
:param str symbol: not used by bingx setPositionMode()
|
5227
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
5228
|
+
:returns dict: response from the exchange
|
5229
|
+
"""
|
5230
|
+
self.load_markets()
|
5231
|
+
positionMode = None
|
5232
|
+
if hedged:
|
5233
|
+
positionMode = 'hedge_mode'
|
5234
|
+
else:
|
5235
|
+
positionMode = 'one_way_mode'
|
5236
|
+
request: dict = {
|
5237
|
+
'position_mode': positionMode,
|
5238
|
+
}
|
5239
|
+
#
|
5240
|
+
# {
|
5241
|
+
# "code": 1000,
|
5242
|
+
# "trace": "0cc6f4c4-8b8c-4253-8e90-8d3195aa109c",
|
5243
|
+
# "message": "Ok",
|
5244
|
+
# "data": {
|
5245
|
+
# "position_mode":"one_way_mode"
|
5246
|
+
# }
|
5247
|
+
# }
|
5248
|
+
#
|
5249
|
+
return self.privatePostContractPrivateSetPositionMode(self.extend(request, params))
|
5250
|
+
|
5251
|
+
def fetch_position_mode(self, symbol: Str = None, params={}):
|
5252
|
+
"""
|
5253
|
+
fetchs the position mode, hedged or one way, hedged for binance is set identically for all linear markets or all inverse markets
|
5254
|
+
|
5255
|
+
https://developer-pro.bitmart.com/en/futuresv2/#get-position-mode-keyed
|
5256
|
+
|
5257
|
+
:param str symbol: not used
|
5258
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
5259
|
+
:returns dict: an object detailing whether the market is in hedged or one-way mode
|
5260
|
+
"""
|
5261
|
+
response = self.privateGetContractPrivateGetPositionMode(params)
|
5262
|
+
#
|
5263
|
+
# {
|
5264
|
+
# "code": 1000,
|
5265
|
+
# "trace": "0cc6f4c4-8b8c-4253-8e90-8d3195aa109c",
|
5266
|
+
# "message": "Ok",
|
5267
|
+
# "data": {
|
5268
|
+
# "position_mode":"one_way_mode"
|
5269
|
+
# }
|
5270
|
+
# }
|
5271
|
+
#
|
5272
|
+
data = self.safe_dict(response, 'data')
|
5273
|
+
positionMode = self.safe_string(data, 'position_mode')
|
5274
|
+
return {
|
5275
|
+
'info': response,
|
5276
|
+
'hedged': (positionMode == 'hedge_mode'),
|
5277
|
+
}
|
5278
|
+
|
5215
5279
|
def nonce(self):
|
5216
5280
|
return self.milliseconds() - self.options['timeDifference']
|
5217
5281
|
|
ccxt/blofin.py
CHANGED
@@ -66,7 +66,7 @@ class blofin(Exchange, ImplicitAPI):
|
|
66
66
|
'fetchBorrowRateHistory': False,
|
67
67
|
'fetchCanceledOrders': False,
|
68
68
|
'fetchClosedOrder': False,
|
69
|
-
'fetchClosedOrders':
|
69
|
+
'fetchClosedOrders': True,
|
70
70
|
'fetchCrossBorrowRate': False,
|
71
71
|
'fetchCrossBorrowRates': False,
|
72
72
|
'fetchCurrencies': False,
|
ccxt/bybit.py
CHANGED
@@ -2389,6 +2389,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
2389
2389
|
:returns dict: an array of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
2390
2390
|
"""
|
2391
2391
|
self.load_markets()
|
2392
|
+
code = self.safe_string_n(params, ['code', 'currency', 'baseCoin'])
|
2392
2393
|
market = None
|
2393
2394
|
parsedSymbols = None
|
2394
2395
|
if symbols is not None:
|
@@ -2410,6 +2411,12 @@ class bybit(Exchange, ImplicitAPI):
|
|
2410
2411
|
currentType = market['type']
|
2411
2412
|
elif market['type'] != currentType:
|
2412
2413
|
raise BadRequest(self.id + ' fetchTickers can only accept a list of symbols of the same type')
|
2414
|
+
if market['option']:
|
2415
|
+
if code is not None and code != market['base']:
|
2416
|
+
raise BadRequest(self.id + ' fetchTickers the base currency must be the same for all symbols, self endpoint only supports one base currency at a time. Read more about it here: https://bybit-exchange.github.io/docs/v5/market/tickers')
|
2417
|
+
if code is None:
|
2418
|
+
code = market['base']
|
2419
|
+
params = self.omit(params, ['code', 'currency'])
|
2413
2420
|
parsedSymbols.append(market['symbol'])
|
2414
2421
|
request: dict = {
|
2415
2422
|
# 'symbol': market['id'],
|
@@ -2429,7 +2436,9 @@ class bybit(Exchange, ImplicitAPI):
|
|
2429
2436
|
request['category'] = 'spot'
|
2430
2437
|
elif type == 'option':
|
2431
2438
|
request['category'] = 'option'
|
2432
|
-
|
2439
|
+
if code is None:
|
2440
|
+
code = 'BTC'
|
2441
|
+
request['baseCoin'] = code
|
2433
2442
|
elif type == 'swap' or type == 'future' or subType is not None:
|
2434
2443
|
request['category'] = subType
|
2435
2444
|
response = self.publicGetV5MarketTickers(self.extend(request, params))
|
ccxt/coinlist.py
CHANGED
@@ -501,7 +501,7 @@ class coinlist(Exchange, ImplicitAPI):
|
|
501
501
|
# {
|
502
502
|
# "symbols": [
|
503
503
|
# {
|
504
|
-
# "symbol": "CQT-USDT",
|
504
|
+
# "symbol": "CQT-USDT", # spot
|
505
505
|
# "base_currency": "CQT",
|
506
506
|
# "is_trader_geofenced": False,
|
507
507
|
# "list_time": "2021-06-15T00:00:00.000Z",
|
@@ -526,6 +526,62 @@ class coinlist(Exchange, ImplicitAPI):
|
|
526
526
|
return self.parse_markets(markets)
|
527
527
|
|
528
528
|
def parse_market(self, market: dict) -> Market:
|
529
|
+
# perp
|
530
|
+
# {
|
531
|
+
# "symbol":"BTC-PERP",
|
532
|
+
# "base_currency":"BTC",
|
533
|
+
# "is_trader_geofenced":false,
|
534
|
+
# "expiry_name":null,
|
535
|
+
# "expiry_time":null,
|
536
|
+
# "list_time":"2024-09-16T00:00:00.000Z",
|
537
|
+
# "type":"perp-swap",
|
538
|
+
# "series_code":"BTC",
|
539
|
+
# "long_name":"Bitcoin",
|
540
|
+
# "asset_class":"CRYPTO",
|
541
|
+
# "minimum_price_increment":"0.01",
|
542
|
+
# "minimum_size_increment":"0.0001",
|
543
|
+
# "quote_currency":"USDT",
|
544
|
+
# "multiplier":"1",
|
545
|
+
# "contract_frequency":"FGHJKMNQUVXZ",
|
546
|
+
# "index_code":".BTC-USDT",
|
547
|
+
# "price_band_threshold_market":"0.05",
|
548
|
+
# "price_band_threshold_limit":"0.25",
|
549
|
+
# "maintenance_initial_ratio":"0.500000000000000000",
|
550
|
+
# "liquidation_initial_ratio":"0.500000000000000000",
|
551
|
+
# "last_price":"75881.36000000",
|
552
|
+
# "fair_price":"76256.00000000",
|
553
|
+
# "index_price":"77609.90000000",
|
554
|
+
# "mark_price":"76237.75000000",
|
555
|
+
# "mark_price_dollarizer":"0.99950000",
|
556
|
+
# "funding_interval":{
|
557
|
+
# "hours":"8"
|
558
|
+
# },
|
559
|
+
# "funding_rate_index_code":".BTC-USDT-FR8H",
|
560
|
+
# "initial_margin_base":"0.200000000000000000",
|
561
|
+
# "initial_margin_per_contract":"0.160000000000000000",
|
562
|
+
# "position_limit":"5.0000"
|
563
|
+
# }
|
564
|
+
# spot
|
565
|
+
# {
|
566
|
+
# "symbol": "CQT-USDT", # spot
|
567
|
+
# "base_currency": "CQT",
|
568
|
+
# "is_trader_geofenced": False,
|
569
|
+
# "list_time": "2021-06-15T00:00:00.000Z",
|
570
|
+
# "type": "spot",
|
571
|
+
# "series_code": "CQT-USDT-SPOT",
|
572
|
+
# "long_name": "Covalent",
|
573
|
+
# "asset_class": "CRYPTO",
|
574
|
+
# "minimum_price_increment": "0.0001",
|
575
|
+
# "minimum_size_increment": "0.0001",
|
576
|
+
# "quote_currency": "USDT",
|
577
|
+
# "index_code": null,
|
578
|
+
# "price_band_threshold_market": "0.05",
|
579
|
+
# "price_band_threshold_limit": "0.25",
|
580
|
+
# "last_price": "0.12160000",
|
581
|
+
# "fair_price": "0.12300000",
|
582
|
+
# "index_price": null
|
583
|
+
# }
|
584
|
+
isSwap = self.safe_string(market, 'type') == 'perp-swap'
|
529
585
|
id = self.safe_string(market, 'symbol')
|
530
586
|
baseId = self.safe_string(market, 'base_currency')
|
531
587
|
quoteId = self.safe_string(market, 'quote_currency')
|
@@ -534,26 +590,40 @@ class coinlist(Exchange, ImplicitAPI):
|
|
534
590
|
amountPrecision = self.safe_string(market, 'minimum_size_increment')
|
535
591
|
pricePrecision = self.safe_string(market, 'minimum_price_increment')
|
536
592
|
created = self.safe_string(market, 'list_time')
|
593
|
+
settledId = None
|
594
|
+
settled = None
|
595
|
+
linear = None
|
596
|
+
inverse = None
|
597
|
+
contractSize = None
|
598
|
+
symbol = base + '/' + quote
|
599
|
+
if isSwap:
|
600
|
+
contractSize = self.parse_number('1')
|
601
|
+
linear = True
|
602
|
+
inverse = False
|
603
|
+
settledId = quoteId
|
604
|
+
settled = quote
|
605
|
+
symbol = symbol + ':' + quote
|
606
|
+
type = 'swap' if isSwap else 'spot'
|
537
607
|
return {
|
538
608
|
'id': id,
|
539
|
-
'symbol':
|
609
|
+
'symbol': symbol,
|
540
610
|
'base': base,
|
541
611
|
'quote': quote,
|
542
|
-
'settle':
|
612
|
+
'settle': settled,
|
543
613
|
'baseId': baseId,
|
544
614
|
'quoteId': quoteId,
|
545
|
-
'settleId':
|
546
|
-
'type':
|
547
|
-
'spot':
|
615
|
+
'settleId': settledId,
|
616
|
+
'type': type,
|
617
|
+
'spot': not isSwap,
|
548
618
|
'margin': False,
|
549
|
-
'swap':
|
619
|
+
'swap': isSwap,
|
550
620
|
'future': False,
|
551
621
|
'option': False,
|
552
622
|
'active': True,
|
553
|
-
'contract':
|
554
|
-
'linear':
|
555
|
-
'inverse':
|
556
|
-
'contractSize':
|
623
|
+
'contract': isSwap,
|
624
|
+
'linear': linear,
|
625
|
+
'inverse': inverse,
|
626
|
+
'contractSize': contractSize,
|
557
627
|
'expiry': None,
|
558
628
|
'expiryDatetime': None,
|
559
629
|
'strike': None,
|
ccxt/deribit.py
CHANGED
@@ -1321,13 +1321,32 @@ class deribit(Exchange, ImplicitAPI):
|
|
1321
1321
|
self.load_markets()
|
1322
1322
|
symbols = self.market_symbols(symbols)
|
1323
1323
|
code = self.safe_string_2(params, 'code', 'currency')
|
1324
|
+
type = None
|
1324
1325
|
params = self.omit(params, ['code'])
|
1326
|
+
if symbols is not None:
|
1327
|
+
for i in range(0, len(symbols)):
|
1328
|
+
market = self.market(symbols[i])
|
1329
|
+
if code is not None and code != market['base']:
|
1330
|
+
raise BadRequest(self.id + ' fetchTickers the base currency must be the same for all symbols, self endpoint only supports one base currency at a time. Read more about it here: https://docs.deribit.com/#public-get_book_summary_by_currency')
|
1331
|
+
if code is None:
|
1332
|
+
code = market['base']
|
1333
|
+
type = market['type']
|
1325
1334
|
if code is None:
|
1326
1335
|
raise ArgumentsRequired(self.id + ' fetchTickers requires a currency/code(eg: BTC/ETH/USDT) parameter to fetch tickers for')
|
1327
1336
|
currency = self.currency(code)
|
1328
1337
|
request: dict = {
|
1329
1338
|
'currency': currency['id'],
|
1330
1339
|
}
|
1340
|
+
if type is not None:
|
1341
|
+
requestType = None
|
1342
|
+
if type == 'spot':
|
1343
|
+
requestType = 'spot'
|
1344
|
+
elif type == 'future' or (type == 'contract'):
|
1345
|
+
requestType = 'future'
|
1346
|
+
elif type == 'option':
|
1347
|
+
requestType = 'option'
|
1348
|
+
if requestType is not None:
|
1349
|
+
request['kind'] = requestType
|
1331
1350
|
response = self.publicGetGetBookSummaryByCurrency(self.extend(request, params))
|
1332
1351
|
#
|
1333
1352
|
# {
|
ccxt/gate.py
CHANGED
@@ -1484,6 +1484,10 @@ class gate(Exchange, ImplicitAPI):
|
|
1484
1484
|
takerPercent = self.safe_string(market, 'taker_fee_rate')
|
1485
1485
|
makerPercent = self.safe_string(market, 'maker_fee_rate', takerPercent)
|
1486
1486
|
isLinear = quote == settle
|
1487
|
+
contractSize = self.safe_string(market, 'quanto_multiplier')
|
1488
|
+
# exception only for one market: https://api.gateio.ws/api/v4/futures/btc/contracts
|
1489
|
+
if contractSize == '0':
|
1490
|
+
contractSize = '1' # 1 USD in WEB: https://i.imgur.com/MBBUI04.png
|
1487
1491
|
return {
|
1488
1492
|
'id': id,
|
1489
1493
|
'symbol': symbol,
|
@@ -1505,7 +1509,7 @@ class gate(Exchange, ImplicitAPI):
|
|
1505
1509
|
'inverse': not isLinear,
|
1506
1510
|
'taker': self.parse_number(Precise.string_div(takerPercent, '100')), # Fee is in %, so divide by 100
|
1507
1511
|
'maker': self.parse_number(Precise.string_div(makerPercent, '100')),
|
1508
|
-
'contractSize': self.
|
1512
|
+
'contractSize': self.parse_number(contractSize),
|
1509
1513
|
'expiry': expiry,
|
1510
1514
|
'expiryDatetime': self.iso8601(expiry),
|
1511
1515
|
'strike': None,
|
@@ -1818,9 +1822,9 @@ class gate(Exchange, ImplicitAPI):
|
|
1818
1822
|
partFirst = self.safe_string(parts, 0)
|
1819
1823
|
# if there's an underscore then the second part is always the chain name(except the _OLD suffix)
|
1820
1824
|
currencyName = currencyId if currencyId.endswith('_OLD') else partFirst
|
1821
|
-
|
1822
|
-
|
1823
|
-
tradeDisabled =
|
1825
|
+
withdrawDisabled = self.safe_bool(entry, 'withdraw_disabled', False)
|
1826
|
+
depositDisabled = self.safe_bool(entry, 'deposit_disabled', False)
|
1827
|
+
tradeDisabled = self.safe_bool(entry, 'trade_disabled', False)
|
1824
1828
|
precision = self.parse_number('0.0001') # temporary safe default, because no value provided from API
|
1825
1829
|
code = self.safe_currency_code(currencyName)
|
1826
1830
|
# check leveraged tokens(e.g. BTC3S, ETH5L)
|
@@ -1848,8 +1852,8 @@ class gate(Exchange, ImplicitAPI):
|
|
1848
1852
|
},
|
1849
1853
|
},
|
1850
1854
|
'active': not tradeDisabled,
|
1851
|
-
'deposit':
|
1852
|
-
'withdraw':
|
1855
|
+
'deposit': not depositDisabled,
|
1856
|
+
'withdraw': not withdrawDisabled,
|
1853
1857
|
'fee': None,
|
1854
1858
|
'precision': precision,
|
1855
1859
|
}
|
@@ -6365,7 +6369,7 @@ class gate(Exchange, ImplicitAPI):
|
|
6365
6369
|
queryString = self.urlencode(query)
|
6366
6370
|
# https://github.com/ccxt/ccxt/issues/25570
|
6367
6371
|
if queryString.find('currencies=') >= 0 and queryString.find('%2C') >= 0:
|
6368
|
-
queryString = queryString.replace('%
|
6372
|
+
queryString = queryString.replace('%2C', ',')
|
6369
6373
|
url += '?' + queryString
|
6370
6374
|
if method == 'PATCH':
|
6371
6375
|
body = self.json(query)
|
ccxt/hitbtc.py
CHANGED
@@ -44,7 +44,7 @@ class hitbtc(Exchange, ImplicitAPI):
|
|
44
44
|
'margin': True,
|
45
45
|
'swap': True,
|
46
46
|
'future': False,
|
47
|
-
'option':
|
47
|
+
'option': False,
|
48
48
|
'addMargin': True,
|
49
49
|
'cancelAllOrders': True,
|
50
50
|
'cancelOrder': True,
|
@@ -76,6 +76,7 @@ class hitbtc(Exchange, ImplicitAPI):
|
|
76
76
|
'fetchFundingRate': True,
|
77
77
|
'fetchFundingRateHistory': True,
|
78
78
|
'fetchFundingRates': True,
|
79
|
+
'fetchGreeks': False,
|
79
80
|
'fetchIndexOHLCV': True,
|
80
81
|
'fetchIsolatedBorrowRate': False,
|
81
82
|
'fetchIsolatedBorrowRates': False,
|
@@ -88,6 +89,7 @@ class hitbtc(Exchange, ImplicitAPI):
|
|
88
89
|
'fetchMarkets': True,
|
89
90
|
'fetchMarkOHLCV': True,
|
90
91
|
'fetchMyLiquidations': False,
|
92
|
+
'fetchMySettlementHistory': False,
|
91
93
|
'fetchMyTrades': True,
|
92
94
|
'fetchOHLCV': True,
|
93
95
|
'fetchOpenInterest': True,
|
@@ -95,6 +97,8 @@ class hitbtc(Exchange, ImplicitAPI):
|
|
95
97
|
'fetchOpenInterests': True,
|
96
98
|
'fetchOpenOrder': True,
|
97
99
|
'fetchOpenOrders': True,
|
100
|
+
'fetchOption': False,
|
101
|
+
'fetchOptionChain': False,
|
98
102
|
'fetchOrder': True,
|
99
103
|
'fetchOrderBook': True,
|
100
104
|
'fetchOrderBooks': True,
|
@@ -103,12 +107,14 @@ class hitbtc(Exchange, ImplicitAPI):
|
|
103
107
|
'fetchPosition': True,
|
104
108
|
'fetchPositions': True,
|
105
109
|
'fetchPremiumIndexOHLCV': True,
|
110
|
+
'fetchSettlementHistory': False,
|
106
111
|
'fetchTicker': True,
|
107
112
|
'fetchTickers': True,
|
108
113
|
'fetchTrades': True,
|
109
114
|
'fetchTradingFee': True,
|
110
115
|
'fetchTradingFees': True,
|
111
116
|
'fetchTransactions': 'emulated',
|
117
|
+
'fetchVolatilityHistory': False,
|
112
118
|
'fetchWithdrawals': True,
|
113
119
|
'reduceMargin': True,
|
114
120
|
'sandbox': True,
|
ccxt/okx.py
CHANGED
@@ -1293,6 +1293,7 @@ class okx(Exchange, ImplicitAPI):
|
|
1293
1293
|
},
|
1294
1294
|
'fetchOHLCV': {
|
1295
1295
|
'limit': 300,
|
1296
|
+
'historical': 100,
|
1296
1297
|
},
|
1297
1298
|
},
|
1298
1299
|
'spot': {
|
@@ -2384,6 +2385,8 @@ class okx(Exchange, ImplicitAPI):
|
|
2384
2385
|
timezone = self.safe_string(options, 'timezone', 'UTC')
|
2385
2386
|
if limit is None:
|
2386
2387
|
limit = 100 # default 100, max 100
|
2388
|
+
else:
|
2389
|
+
limit = min(limit, 300) # max 100
|
2387
2390
|
duration = self.parse_timeframe(timeframe)
|
2388
2391
|
bar = self.safe_string(self.timeframes, timeframe, timeframe)
|
2389
2392
|
if (timezone == 'UTC') and (duration >= 21600): # if utc and timeframe >= 6h
|
@@ -2401,6 +2404,7 @@ class okx(Exchange, ImplicitAPI):
|
|
2401
2404
|
historyBorder = now - ((1440 - 1) * durationInMilliseconds)
|
2402
2405
|
if since < historyBorder:
|
2403
2406
|
defaultType = 'HistoryCandles'
|
2407
|
+
limit = min(limit, 100) # max 100 for historical endpoint
|
2404
2408
|
startTime = max(since - 1, 0)
|
2405
2409
|
request['before'] = startTime
|
2406
2410
|
request['after'] = self.sum(since, durationInMilliseconds * limit)
|
ccxt/pro/__init__.py
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
# ----------------------------------------------------------------------------
|
6
6
|
|
7
|
-
__version__ = '4.4.
|
7
|
+
__version__ = '4.4.74'
|
8
8
|
|
9
9
|
# ----------------------------------------------------------------------------
|
10
10
|
|
@@ -20,14 +20,12 @@ from ccxt.pro.binancecoinm import binancecoinm # noqa
|
|
20
20
|
from ccxt.pro.binanceus import binanceus # noqa: F401
|
21
21
|
from ccxt.pro.binanceusdm import binanceusdm # noqa: F401
|
22
22
|
from ccxt.pro.bingx import bingx # noqa: F401
|
23
|
-
from ccxt.pro.bitcoincom import bitcoincom # noqa: F401
|
24
23
|
from ccxt.pro.bitfinex import bitfinex # noqa: F401
|
25
24
|
from ccxt.pro.bitget import bitget # noqa: F401
|
26
25
|
from ccxt.pro.bithumb import bithumb # noqa: F401
|
27
26
|
from ccxt.pro.bitmart import bitmart # noqa: F401
|
28
27
|
from ccxt.pro.bitmex import bitmex # noqa: F401
|
29
28
|
from ccxt.pro.bitopro import bitopro # noqa: F401
|
30
|
-
from ccxt.pro.bitpanda import bitpanda # noqa: F401
|
31
29
|
from ccxt.pro.bitrue import bitrue # noqa: F401
|
32
30
|
from ccxt.pro.bitstamp import bitstamp # noqa: F401
|
33
31
|
from ccxt.pro.bitvavo import bitvavo # noqa: F401
|
@@ -94,14 +92,12 @@ exchanges = [
|
|
94
92
|
'binanceus',
|
95
93
|
'binanceusdm',
|
96
94
|
'bingx',
|
97
|
-
'bitcoincom',
|
98
95
|
'bitfinex',
|
99
96
|
'bitget',
|
100
97
|
'bithumb',
|
101
98
|
'bitmart',
|
102
99
|
'bitmex',
|
103
100
|
'bitopro',
|
104
|
-
'bitpanda',
|
105
101
|
'bitrue',
|
106
102
|
'bitstamp',
|
107
103
|
'bitvavo',
|
ccxt/pro/ascendex.py
CHANGED
ccxt/pro/bingx.py
CHANGED
@@ -86,6 +86,9 @@ class bingx(ccxt.async_support.bingx):
|
|
86
86
|
'depth': 100, # 5, 10, 20, 50, 100
|
87
87
|
'interval': 500, # 100, 200, 500, 1000
|
88
88
|
},
|
89
|
+
'watchTrades': {
|
90
|
+
'ignoreDuplicates': True,
|
91
|
+
},
|
89
92
|
},
|
90
93
|
'streaming': {
|
91
94
|
'keepAlive': 1800000, # 30 minutes
|
@@ -468,7 +471,12 @@ class bingx(ccxt.async_support.bingx):
|
|
468
471
|
trades = await self.watch(url, messageHash, self.extend(request, params), messageHash)
|
469
472
|
if self.newUpdates:
|
470
473
|
limit = trades.getLimit(symbol, limit)
|
471
|
-
|
474
|
+
result = self.filter_by_since_limit(trades, since, limit, 'timestamp', True)
|
475
|
+
if self.handle_option('watchTrades', 'ignoreDuplicates', True):
|
476
|
+
filtered = self.remove_repeated_trades_from_array(result)
|
477
|
+
filtered = self.sort_by(filtered, 'timestamp')
|
478
|
+
return filtered
|
479
|
+
return result
|
472
480
|
|
473
481
|
def handle_trades(self, client: Client, message):
|
474
482
|
#
|
ccxt/pro/bitget.py
CHANGED
@@ -77,6 +77,9 @@ class bitget(ccxt.async_support.bitget):
|
|
77
77
|
'watchOrderBook': {
|
78
78
|
'checksum': True,
|
79
79
|
},
|
80
|
+
'watchTrades': {
|
81
|
+
'ignoreDuplicates': True,
|
82
|
+
},
|
80
83
|
},
|
81
84
|
'streaming': {
|
82
85
|
'ping': self.ping,
|
@@ -767,7 +770,12 @@ class bitget(ccxt.async_support.bitget):
|
|
767
770
|
first = self.safe_value(trades, 0)
|
768
771
|
tradeSymbol = self.safe_string(first, 'symbol')
|
769
772
|
limit = trades.getLimit(tradeSymbol, limit)
|
770
|
-
|
773
|
+
result = self.filter_by_since_limit(trades, since, limit, 'timestamp', True)
|
774
|
+
if self.handle_option('watchTrades', 'ignoreDuplicates', True):
|
775
|
+
filtered = self.remove_repeated_trades_from_array(result)
|
776
|
+
filtered = self.sort_by(filtered, 'timestamp')
|
777
|
+
return filtered
|
778
|
+
return result
|
771
779
|
|
772
780
|
async def un_watch_trades(self, symbol: str, params={}) -> Any:
|
773
781
|
"""
|
ccxt/pro/bitmart.py
CHANGED
@@ -71,6 +71,9 @@ class bitmart(ccxt.async_support.bitmart):
|
|
71
71
|
'watchOrderBookForSymbols': {
|
72
72
|
'depth': 'depth/increase100',
|
73
73
|
},
|
74
|
+
'watchTrades': {
|
75
|
+
'ignoreDuplicates': True,
|
76
|
+
},
|
74
77
|
'ws': {
|
75
78
|
'inflate': True,
|
76
79
|
},
|
@@ -299,7 +302,12 @@ class bitmart(ccxt.async_support.bitmart):
|
|
299
302
|
first = self.safe_dict(trades, 0)
|
300
303
|
tradeSymbol = self.safe_string(first, 'symbol')
|
301
304
|
limit = trades.getLimit(tradeSymbol, limit)
|
302
|
-
|
305
|
+
result = self.filter_by_since_limit(trades, since, limit, 'timestamp', True)
|
306
|
+
if self.handle_option('watchTrades', 'ignoreDuplicates', True):
|
307
|
+
filtered = self.remove_repeated_trades_from_array(result)
|
308
|
+
filtered = self.sort_by(filtered, 'timestamp')
|
309
|
+
return filtered
|
310
|
+
return result
|
303
311
|
|
304
312
|
def get_params_for_multiple_sub(self, methodName: str, symbols: List[str], limit: Int = None, params={}):
|
305
313
|
symbols = self.market_symbols(symbols, None, False, True)
|