ccxt 4.4.73__py2.py3-none-any.whl → 4.4.75__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/abstract/coinlist.py +3 -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/bitopro.py +37 -0
- ccxt/async_support/blofin.py +1 -1
- ccxt/async_support/bybit.py +10 -1
- ccxt/async_support/coinlist.py +86 -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 +28 -24
- ccxt/base/exchange.py +33 -14
- 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/bitopro.py +37 -0
- ccxt/blofin.py +1 -1
- ccxt/bybit.py +10 -1
- ccxt/coinlist.py +86 -11
- ccxt/deribit.py +19 -0
- ccxt/gate.py +11 -7
- ccxt/hitbtc.py +7 -1
- ccxt/okx.py +28 -24
- 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.75.dist-info}/METADATA +5 -5
- {ccxt-4.4.73.dist-info → ccxt-4.4.75.dist-info}/RECORD +55 -57
- ccxt/abstract/bitcoincom.py +0 -115
- ccxt/abstract/bitpanda.py +0 -23
- {ccxt-4.4.73.dist-info → ccxt-4.4.75.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.73.dist-info → ccxt-4.4.75.dist-info}/WHEEL +0 -0
- {ccxt-4.4.73.dist-info → ccxt-4.4.75.dist-info}/top_level.txt +0 -0
ccxt/async_support/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
|
+
async 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
|
+
await 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 await self.privatePostContractPrivateSetPositionMode(self.extend(request, params))
|
5250
|
+
|
5251
|
+
async 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 = await 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/async_support/bitopro.py
CHANGED
@@ -36,19 +36,29 @@ class bitopro(Exchange, ImplicitAPI):
|
|
36
36
|
'swap': False,
|
37
37
|
'future': False,
|
38
38
|
'option': False,
|
39
|
+
'addMargin': False,
|
40
|
+
'borrowCrossMargin': False,
|
41
|
+
'borrowIsolatedMargin': False,
|
42
|
+
'borrowMargin': False,
|
39
43
|
'cancelAllOrders': True,
|
40
44
|
'cancelOrder': True,
|
41
45
|
'cancelOrders': True,
|
42
46
|
'closeAllPositions': False,
|
43
47
|
'closePosition': False,
|
44
48
|
'createOrder': True,
|
49
|
+
'createOrderWithTakeProfitAndStopLoss': False,
|
50
|
+
'createOrderWithTakeProfitAndStopLossWs': False,
|
45
51
|
'createReduceOnlyOrder': False,
|
46
52
|
'createStopOrder': True,
|
47
53
|
'createTriggerOrder': True,
|
48
54
|
'editOrder': False,
|
49
55
|
'fetchBalance': True,
|
56
|
+
'fetchBorrowInterest': False,
|
57
|
+
'fetchBorrowRate': False,
|
50
58
|
'fetchBorrowRateHistories': False,
|
51
59
|
'fetchBorrowRateHistory': False,
|
60
|
+
'fetchBorrowRates': False,
|
61
|
+
'fetchBorrowRatesPerSymbol': False,
|
52
62
|
'fetchClosedOrders': True,
|
53
63
|
'fetchCrossBorrowRate': False,
|
54
64
|
'fetchCrossBorrowRates': False,
|
@@ -59,19 +69,39 @@ class bitopro(Exchange, ImplicitAPI):
|
|
59
69
|
'fetchDepositWithdrawFee': 'emulated',
|
60
70
|
'fetchDepositWithdrawFees': True,
|
61
71
|
'fetchFundingHistory': False,
|
72
|
+
'fetchFundingInterval': False,
|
73
|
+
'fetchFundingIntervals': False,
|
62
74
|
'fetchFundingRate': False,
|
63
75
|
'fetchFundingRateHistory': False,
|
64
76
|
'fetchFundingRates': False,
|
77
|
+
'fetchGreeks': False,
|
65
78
|
'fetchIndexOHLCV': False,
|
66
79
|
'fetchIsolatedBorrowRate': False,
|
67
80
|
'fetchIsolatedBorrowRates': False,
|
81
|
+
'fetchIsolatedPositions': False,
|
82
|
+
'fetchLeverage': False,
|
83
|
+
'fetchLeverages': False,
|
84
|
+
'fetchLeverageTiers': False,
|
85
|
+
'fetchLiquidations': False,
|
86
|
+
'fetchLongShortRatio': False,
|
87
|
+
'fetchLongShortRatioHistory': False,
|
88
|
+
'fetchMarginAdjustmentHistory': False,
|
68
89
|
'fetchMarginMode': False,
|
90
|
+
'fetchMarginModes': False,
|
91
|
+
'fetchMarketLeverageTiers': False,
|
69
92
|
'fetchMarkets': True,
|
70
93
|
'fetchMarkOHLCV': False,
|
94
|
+
'fetchMarkPrices': False,
|
95
|
+
'fetchMyLiquidations': False,
|
96
|
+
'fetchMySettlementHistory': False,
|
71
97
|
'fetchMyTrades': True,
|
72
98
|
'fetchOHLCV': True,
|
99
|
+
'fetchOpenInterest': False,
|
73
100
|
'fetchOpenInterestHistory': False,
|
101
|
+
'fetchOpenInterests': False,
|
74
102
|
'fetchOpenOrders': True,
|
103
|
+
'fetchOption': False,
|
104
|
+
'fetchOptionChain': False,
|
75
105
|
'fetchOrder': True,
|
76
106
|
'fetchOrderBook': True,
|
77
107
|
'fetchOrders': False,
|
@@ -84,6 +114,7 @@ class bitopro(Exchange, ImplicitAPI):
|
|
84
114
|
'fetchPositionsHistory': False,
|
85
115
|
'fetchPositionsRisk': False,
|
86
116
|
'fetchPremiumIndexOHLCV': False,
|
117
|
+
'fetchSettlementHistory': False,
|
87
118
|
'fetchTicker': True,
|
88
119
|
'fetchTickers': True,
|
89
120
|
'fetchTime': False,
|
@@ -94,10 +125,16 @@ class bitopro(Exchange, ImplicitAPI):
|
|
94
125
|
'fetchTransactions': False,
|
95
126
|
'fetchTransfer': False,
|
96
127
|
'fetchTransfers': False,
|
128
|
+
'fetchVolatilityHistory': False,
|
97
129
|
'fetchWithdrawal': True,
|
98
130
|
'fetchWithdrawals': True,
|
131
|
+
'reduceMargin': False,
|
132
|
+
'repayCrossMargin': False,
|
133
|
+
'repayIsolatedMargin': False,
|
99
134
|
'setLeverage': False,
|
135
|
+
'setMargin': False,
|
100
136
|
'setMarginMode': False,
|
137
|
+
'setPositionMode': False,
|
101
138
|
'transfer': False,
|
102
139
|
'withdraw': True,
|
103
140
|
},
|
ccxt/async_support/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/async_support/bybit.py
CHANGED
@@ -2390,6 +2390,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
2390
2390
|
:returns dict: an array of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
2391
2391
|
"""
|
2392
2392
|
await self.load_markets()
|
2393
|
+
code = self.safe_string_n(params, ['code', 'currency', 'baseCoin'])
|
2393
2394
|
market = None
|
2394
2395
|
parsedSymbols = None
|
2395
2396
|
if symbols is not None:
|
@@ -2411,6 +2412,12 @@ class bybit(Exchange, ImplicitAPI):
|
|
2411
2412
|
currentType = market['type']
|
2412
2413
|
elif market['type'] != currentType:
|
2413
2414
|
raise BadRequest(self.id + ' fetchTickers can only accept a list of symbols of the same type')
|
2415
|
+
if market['option']:
|
2416
|
+
if code is not None and code != market['base']:
|
2417
|
+
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')
|
2418
|
+
if code is None:
|
2419
|
+
code = market['base']
|
2420
|
+
params = self.omit(params, ['code', 'currency'])
|
2414
2421
|
parsedSymbols.append(market['symbol'])
|
2415
2422
|
request: dict = {
|
2416
2423
|
# 'symbol': market['id'],
|
@@ -2430,7 +2437,9 @@ class bybit(Exchange, ImplicitAPI):
|
|
2430
2437
|
request['category'] = 'spot'
|
2431
2438
|
elif type == 'option':
|
2432
2439
|
request['category'] = 'option'
|
2433
|
-
|
2440
|
+
if code is None:
|
2441
|
+
code = 'BTC'
|
2442
|
+
request['baseCoin'] = code
|
2434
2443
|
elif type == 'swap' or type == 'future' or subType is not None:
|
2435
2444
|
request['category'] = subType
|
2436
2445
|
response = await self.publicGetV5MarketTickers(self.extend(request, params))
|
ccxt/async_support/coinlist.py
CHANGED
@@ -171,6 +171,7 @@ class coinlist(Exchange, ImplicitAPI):
|
|
171
171
|
'v1/leaderboard': 1,
|
172
172
|
'v1/affiliate/{competition_code}': 1,
|
173
173
|
'v1/competition/{competition_id}': 1,
|
174
|
+
'v1/symbols/{symbol}/funding': 1,
|
174
175
|
},
|
175
176
|
},
|
176
177
|
'private': {
|
@@ -194,6 +195,7 @@ class coinlist(Exchange, ImplicitAPI):
|
|
194
195
|
'v1/credits': 1, # not unified
|
195
196
|
'v1/positions': 1,
|
196
197
|
'v1/accounts/{trader_id}/competitions': 1,
|
198
|
+
'v1/closedPositions': 1,
|
197
199
|
},
|
198
200
|
'post': {
|
199
201
|
'v1/keys': 1, # not unified
|
@@ -212,6 +214,9 @@ class coinlist(Exchange, ImplicitAPI):
|
|
212
214
|
'v1/orders/{order_id}': 1,
|
213
215
|
'v1/orders/bulk': 1, # not unified
|
214
216
|
},
|
217
|
+
'put': {
|
218
|
+
'v1/accounts/{trader_id}/alias': 1,
|
219
|
+
},
|
215
220
|
'delete': {
|
216
221
|
'v1/keys/{key}': 1, # not unified
|
217
222
|
'v1/orders': 1,
|
@@ -501,7 +506,7 @@ class coinlist(Exchange, ImplicitAPI):
|
|
501
506
|
# {
|
502
507
|
# "symbols": [
|
503
508
|
# {
|
504
|
-
# "symbol": "CQT-USDT",
|
509
|
+
# "symbol": "CQT-USDT", # spot
|
505
510
|
# "base_currency": "CQT",
|
506
511
|
# "is_trader_geofenced": False,
|
507
512
|
# "list_time": "2021-06-15T00:00:00.000Z",
|
@@ -526,6 +531,62 @@ class coinlist(Exchange, ImplicitAPI):
|
|
526
531
|
return self.parse_markets(markets)
|
527
532
|
|
528
533
|
def parse_market(self, market: dict) -> Market:
|
534
|
+
# perp
|
535
|
+
# {
|
536
|
+
# "symbol":"BTC-PERP",
|
537
|
+
# "base_currency":"BTC",
|
538
|
+
# "is_trader_geofenced":false,
|
539
|
+
# "expiry_name":null,
|
540
|
+
# "expiry_time":null,
|
541
|
+
# "list_time":"2024-09-16T00:00:00.000Z",
|
542
|
+
# "type":"perp-swap",
|
543
|
+
# "series_code":"BTC",
|
544
|
+
# "long_name":"Bitcoin",
|
545
|
+
# "asset_class":"CRYPTO",
|
546
|
+
# "minimum_price_increment":"0.01",
|
547
|
+
# "minimum_size_increment":"0.0001",
|
548
|
+
# "quote_currency":"USDT",
|
549
|
+
# "multiplier":"1",
|
550
|
+
# "contract_frequency":"FGHJKMNQUVXZ",
|
551
|
+
# "index_code":".BTC-USDT",
|
552
|
+
# "price_band_threshold_market":"0.05",
|
553
|
+
# "price_band_threshold_limit":"0.25",
|
554
|
+
# "maintenance_initial_ratio":"0.500000000000000000",
|
555
|
+
# "liquidation_initial_ratio":"0.500000000000000000",
|
556
|
+
# "last_price":"75881.36000000",
|
557
|
+
# "fair_price":"76256.00000000",
|
558
|
+
# "index_price":"77609.90000000",
|
559
|
+
# "mark_price":"76237.75000000",
|
560
|
+
# "mark_price_dollarizer":"0.99950000",
|
561
|
+
# "funding_interval":{
|
562
|
+
# "hours":"8"
|
563
|
+
# },
|
564
|
+
# "funding_rate_index_code":".BTC-USDT-FR8H",
|
565
|
+
# "initial_margin_base":"0.200000000000000000",
|
566
|
+
# "initial_margin_per_contract":"0.160000000000000000",
|
567
|
+
# "position_limit":"5.0000"
|
568
|
+
# }
|
569
|
+
# spot
|
570
|
+
# {
|
571
|
+
# "symbol": "CQT-USDT", # spot
|
572
|
+
# "base_currency": "CQT",
|
573
|
+
# "is_trader_geofenced": False,
|
574
|
+
# "list_time": "2021-06-15T00:00:00.000Z",
|
575
|
+
# "type": "spot",
|
576
|
+
# "series_code": "CQT-USDT-SPOT",
|
577
|
+
# "long_name": "Covalent",
|
578
|
+
# "asset_class": "CRYPTO",
|
579
|
+
# "minimum_price_increment": "0.0001",
|
580
|
+
# "minimum_size_increment": "0.0001",
|
581
|
+
# "quote_currency": "USDT",
|
582
|
+
# "index_code": null,
|
583
|
+
# "price_band_threshold_market": "0.05",
|
584
|
+
# "price_band_threshold_limit": "0.25",
|
585
|
+
# "last_price": "0.12160000",
|
586
|
+
# "fair_price": "0.12300000",
|
587
|
+
# "index_price": null
|
588
|
+
# }
|
589
|
+
isSwap = self.safe_string(market, 'type') == 'perp-swap'
|
529
590
|
id = self.safe_string(market, 'symbol')
|
530
591
|
baseId = self.safe_string(market, 'base_currency')
|
531
592
|
quoteId = self.safe_string(market, 'quote_currency')
|
@@ -534,26 +595,40 @@ class coinlist(Exchange, ImplicitAPI):
|
|
534
595
|
amountPrecision = self.safe_string(market, 'minimum_size_increment')
|
535
596
|
pricePrecision = self.safe_string(market, 'minimum_price_increment')
|
536
597
|
created = self.safe_string(market, 'list_time')
|
598
|
+
settledId = None
|
599
|
+
settled = None
|
600
|
+
linear = None
|
601
|
+
inverse = None
|
602
|
+
contractSize = None
|
603
|
+
symbol = base + '/' + quote
|
604
|
+
if isSwap:
|
605
|
+
contractSize = self.parse_number('1')
|
606
|
+
linear = True
|
607
|
+
inverse = False
|
608
|
+
settledId = quoteId
|
609
|
+
settled = quote
|
610
|
+
symbol = symbol + ':' + quote
|
611
|
+
type = 'swap' if isSwap else 'spot'
|
537
612
|
return {
|
538
613
|
'id': id,
|
539
|
-
'symbol':
|
614
|
+
'symbol': symbol,
|
540
615
|
'base': base,
|
541
616
|
'quote': quote,
|
542
|
-
'settle':
|
617
|
+
'settle': settled,
|
543
618
|
'baseId': baseId,
|
544
619
|
'quoteId': quoteId,
|
545
|
-
'settleId':
|
546
|
-
'type':
|
547
|
-
'spot':
|
620
|
+
'settleId': settledId,
|
621
|
+
'type': type,
|
622
|
+
'spot': not isSwap,
|
548
623
|
'margin': False,
|
549
|
-
'swap':
|
624
|
+
'swap': isSwap,
|
550
625
|
'future': False,
|
551
626
|
'option': False,
|
552
627
|
'active': True,
|
553
|
-
'contract':
|
554
|
-
'linear':
|
555
|
-
'inverse':
|
556
|
-
'contractSize':
|
628
|
+
'contract': isSwap,
|
629
|
+
'linear': linear,
|
630
|
+
'inverse': inverse,
|
631
|
+
'contractSize': contractSize,
|
557
632
|
'expiry': None,
|
558
633
|
'expiryDatetime': None,
|
559
634
|
'strike': None,
|
ccxt/async_support/deribit.py
CHANGED
@@ -1321,13 +1321,32 @@ class deribit(Exchange, ImplicitAPI):
|
|
1321
1321
|
await 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 = await self.publicGetGetBookSummaryByCurrency(self.extend(request, params))
|
1332
1351
|
#
|
1333
1352
|
# {
|
ccxt/async_support/gate.py
CHANGED
@@ -1485,6 +1485,10 @@ class gate(Exchange, ImplicitAPI):
|
|
1485
1485
|
takerPercent = self.safe_string(market, 'taker_fee_rate')
|
1486
1486
|
makerPercent = self.safe_string(market, 'maker_fee_rate', takerPercent)
|
1487
1487
|
isLinear = quote == settle
|
1488
|
+
contractSize = self.safe_string(market, 'quanto_multiplier')
|
1489
|
+
# exception only for one market: https://api.gateio.ws/api/v4/futures/btc/contracts
|
1490
|
+
if contractSize == '0':
|
1491
|
+
contractSize = '1' # 1 USD in WEB: https://i.imgur.com/MBBUI04.png
|
1488
1492
|
return {
|
1489
1493
|
'id': id,
|
1490
1494
|
'symbol': symbol,
|
@@ -1506,7 +1510,7 @@ class gate(Exchange, ImplicitAPI):
|
|
1506
1510
|
'inverse': not isLinear,
|
1507
1511
|
'taker': self.parse_number(Precise.string_div(takerPercent, '100')), # Fee is in %, so divide by 100
|
1508
1512
|
'maker': self.parse_number(Precise.string_div(makerPercent, '100')),
|
1509
|
-
'contractSize': self.
|
1513
|
+
'contractSize': self.parse_number(contractSize),
|
1510
1514
|
'expiry': expiry,
|
1511
1515
|
'expiryDatetime': self.iso8601(expiry),
|
1512
1516
|
'strike': None,
|
@@ -1819,9 +1823,9 @@ class gate(Exchange, ImplicitAPI):
|
|
1819
1823
|
partFirst = self.safe_string(parts, 0)
|
1820
1824
|
# if there's an underscore then the second part is always the chain name(except the _OLD suffix)
|
1821
1825
|
currencyName = currencyId if currencyId.endswith('_OLD') else partFirst
|
1822
|
-
|
1823
|
-
|
1824
|
-
tradeDisabled =
|
1826
|
+
withdrawDisabled = self.safe_bool(entry, 'withdraw_disabled', False)
|
1827
|
+
depositDisabled = self.safe_bool(entry, 'deposit_disabled', False)
|
1828
|
+
tradeDisabled = self.safe_bool(entry, 'trade_disabled', False)
|
1825
1829
|
precision = self.parse_number('0.0001') # temporary safe default, because no value provided from API
|
1826
1830
|
code = self.safe_currency_code(currencyName)
|
1827
1831
|
# check leveraged tokens(e.g. BTC3S, ETH5L)
|
@@ -1849,8 +1853,8 @@ class gate(Exchange, ImplicitAPI):
|
|
1849
1853
|
},
|
1850
1854
|
},
|
1851
1855
|
'active': not tradeDisabled,
|
1852
|
-
'deposit':
|
1853
|
-
'withdraw':
|
1856
|
+
'deposit': not depositDisabled,
|
1857
|
+
'withdraw': not withdrawDisabled,
|
1854
1858
|
'fee': None,
|
1855
1859
|
'precision': precision,
|
1856
1860
|
}
|
@@ -6366,7 +6370,7 @@ class gate(Exchange, ImplicitAPI):
|
|
6366
6370
|
queryString = self.urlencode(query)
|
6367
6371
|
# https://github.com/ccxt/ccxt/issues/25570
|
6368
6372
|
if queryString.find('currencies=') >= 0 and queryString.find('%2C') >= 0:
|
6369
|
-
queryString = queryString.replace('%
|
6373
|
+
queryString = queryString.replace('%2C', ',')
|
6370
6374
|
url += '?' + queryString
|
6371
6375
|
if method == 'PATCH':
|
6372
6376
|
body = self.json(query)
|
ccxt/async_support/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/async_support/okx.py
CHANGED
@@ -1294,6 +1294,7 @@ class okx(Exchange, ImplicitAPI):
|
|
1294
1294
|
},
|
1295
1295
|
'fetchOHLCV': {
|
1296
1296
|
'limit': 300,
|
1297
|
+
'historical': 100,
|
1297
1298
|
},
|
1298
1299
|
},
|
1299
1300
|
'spot': {
|
@@ -1824,31 +1825,31 @@ class okx(Exchange, ImplicitAPI):
|
|
1824
1825
|
chainsLength = len(chains)
|
1825
1826
|
for j in range(0, chainsLength):
|
1826
1827
|
chain = chains[j]
|
1827
|
-
|
1828
|
-
|
1829
|
-
|
1830
|
-
|
1831
|
-
chainPart = '-'.join(parts)
|
1832
|
-
networkCode = self.network_id_to_code(chainPart, currency['code'])
|
1833
|
-
networks[networkCode] = {
|
1834
|
-
'id': networkId,
|
1835
|
-
'network': networkCode,
|
1836
|
-
'active': None,
|
1837
|
-
'deposit': self.safe_bool(chain, 'canDep'),
|
1838
|
-
'withdraw': self.safe_bool(chain, 'canWd'),
|
1839
|
-
'fee': self.safe_number(chain, 'fee'),
|
1840
|
-
'precision': self.parse_number(self.parse_precision(self.safe_string(chain, 'wdTickSz'))),
|
1841
|
-
'limits': {
|
1842
|
-
'withdraw': {
|
1843
|
-
'min': self.safe_number(chain, 'minWd'),
|
1844
|
-
'max': self.safe_number(chain, 'maxWd'),
|
1845
|
-
},
|
1846
|
-
},
|
1847
|
-
'info': chain,
|
1848
|
-
}
|
1849
|
-
else:
|
1850
|
-
# only happens for FIAT currency
|
1828
|
+
# allow empty string for rare fiat-currencies, e.g. TRY
|
1829
|
+
networkId = self.safe_string(chain, 'chain', '') # USDT-BEP20, USDT-Avalance-C, etc
|
1830
|
+
if networkId == '':
|
1831
|
+
# only happens for fiat 'TRY' currency
|
1851
1832
|
type = 'fiat'
|
1833
|
+
idParts = networkId.split('-')
|
1834
|
+
parts = self.array_slice(idParts, 1)
|
1835
|
+
chainPart = '-'.join(parts)
|
1836
|
+
networkCode = self.network_id_to_code(chainPart, currency['code'])
|
1837
|
+
networks[networkCode] = {
|
1838
|
+
'id': networkId,
|
1839
|
+
'network': networkCode,
|
1840
|
+
'active': None,
|
1841
|
+
'deposit': self.safe_bool(chain, 'canDep'),
|
1842
|
+
'withdraw': self.safe_bool(chain, 'canWd'),
|
1843
|
+
'fee': self.safe_number(chain, 'fee'),
|
1844
|
+
'precision': self.parse_number(self.parse_precision(self.safe_string(chain, 'wdTickSz'))),
|
1845
|
+
'limits': {
|
1846
|
+
'withdraw': {
|
1847
|
+
'min': self.safe_number(chain, 'minWd'),
|
1848
|
+
'max': self.safe_number(chain, 'maxWd'),
|
1849
|
+
},
|
1850
|
+
},
|
1851
|
+
'info': chain,
|
1852
|
+
}
|
1852
1853
|
firstChain = self.safe_dict(chains, 0, {})
|
1853
1854
|
result[code] = self.safe_currency_structure({
|
1854
1855
|
'info': chains,
|
@@ -2385,6 +2386,8 @@ class okx(Exchange, ImplicitAPI):
|
|
2385
2386
|
timezone = self.safe_string(options, 'timezone', 'UTC')
|
2386
2387
|
if limit is None:
|
2387
2388
|
limit = 100 # default 100, max 100
|
2389
|
+
else:
|
2390
|
+
limit = min(limit, 300) # max 100
|
2388
2391
|
duration = self.parse_timeframe(timeframe)
|
2389
2392
|
bar = self.safe_string(self.timeframes, timeframe, timeframe)
|
2390
2393
|
if (timezone == 'UTC') and (duration >= 21600): # if utc and timeframe >= 6h
|
@@ -2402,6 +2405,7 @@ class okx(Exchange, ImplicitAPI):
|
|
2402
2405
|
historyBorder = now - ((1440 - 1) * durationInMilliseconds)
|
2403
2406
|
if since < historyBorder:
|
2404
2407
|
defaultType = 'HistoryCandles'
|
2408
|
+
limit = min(limit, 100) # max 100 for historical endpoint
|
2405
2409
|
startTime = max(since - 1, 0)
|
2406
2410
|
request['before'] = startTime
|
2407
2411
|
request['after'] = self.sum(since, durationInMilliseconds * limit)
|