ccxt 3.1.52__py2.py3-none-any.whl → 3.1.54__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/bybit.py +1 -0
- ccxt/abstract/okex.py +1 -0
- ccxt/abstract/okex5.py +1 -0
- ccxt/abstract/okx.py +1 -0
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +3 -5
- ccxt/async_support/bitmex.py +447 -399
- ccxt/async_support/bybit.py +1 -0
- ccxt/async_support/cryptocom.py +83 -0
- ccxt/async_support/deribit.py +5 -0
- ccxt/async_support/kucoin.py +57 -14
- ccxt/async_support/luno.py +1 -1
- ccxt/async_support/okx.py +1 -0
- ccxt/base/exchange.py +3 -5
- ccxt/bitmex.py +447 -399
- ccxt/bybit.py +1 -0
- ccxt/cryptocom.py +83 -0
- ccxt/deribit.py +5 -0
- ccxt/kucoin.py +57 -14
- ccxt/luno.py +1 -1
- ccxt/okx.py +1 -0
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/deribit.py +1 -1
- {ccxt-3.1.52.dist-info → ccxt-3.1.54.dist-info}/METADATA +4 -12
- {ccxt-3.1.52.dist-info → ccxt-3.1.54.dist-info}/RECORD +28 -28
- {ccxt-3.1.52.dist-info → ccxt-3.1.54.dist-info}/WHEEL +0 -0
- {ccxt-3.1.52.dist-info → ccxt-3.1.54.dist-info}/top_level.txt +0 -0
ccxt/async_support/bybit.py
CHANGED
@@ -369,6 +369,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
369
369
|
'user/v3/private/frozen-sub-member': 10, # 5/s
|
370
370
|
'user/v3/private/query-sub-members': 5, # 10/s
|
371
371
|
'user/v3/private/query-api': 5, # 10/s
|
372
|
+
'user/v3/private/get-member-type': 1,
|
372
373
|
'asset/v3/private/transfer/transfer-coin/list/query': 0.84, # 60/s
|
373
374
|
'asset/v3/private/transfer/account-coin/balance/query': 0.84, # 60/s
|
374
375
|
'asset/v3/private/transfer/account-coins/balance/query': 50,
|
ccxt/async_support/cryptocom.py
CHANGED
@@ -79,6 +79,7 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
79
79
|
'fetchOrders': True,
|
80
80
|
'fetchPositionMode': False,
|
81
81
|
'fetchPositions': False,
|
82
|
+
'fetchSettlementHistory': True,
|
82
83
|
'fetchStatus': False,
|
83
84
|
'fetchTicker': True,
|
84
85
|
'fetchTickers': True,
|
@@ -2476,6 +2477,88 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
2476
2477
|
'info': account,
|
2477
2478
|
}
|
2478
2479
|
|
2480
|
+
async def fetch_settlement_history(self, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
2481
|
+
"""
|
2482
|
+
fetches historical settlement records
|
2483
|
+
see https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#public-get-expired-settlement-price
|
2484
|
+
:param str symbol: unified market symbol of the settlement history
|
2485
|
+
:param int|None since: timestamp in ms
|
2486
|
+
:param int|None limit: number of records
|
2487
|
+
:param dict params: exchange specific params
|
2488
|
+
:param int|None params['type']: 'future', 'option'
|
2489
|
+
:returns [dict]: a list of [settlement history objects]
|
2490
|
+
"""
|
2491
|
+
await self.load_markets()
|
2492
|
+
market = None
|
2493
|
+
if symbol is not None:
|
2494
|
+
market = self.market(symbol)
|
2495
|
+
type = None
|
2496
|
+
type, params = self.handle_market_type_and_params('fetchSettlementHistory', market, params)
|
2497
|
+
self.check_required_argument('fetchSettlementHistory', type, 'type', ['future', 'option', 'WARRANT', 'FUTURE'])
|
2498
|
+
if type == 'option':
|
2499
|
+
type = 'WARRANT'
|
2500
|
+
request = {
|
2501
|
+
'instrument_type': type.upper(),
|
2502
|
+
}
|
2503
|
+
response = await self.v1PublicGetPublicGetExpiredSettlementPrice(self.extend(request, params))
|
2504
|
+
#
|
2505
|
+
# {
|
2506
|
+
# "id": -1,
|
2507
|
+
# "method": "public/get-expired-settlement-price",
|
2508
|
+
# "code": 0,
|
2509
|
+
# "result": {
|
2510
|
+
# "data": [
|
2511
|
+
# {
|
2512
|
+
# "i": "BTCUSD-230526",
|
2513
|
+
# "x": 1685088000000,
|
2514
|
+
# "v": "26464.1",
|
2515
|
+
# "t": 1685087999500
|
2516
|
+
# }
|
2517
|
+
# ]
|
2518
|
+
# }
|
2519
|
+
# }
|
2520
|
+
#
|
2521
|
+
result = self.safe_value(response, 'result', {})
|
2522
|
+
data = self.safe_value(result, 'data', [])
|
2523
|
+
settlements = self.parse_settlements(data, market)
|
2524
|
+
sorted = self.sort_by(settlements, 'timestamp')
|
2525
|
+
return self.filter_by_symbol_since_limit(sorted, symbol, since, limit)
|
2526
|
+
|
2527
|
+
def parse_settlement(self, settlement, market):
|
2528
|
+
#
|
2529
|
+
# {
|
2530
|
+
# "i": "BTCUSD-230526",
|
2531
|
+
# "x": 1685088000000,
|
2532
|
+
# "v": "26464.1",
|
2533
|
+
# "t": 1685087999500
|
2534
|
+
# }
|
2535
|
+
#
|
2536
|
+
timestamp = self.safe_integer(settlement, 'x')
|
2537
|
+
marketId = self.safe_string(settlement, 'i')
|
2538
|
+
return {
|
2539
|
+
'info': settlement,
|
2540
|
+
'symbol': self.safe_symbol(marketId, market),
|
2541
|
+
'price': self.safe_number(settlement, 'v'),
|
2542
|
+
'timestamp': timestamp,
|
2543
|
+
'datetime': self.iso8601(timestamp),
|
2544
|
+
}
|
2545
|
+
|
2546
|
+
def parse_settlements(self, settlements, market):
|
2547
|
+
#
|
2548
|
+
# [
|
2549
|
+
# {
|
2550
|
+
# "i": "BTCUSD-230526",
|
2551
|
+
# "x": 1685088000000,
|
2552
|
+
# "v": "26464.1",
|
2553
|
+
# "t": 1685087999500
|
2554
|
+
# }
|
2555
|
+
# ]
|
2556
|
+
#
|
2557
|
+
result = []
|
2558
|
+
for i in range(0, len(settlements)):
|
2559
|
+
result.append(self.parse_settlement(settlements[i], market))
|
2560
|
+
return result
|
2561
|
+
|
2479
2562
|
def nonce(self):
|
2480
2563
|
return self.milliseconds()
|
2481
2564
|
|
ccxt/async_support/deribit.py
CHANGED
@@ -559,6 +559,7 @@ class deribit(Exchange, ImplicitAPI):
|
|
559
559
|
# testnet: False
|
560
560
|
# }
|
561
561
|
#
|
562
|
+
parsedMarkets = {}
|
562
563
|
currenciesResult = self.safe_value(currenciesResponse, 'result', [])
|
563
564
|
result = []
|
564
565
|
for i in range(0, len(currenciesResult)):
|
@@ -679,6 +680,10 @@ class deribit(Exchange, ImplicitAPI):
|
|
679
680
|
optionType = self.safe_string(market, 'option_type')
|
680
681
|
letter = 'C' if (optionType == 'call') else 'P'
|
681
682
|
symbol = symbol + '-' + self.number_to_string(strike) + '-' + letter
|
683
|
+
parsedMarketValue = self.safe_value(parsedMarkets, symbol)
|
684
|
+
if parsedMarketValue:
|
685
|
+
continue
|
686
|
+
parsedMarkets[symbol] = True
|
682
687
|
minTradeAmount = self.safe_number(market, 'min_trade_amount')
|
683
688
|
tickSize = self.safe_number(market, 'tick_size')
|
684
689
|
result.append({
|
ccxt/async_support/kucoin.py
CHANGED
@@ -77,7 +77,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
77
77
|
'fetchDepositAddressesByNetwork': True,
|
78
78
|
'fetchDeposits': True,
|
79
79
|
'fetchDepositWithdrawFee': True,
|
80
|
-
'fetchDepositWithdrawFees':
|
80
|
+
'fetchDepositWithdrawFees': True,
|
81
81
|
'fetchFundingHistory': False,
|
82
82
|
'fetchFundingRate': False,
|
83
83
|
'fetchFundingRateHistory': False,
|
@@ -752,6 +752,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
752
752
|
async def fetch_currencies(self, params={}):
|
753
753
|
"""
|
754
754
|
fetches all available currencies on an exchange
|
755
|
+
see https://docs.kucoin.com/#get-currencies
|
755
756
|
:param dict params: extra parameters specific to the kucoin api endpoint
|
756
757
|
:returns dict: an associative dictionary of currencies
|
757
758
|
"""
|
@@ -930,22 +931,33 @@ class kucoin(Exchange, ImplicitAPI):
|
|
930
931
|
# "chain": "ERC20"
|
931
932
|
# }
|
932
933
|
#
|
933
|
-
result =
|
934
|
+
result = {
|
935
|
+
'info': fee,
|
936
|
+
'withdraw': {
|
937
|
+
'fee': None,
|
938
|
+
'percentage': None,
|
939
|
+
},
|
940
|
+
'deposit': {
|
941
|
+
'fee': None,
|
942
|
+
'percentage': None,
|
943
|
+
},
|
944
|
+
'networks': {},
|
945
|
+
}
|
934
946
|
isWithdrawEnabled = self.safe_value(fee, 'isWithdrawEnabled')
|
935
947
|
if isWithdrawEnabled:
|
948
|
+
result['withdraw']['fee'] = self.safe_number(fee, 'withdrawalMinFee')
|
949
|
+
result['withdraw']['percentage'] = False
|
936
950
|
networkId = self.safe_string(fee, 'chain')
|
937
|
-
|
938
|
-
|
939
|
-
'
|
940
|
-
'
|
941
|
-
'
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
}
|
948
|
-
return self.assign_default_deposit_withdraw_fees(result)
|
951
|
+
if networkId:
|
952
|
+
networkCode = self.network_id_to_code(networkId, self.safe_string(currency, 'code'))
|
953
|
+
result['networks'][networkCode] = {
|
954
|
+
'withdraw': result['withdraw'],
|
955
|
+
'deposit': {
|
956
|
+
'fee': None,
|
957
|
+
'percentage': None,
|
958
|
+
},
|
959
|
+
}
|
960
|
+
return result
|
949
961
|
|
950
962
|
def is_futures_method(self, methodName, params):
|
951
963
|
#
|
@@ -3497,6 +3509,37 @@ class kucoin(Exchange, ImplicitAPI):
|
|
3497
3509
|
'info': info,
|
3498
3510
|
}
|
3499
3511
|
|
3512
|
+
async def fetch_deposit_withdraw_fees(self, codes: Optional[List[str]] = None, params={}):
|
3513
|
+
"""
|
3514
|
+
fetch deposit and withdraw fees - *IMPORTANT* use fetchDepositWithdrawFee to get more in-depth info
|
3515
|
+
see https://docs.kucoin.com/#get-currencies
|
3516
|
+
:param [str]|None codes: list of unified currency codes
|
3517
|
+
:param dict params: extra parameters specific to the kucoin api endpoint
|
3518
|
+
:returns dict: a list of `fee structures <https://docs.ccxt.com/en/latest/manual.html#fee-structure>`
|
3519
|
+
"""
|
3520
|
+
await self.load_markets()
|
3521
|
+
response = await self.publicGetCurrencies(params)
|
3522
|
+
#
|
3523
|
+
# [
|
3524
|
+
# {
|
3525
|
+
# "currency": "CSP",
|
3526
|
+
# "name": "CSP",
|
3527
|
+
# "fullName": "Caspian",
|
3528
|
+
# "precision": 8,
|
3529
|
+
# "confirms": 12,
|
3530
|
+
# "contractAddress": "0xa6446d655a0c34bc4f05042ee88170d056cbaf45",
|
3531
|
+
# "withdrawalMinSize": "2000",
|
3532
|
+
# "withdrawalMinFee": "1000",
|
3533
|
+
# "isWithdrawEnabled": True,
|
3534
|
+
# "isDepositEnabled": True,
|
3535
|
+
# "isMarginEnabled": False,
|
3536
|
+
# "isDebitEnabled": False
|
3537
|
+
# },
|
3538
|
+
# ]
|
3539
|
+
#
|
3540
|
+
data = self.safe_value(response, 'data', [])
|
3541
|
+
return self.parse_deposit_withdraw_fees(data, codes, 'currency')
|
3542
|
+
|
3500
3543
|
def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
|
3501
3544
|
#
|
3502
3545
|
# the v2 URL is https://openapi-v2.kucoin.com/api/v1/endpoint
|
ccxt/async_support/luno.py
CHANGED
@@ -727,7 +727,7 @@ class luno(Exchange, ImplicitAPI):
|
|
727
727
|
await self.load_markets()
|
728
728
|
market = self.market(symbol)
|
729
729
|
request = {
|
730
|
-
'
|
730
|
+
'pair': market['id'],
|
731
731
|
}
|
732
732
|
response = await self.privateGetFeeInfo(self.extend(request, params))
|
733
733
|
#
|
ccxt/async_support/okx.py
CHANGED
@@ -188,6 +188,7 @@ class okx(Exchange, ImplicitAPI):
|
|
188
188
|
'market/index-candles': 1,
|
189
189
|
'market/mark-price-candles': 1,
|
190
190
|
'market/trades': 1,
|
191
|
+
'market/history-trades': 2,
|
191
192
|
'market/platform-24-volume': 10,
|
192
193
|
'market/open-oracle': 40,
|
193
194
|
'market/index-components': 1,
|
ccxt/base/exchange.py
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
# -----------------------------------------------------------------------------
|
6
6
|
|
7
|
-
__version__ = '3.1.
|
7
|
+
__version__ = '3.1.54'
|
8
8
|
|
9
9
|
# -----------------------------------------------------------------------------
|
10
10
|
|
@@ -1728,8 +1728,6 @@ class Exchange(object):
|
|
1728
1728
|
val = val + 1
|
1729
1729
|
if val > 1:
|
1730
1730
|
raise ExchangeError(self.id + ' you have multiple conflicting proxy settings, please use only one from : proxyUrl, httpProxy, httpsProxy, socksProxy, userAgent')
|
1731
|
-
if (val == 1) and (self.proxy is not None):
|
1732
|
-
raise ExchangeError(self.id + ' you have multiple conflicting proxy settings, instead of deprecated .proxy please use from: proxyUrl, httpProxy, httpsProxy, socksProxy')
|
1733
1731
|
return [proxyUrl, httpProxy, httpsProxy, socksProxy]
|
1734
1732
|
|
1735
1733
|
def find_message_hashes(self, client, element: str):
|
@@ -2498,8 +2496,8 @@ class Exchange(object):
|
|
2498
2496
|
percentage = self.safe_value(ticker, 'percentage')
|
2499
2497
|
average = self.safe_value(ticker, 'average')
|
2500
2498
|
vwap = self.safe_value(ticker, 'vwap')
|
2501
|
-
baseVolume = self.
|
2502
|
-
quoteVolume = self.
|
2499
|
+
baseVolume = self.safe_string(ticker, 'baseVolume')
|
2500
|
+
quoteVolume = self.safe_string(ticker, 'quoteVolume')
|
2503
2501
|
if vwap is None:
|
2504
2502
|
vwap = Precise.string_div(quoteVolume, baseVolume)
|
2505
2503
|
if (last is not None) and (close is None):
|