ccxt 4.4.13__py2.py3-none-any.whl → 4.4.15__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 -1
- ccxt/abstract/binance.py +1 -0
- ccxt/abstract/binancecoinm.py +1 -0
- ccxt/abstract/binanceus.py +1 -0
- ccxt/abstract/binanceusdm.py +1 -0
- ccxt/abstract/cryptocom.py +1 -0
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +34 -1
- ccxt/async_support/binance.py +69 -11
- ccxt/async_support/bitget.py +101 -3
- ccxt/async_support/bitrue.py +1 -7
- ccxt/async_support/bitvavo.py +1 -3
- ccxt/async_support/coinex.py +13 -1
- ccxt/async_support/cryptocom.py +1 -0
- ccxt/async_support/digifinex.py +13 -1
- ccxt/async_support/htx.py +1 -1
- ccxt/async_support/huobijp.py +1 -3
- ccxt/async_support/kucoin.py +36 -1
- ccxt/async_support/kucoinfutures.py +55 -4
- ccxt/async_support/mexc.py +52 -8
- ccxt/async_support/okx.py +12 -0
- ccxt/async_support/onetrading.py +2 -2
- ccxt/async_support/poloniexfutures.py +35 -11
- ccxt/async_support/vertex.py +8 -0
- ccxt/async_support/woo.py +12 -0
- ccxt/async_support/woofipro.py +12 -0
- ccxt/async_support/xt.py +12 -0
- ccxt/base/exchange.py +38 -2
- ccxt/binance.py +69 -11
- ccxt/bitget.py +101 -3
- ccxt/bitrue.py +1 -7
- ccxt/bitvavo.py +1 -3
- ccxt/coinex.py +13 -1
- ccxt/cryptocom.py +1 -0
- ccxt/digifinex.py +13 -1
- ccxt/htx.py +1 -1
- ccxt/huobijp.py +1 -3
- ccxt/kucoin.py +36 -1
- ccxt/kucoinfutures.py +55 -4
- ccxt/mexc.py +52 -8
- ccxt/okx.py +12 -0
- ccxt/onetrading.py +2 -2
- ccxt/poloniexfutures.py +35 -11
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/binance.py +1 -1
- ccxt/pro/okx.py +38 -0
- ccxt/pro/upbit.py +42 -1
- ccxt/pro/vertex.py +11 -0
- ccxt/test/tests_async.py +53 -53
- ccxt/test/tests_helpers.py +14 -0
- ccxt/test/tests_sync.py +53 -53
- ccxt/vertex.py +8 -0
- ccxt/woo.py +12 -0
- ccxt/woofipro.py +12 -0
- ccxt/xt.py +12 -0
- {ccxt-4.4.13.dist-info → ccxt-4.4.15.dist-info}/METADATA +4 -4
- {ccxt-4.4.13.dist-info → ccxt-4.4.15.dist-info}/RECORD +60 -60
- {ccxt-4.4.13.dist-info → ccxt-4.4.15.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.13.dist-info → ccxt-4.4.15.dist-info}/WHEEL +0 -0
- {ccxt-4.4.13.dist-info → ccxt-4.4.15.dist-info}/top_level.txt +0 -0
ccxt/__init__.py
CHANGED
ccxt/abstract/binance.py
CHANGED
@@ -414,6 +414,7 @@ class ImplicitAPI:
|
|
414
414
|
dapipublic_get_ticker_bookticker = dapiPublicGetTickerBookTicker = Entry('ticker/bookTicker', 'dapiPublic', 'GET', {'cost': 2, 'noSymbol': 5})
|
415
415
|
dapipublic_get_constituents = dapiPublicGetConstituents = Entry('constituents', 'dapiPublic', 'GET', {'cost': 2})
|
416
416
|
dapipublic_get_openinterest = dapiPublicGetOpenInterest = Entry('openInterest', 'dapiPublic', 'GET', {'cost': 1})
|
417
|
+
dapipublic_get_fundinginfo = dapiPublicGetFundingInfo = Entry('fundingInfo', 'dapiPublic', 'GET', {'cost': 1})
|
417
418
|
dapidata_get_delivery_price = dapiDataGetDeliveryPrice = Entry('delivery-price', 'dapiData', 'GET', {'cost': 1})
|
418
419
|
dapidata_get_openinteresthist = dapiDataGetOpenInterestHist = Entry('openInterestHist', 'dapiData', 'GET', {'cost': 1})
|
419
420
|
dapidata_get_toplongshortaccountratio = dapiDataGetTopLongShortAccountRatio = Entry('topLongShortAccountRatio', 'dapiData', 'GET', {'cost': 1})
|
ccxt/abstract/binancecoinm.py
CHANGED
@@ -414,6 +414,7 @@ class ImplicitAPI:
|
|
414
414
|
dapipublic_get_ticker_bookticker = dapiPublicGetTickerBookTicker = Entry('ticker/bookTicker', 'dapiPublic', 'GET', {'cost': 2, 'noSymbol': 5})
|
415
415
|
dapipublic_get_constituents = dapiPublicGetConstituents = Entry('constituents', 'dapiPublic', 'GET', {'cost': 2})
|
416
416
|
dapipublic_get_openinterest = dapiPublicGetOpenInterest = Entry('openInterest', 'dapiPublic', 'GET', {'cost': 1})
|
417
|
+
dapipublic_get_fundinginfo = dapiPublicGetFundingInfo = Entry('fundingInfo', 'dapiPublic', 'GET', {'cost': 1})
|
417
418
|
dapidata_get_delivery_price = dapiDataGetDeliveryPrice = Entry('delivery-price', 'dapiData', 'GET', {'cost': 1})
|
418
419
|
dapidata_get_openinteresthist = dapiDataGetOpenInterestHist = Entry('openInterestHist', 'dapiData', 'GET', {'cost': 1})
|
419
420
|
dapidata_get_toplongshortaccountratio = dapiDataGetTopLongShortAccountRatio = Entry('topLongShortAccountRatio', 'dapiData', 'GET', {'cost': 1})
|
ccxt/abstract/binanceus.py
CHANGED
@@ -466,6 +466,7 @@ class ImplicitAPI:
|
|
466
466
|
dapipublic_get_ticker_bookticker = dapiPublicGetTickerBookTicker = Entry('ticker/bookTicker', 'dapiPublic', 'GET', {'cost': 2, 'noSymbol': 5})
|
467
467
|
dapipublic_get_constituents = dapiPublicGetConstituents = Entry('constituents', 'dapiPublic', 'GET', {'cost': 2})
|
468
468
|
dapipublic_get_openinterest = dapiPublicGetOpenInterest = Entry('openInterest', 'dapiPublic', 'GET', {'cost': 1})
|
469
|
+
dapipublic_get_fundinginfo = dapiPublicGetFundingInfo = Entry('fundingInfo', 'dapiPublic', 'GET', {'cost': 1})
|
469
470
|
dapidata_get_delivery_price = dapiDataGetDeliveryPrice = Entry('delivery-price', 'dapiData', 'GET', {'cost': 1})
|
470
471
|
dapidata_get_openinteresthist = dapiDataGetOpenInterestHist = Entry('openInterestHist', 'dapiData', 'GET', {'cost': 1})
|
471
472
|
dapidata_get_toplongshortaccountratio = dapiDataGetTopLongShortAccountRatio = Entry('topLongShortAccountRatio', 'dapiData', 'GET', {'cost': 1})
|
ccxt/abstract/binanceusdm.py
CHANGED
@@ -414,6 +414,7 @@ class ImplicitAPI:
|
|
414
414
|
dapipublic_get_ticker_bookticker = dapiPublicGetTickerBookTicker = Entry('ticker/bookTicker', 'dapiPublic', 'GET', {'cost': 2, 'noSymbol': 5})
|
415
415
|
dapipublic_get_constituents = dapiPublicGetConstituents = Entry('constituents', 'dapiPublic', 'GET', {'cost': 2})
|
416
416
|
dapipublic_get_openinterest = dapiPublicGetOpenInterest = Entry('openInterest', 'dapiPublic', 'GET', {'cost': 1})
|
417
|
+
dapipublic_get_fundinginfo = dapiPublicGetFundingInfo = Entry('fundingInfo', 'dapiPublic', 'GET', {'cost': 1})
|
417
418
|
dapidata_get_delivery_price = dapiDataGetDeliveryPrice = Entry('delivery-price', 'dapiData', 'GET', {'cost': 1})
|
418
419
|
dapidata_get_openinteresthist = dapiDataGetOpenInterestHist = Entry('openInterestHist', 'dapiData', 'GET', {'cost': 1})
|
419
420
|
dapidata_get_toplongshortaccountratio = dapiDataGetTopLongShortAccountRatio = Entry('topLongShortAccountRatio', 'dapiData', 'GET', {'cost': 1})
|
ccxt/abstract/cryptocom.py
CHANGED
@@ -11,6 +11,7 @@ class ImplicitAPI:
|
|
11
11
|
v1_public_get_public_get_valuations = v1PublicGetPublicGetValuations = Entry('public/get-valuations', ['v1', 'public'], 'GET', {'cost': 1})
|
12
12
|
v1_public_get_public_get_expired_settlement_price = v1PublicGetPublicGetExpiredSettlementPrice = Entry('public/get-expired-settlement-price', ['v1', 'public'], 'GET', {'cost': 3.3333333333333335})
|
13
13
|
v1_public_get_public_get_insurance = v1PublicGetPublicGetInsurance = Entry('public/get-insurance', ['v1', 'public'], 'GET', {'cost': 1})
|
14
|
+
v1_public_get_public_get_risk_parameters = v1PublicGetPublicGetRiskParameters = Entry('public/get-risk-parameters', ['v1', 'public'], 'GET', {'cost': 1})
|
14
15
|
v1_public_post_public_staking_get_conversion_rate = v1PublicPostPublicStakingGetConversionRate = Entry('public/staking/get-conversion-rate', ['v1', 'public'], 'POST', {'cost': 2})
|
15
16
|
v1_private_post_private_set_cancel_on_disconnect = v1PrivatePostPrivateSetCancelOnDisconnect = Entry('private/set-cancel-on-disconnect', ['v1', 'private'], 'POST', {'cost': 3.3333333333333335})
|
16
17
|
v1_private_post_private_get_cancel_on_disconnect = v1PrivatePostPrivateGetCancelOnDisconnect = Entry('private/get-cancel-on-disconnect', ['v1', 'private'], 'POST', {'cost': 3.3333333333333335})
|
ccxt/async_support/__init__.py
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# -----------------------------------------------------------------------------
|
4
4
|
|
5
|
-
__version__ = '4.4.
|
5
|
+
__version__ = '4.4.15'
|
6
6
|
|
7
7
|
# -----------------------------------------------------------------------------
|
8
8
|
|
@@ -661,6 +661,9 @@ class Exchange(BaseExchange):
|
|
661
661
|
async def fetch_funding_rates(self, symbols: Strings = None, params={}):
|
662
662
|
raise NotSupported(self.id + ' fetchFundingRates() is not supported yet')
|
663
663
|
|
664
|
+
async def fetch_funding_intervals(self, symbols: Strings = None, params={}):
|
665
|
+
raise NotSupported(self.id + ' fetchFundingIntervals() is not supported yet')
|
666
|
+
|
664
667
|
async def watch_funding_rate(self, symbol: str, params={}):
|
665
668
|
raise NotSupported(self.id + ' watchFundingRate() is not supported yet')
|
666
669
|
|
@@ -1016,6 +1019,20 @@ class Exchange(BaseExchange):
|
|
1016
1019
|
else:
|
1017
1020
|
raise NotSupported(self.id + ' fetchTicker() is not supported yet')
|
1018
1021
|
|
1022
|
+
async def fetch_mark_price(self, symbol: str, params={}):
|
1023
|
+
if self.has['fetchMarkPrices']:
|
1024
|
+
await self.load_markets()
|
1025
|
+
market = self.market(symbol)
|
1026
|
+
symbol = market['symbol']
|
1027
|
+
tickers = await self.fetch_mark_prices([symbol], params)
|
1028
|
+
ticker = self.safe_dict(tickers, symbol)
|
1029
|
+
if ticker is None:
|
1030
|
+
raise NullResponse(self.id + ' fetchMarkPrices() could not find a ticker for ' + symbol)
|
1031
|
+
else:
|
1032
|
+
return ticker
|
1033
|
+
else:
|
1034
|
+
raise NotSupported(self.id + ' fetchMarkPrices() is not supported yet')
|
1035
|
+
|
1019
1036
|
async def fetch_ticker_ws(self, symbol: str, params={}):
|
1020
1037
|
if self.has['fetchTickersWs']:
|
1021
1038
|
await self.load_markets()
|
@@ -1680,6 +1697,22 @@ class Exchange(BaseExchange):
|
|
1680
1697
|
else:
|
1681
1698
|
raise NotSupported(self.id + ' fetchFundingRate() is not supported yet')
|
1682
1699
|
|
1700
|
+
async def fetch_funding_interval(self, symbol: str, params={}):
|
1701
|
+
if self.has['fetchFundingIntervals']:
|
1702
|
+
await self.load_markets()
|
1703
|
+
market = self.market(symbol)
|
1704
|
+
symbol = market['symbol']
|
1705
|
+
if not market['contract']:
|
1706
|
+
raise BadSymbol(self.id + ' fetchFundingInterval() supports contract markets only')
|
1707
|
+
rates = await self.fetch_funding_intervals([symbol], params)
|
1708
|
+
rate = self.safe_value(rates, symbol)
|
1709
|
+
if rate is None:
|
1710
|
+
raise NullResponse(self.id + ' fetchFundingInterval() returned no data for ' + symbol)
|
1711
|
+
else:
|
1712
|
+
return rate
|
1713
|
+
else:
|
1714
|
+
raise NotSupported(self.id + ' fetchFundingInterval() is not supported yet')
|
1715
|
+
|
1683
1716
|
async def fetch_mark_ohlcv(self, symbol, timeframe='1m', since: Int = None, limit: Int = None, params={}):
|
1684
1717
|
"""
|
1685
1718
|
fetches historical mark price candlestick data containing the open, high, low, and close price of a market
|
ccxt/async_support/binance.py
CHANGED
@@ -112,6 +112,8 @@ class binance(Exchange, ImplicitAPI):
|
|
112
112
|
'fetchDepositWithdrawFee': 'emulated',
|
113
113
|
'fetchDepositWithdrawFees': True,
|
114
114
|
'fetchFundingHistory': True,
|
115
|
+
'fetchFundingInterval': 'emulated',
|
116
|
+
'fetchFundingIntervals': True,
|
115
117
|
'fetchFundingRate': True,
|
116
118
|
'fetchFundingRateHistory': True,
|
117
119
|
'fetchFundingRates': True,
|
@@ -735,6 +737,7 @@ class binance(Exchange, ImplicitAPI):
|
|
735
737
|
'ticker/bookTicker': {'cost': 2, 'noSymbol': 5},
|
736
738
|
'constituents': 2,
|
737
739
|
'openInterest': 1,
|
740
|
+
'fundingInfo': 1,
|
738
741
|
},
|
739
742
|
},
|
740
743
|
'dapiData': {
|
@@ -8829,16 +8832,28 @@ class binance(Exchange, ImplicitAPI):
|
|
8829
8832
|
def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
|
8830
8833
|
# ensure it matches with https://www.binance.com/en/futures/funding-history/0
|
8831
8834
|
#
|
8832
|
-
#
|
8833
|
-
#
|
8834
|
-
#
|
8835
|
-
#
|
8836
|
-
#
|
8837
|
-
#
|
8838
|
-
#
|
8839
|
-
#
|
8840
|
-
#
|
8841
|
-
#
|
8835
|
+
# fetchFundingRate, fetchFundingRates
|
8836
|
+
#
|
8837
|
+
# {
|
8838
|
+
# "symbol": "BTCUSDT",
|
8839
|
+
# "markPrice": "45802.81129892",
|
8840
|
+
# "indexPrice": "45745.47701915",
|
8841
|
+
# "estimatedSettlePrice": "45133.91753671",
|
8842
|
+
# "lastFundingRate": "0.00063521",
|
8843
|
+
# "interestRate": "0.00010000",
|
8844
|
+
# "nextFundingTime": "1621267200000",
|
8845
|
+
# "time": "1621252344001"
|
8846
|
+
# }
|
8847
|
+
#
|
8848
|
+
# fetchFundingInterval, fetchFundingIntervals
|
8849
|
+
#
|
8850
|
+
# {
|
8851
|
+
# "symbol": "BLZUSDT",
|
8852
|
+
# "adjustedFundingRateCap": "0.03000000",
|
8853
|
+
# "adjustedFundingRateFloor": "-0.03000000",
|
8854
|
+
# "fundingIntervalHours": 4,
|
8855
|
+
# "disclaimer": False
|
8856
|
+
# }
|
8842
8857
|
#
|
8843
8858
|
timestamp = self.safe_integer(contract, 'time')
|
8844
8859
|
marketId = self.safe_string(contract, 'symbol')
|
@@ -8849,6 +8864,10 @@ class binance(Exchange, ImplicitAPI):
|
|
8849
8864
|
estimatedSettlePrice = self.safe_number(contract, 'estimatedSettlePrice')
|
8850
8865
|
fundingRate = self.safe_number(contract, 'lastFundingRate')
|
8851
8866
|
fundingTime = self.safe_integer(contract, 'nextFundingTime')
|
8867
|
+
interval = self.safe_string(contract, 'fundingIntervalHours')
|
8868
|
+
intervalString = None
|
8869
|
+
if interval is not None:
|
8870
|
+
intervalString = interval + 'h'
|
8852
8871
|
return {
|
8853
8872
|
'info': contract,
|
8854
8873
|
'symbol': symbol,
|
@@ -8867,7 +8886,7 @@ class binance(Exchange, ImplicitAPI):
|
|
8867
8886
|
'previousFundingRate': None,
|
8868
8887
|
'previousFundingTimestamp': None,
|
8869
8888
|
'previousFundingDatetime': None,
|
8870
|
-
'interval':
|
8889
|
+
'interval': intervalString,
|
8871
8890
|
}
|
8872
8891
|
|
8873
8892
|
def parse_account_positions(self, account, filterClosed=False):
|
@@ -12581,3 +12600,42 @@ class binance(Exchange, ImplicitAPI):
|
|
12581
12600
|
'price': None,
|
12582
12601
|
'fee': None,
|
12583
12602
|
}
|
12603
|
+
|
12604
|
+
async def fetch_funding_intervals(self, symbols: Strings = None, params={}) -> FundingRates:
|
12605
|
+
"""
|
12606
|
+
fetch the funding rate interval for multiple markets
|
12607
|
+
:see: https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Get-Funding-Info
|
12608
|
+
:see: https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/Get-Funding-Info
|
12609
|
+
:param str[] [symbols]: list of unified market symbols
|
12610
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
12611
|
+
:param str [params.subType]: "linear" or "inverse"
|
12612
|
+
:returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
12613
|
+
"""
|
12614
|
+
await self.load_markets()
|
12615
|
+
market = None
|
12616
|
+
if symbols is not None:
|
12617
|
+
symbols = self.market_symbols(symbols)
|
12618
|
+
market = self.market(symbols[0])
|
12619
|
+
type = 'swap'
|
12620
|
+
subType = None
|
12621
|
+
subType, params = self.handle_sub_type_and_params('fetchFundingIntervals', market, params, 'linear')
|
12622
|
+
response = None
|
12623
|
+
if self.is_linear(type, subType):
|
12624
|
+
response = await self.fapiPublicGetFundingInfo(params)
|
12625
|
+
elif self.is_inverse(type, subType):
|
12626
|
+
response = await self.dapiPublicGetFundingInfo(params)
|
12627
|
+
else:
|
12628
|
+
raise NotSupported(self.id + ' fetchFundingIntervals() supports linear and inverse swap contracts only')
|
12629
|
+
#
|
12630
|
+
# [
|
12631
|
+
# {
|
12632
|
+
# "symbol": "BLZUSDT",
|
12633
|
+
# "adjustedFundingRateCap": "0.03000000",
|
12634
|
+
# "adjustedFundingRateFloor": "-0.03000000",
|
12635
|
+
# "fundingIntervalHours": 4,
|
12636
|
+
# "disclaimer": False
|
12637
|
+
# },
|
12638
|
+
# ]
|
12639
|
+
#
|
12640
|
+
result = self.parse_funding_rates(response, market)
|
12641
|
+
return self.filter_by_array(result, 'symbol', symbols)
|
ccxt/async_support/bitget.py
CHANGED
@@ -101,6 +101,8 @@ class bitget(Exchange, ImplicitAPI):
|
|
101
101
|
'fetchDepositWithdrawFee': 'emulated',
|
102
102
|
'fetchDepositWithdrawFees': True,
|
103
103
|
'fetchFundingHistory': True,
|
104
|
+
'fetchFundingInterval': True,
|
105
|
+
'fetchFundingIntervals': False,
|
104
106
|
'fetchFundingRate': True,
|
105
107
|
'fetchFundingRateHistory': True,
|
106
108
|
'fetchFundingRates': False,
|
@@ -116,6 +118,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
116
118
|
'fetchMarketLeverageTiers': True,
|
117
119
|
'fetchMarkets': True,
|
118
120
|
'fetchMarkOHLCV': True,
|
121
|
+
'fetchMarkPrice': True,
|
119
122
|
'fetchMyLiquidations': True,
|
120
123
|
'fetchMyTrades': True,
|
121
124
|
'fetchOHLCV': True,
|
@@ -2466,6 +2469,14 @@ class bitget(Exchange, ImplicitAPI):
|
|
2466
2469
|
return self.parse_order_book(data, market['symbol'], timestamp)
|
2467
2470
|
|
2468
2471
|
def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
|
2472
|
+
#
|
2473
|
+
# {
|
2474
|
+
# "symbol": "BTCUSDT",
|
2475
|
+
# "price": "26242",
|
2476
|
+
# "indexPrice": "34867",
|
2477
|
+
# "markPrice": "25555",
|
2478
|
+
# "ts": "1695793390482"
|
2479
|
+
# }
|
2469
2480
|
#
|
2470
2481
|
# spot: fetchTicker, fetchTickers
|
2471
2482
|
#
|
@@ -2571,6 +2582,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
2571
2582
|
'baseVolume': self.safe_string(ticker, 'baseVolume'),
|
2572
2583
|
'quoteVolume': self.safe_string(ticker, 'quoteVolume'),
|
2573
2584
|
'indexPrice': self.safe_string(ticker, 'indexPrice'),
|
2585
|
+
'markPrice': self.safe_string(ticker, 'markPrice'),
|
2574
2586
|
'info': ticker,
|
2575
2587
|
}, market)
|
2576
2588
|
|
@@ -2668,6 +2680,36 @@ class bitget(Exchange, ImplicitAPI):
|
|
2668
2680
|
data = self.safe_list(response, 'data', [])
|
2669
2681
|
return self.parse_ticker(data[0], market)
|
2670
2682
|
|
2683
|
+
async def fetch_mark_price(self, symbol: str, params={}) -> Ticker:
|
2684
|
+
"""
|
2685
|
+
fetches the mark price for a specific market
|
2686
|
+
:see: https://www.bitget.com/api-doc/contract/market/Get-Symbol-Price
|
2687
|
+
:param str symbol: unified symbol of the market to fetch the ticker for
|
2688
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2689
|
+
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
|
2690
|
+
"""
|
2691
|
+
await self.load_markets()
|
2692
|
+
sandboxMode = self.safe_bool(self.options, 'sandboxMode', False)
|
2693
|
+
market = None
|
2694
|
+
if sandboxMode:
|
2695
|
+
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
2696
|
+
market = self.market(sandboxSymbol)
|
2697
|
+
else:
|
2698
|
+
market = self.market(symbol)
|
2699
|
+
request: dict = {
|
2700
|
+
'symbol': market['id'],
|
2701
|
+
}
|
2702
|
+
response = None
|
2703
|
+
if market['spot']:
|
2704
|
+
raise NotSupported(self.id + ' fetchMarkPrice() is not supported for spot markets')
|
2705
|
+
else:
|
2706
|
+
productType = None
|
2707
|
+
productType, params = self.handle_product_type_and_params(market, params)
|
2708
|
+
request['productType'] = productType
|
2709
|
+
response = await self.publicMixGetV2MixMarketSymbolPrice(self.extend(request, params))
|
2710
|
+
data = self.safe_list(response, 'data', [])
|
2711
|
+
return self.parse_ticker(data[0], market)
|
2712
|
+
|
2671
2713
|
async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
|
2672
2714
|
"""
|
2673
2715
|
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
@@ -6304,14 +6346,29 @@ class bitget(Exchange, ImplicitAPI):
|
|
6304
6346
|
return self.parse_funding_rate(data[0], market)
|
6305
6347
|
|
6306
6348
|
def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
|
6349
|
+
#
|
6350
|
+
# fetchFundingRate
|
6307
6351
|
#
|
6308
6352
|
# {
|
6309
6353
|
# "symbol": "BTCUSDT",
|
6310
6354
|
# "fundingRate": "-0.000182"
|
6311
6355
|
# }
|
6312
6356
|
#
|
6357
|
+
# fetchFundingInterval
|
6358
|
+
#
|
6359
|
+
# {
|
6360
|
+
# "symbol": "BTCUSDT",
|
6361
|
+
# "nextFundingTime": "1727942400000",
|
6362
|
+
# "ratePeriod": "8"
|
6363
|
+
# }
|
6364
|
+
#
|
6313
6365
|
marketId = self.safe_string(contract, 'symbol')
|
6314
6366
|
symbol = self.safe_symbol(marketId, market, None, 'swap')
|
6367
|
+
fundingTimestamp = self.safe_integer(contract, 'nextFundingTime')
|
6368
|
+
interval = self.safe_string(contract, 'ratePeriod')
|
6369
|
+
intervalString = None
|
6370
|
+
if interval is not None:
|
6371
|
+
intervalString = interval + 'h'
|
6315
6372
|
return {
|
6316
6373
|
'info': contract,
|
6317
6374
|
'symbol': symbol,
|
@@ -6322,15 +6379,15 @@ class bitget(Exchange, ImplicitAPI):
|
|
6322
6379
|
'timestamp': None,
|
6323
6380
|
'datetime': None,
|
6324
6381
|
'fundingRate': self.safe_number(contract, 'fundingRate'),
|
6325
|
-
'fundingTimestamp':
|
6326
|
-
'fundingDatetime':
|
6382
|
+
'fundingTimestamp': fundingTimestamp,
|
6383
|
+
'fundingDatetime': self.iso8601(fundingTimestamp),
|
6327
6384
|
'nextFundingRate': None,
|
6328
6385
|
'nextFundingTimestamp': None,
|
6329
6386
|
'nextFundingDatetime': None,
|
6330
6387
|
'previousFundingRate': None,
|
6331
6388
|
'previousFundingTimestamp': None,
|
6332
6389
|
'previousFundingDatetime': None,
|
6333
|
-
'interval':
|
6390
|
+
'interval': intervalString,
|
6334
6391
|
}
|
6335
6392
|
|
6336
6393
|
async def fetch_funding_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[FundingHistory]:
|
@@ -8174,6 +8231,47 @@ class bitget(Exchange, ImplicitAPI):
|
|
8174
8231
|
}
|
8175
8232
|
return result
|
8176
8233
|
|
8234
|
+
async def fetch_funding_interval(self, symbol: str, params={}) -> FundingRate:
|
8235
|
+
"""
|
8236
|
+
fetch the current funding rate interval
|
8237
|
+
:see: https://www.bitget.com/api-doc/contract/market/Get-Symbol-Next-Funding-Time
|
8238
|
+
:param str symbol: unified market symbol
|
8239
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
8240
|
+
:returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
8241
|
+
"""
|
8242
|
+
await self.load_markets()
|
8243
|
+
sandboxMode = self.safe_bool(self.options, 'sandboxMode', False)
|
8244
|
+
market = None
|
8245
|
+
if sandboxMode:
|
8246
|
+
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
8247
|
+
market = self.market(sandboxSymbol)
|
8248
|
+
else:
|
8249
|
+
market = self.market(symbol)
|
8250
|
+
productType = None
|
8251
|
+
productType, params = self.handle_product_type_and_params(market, params)
|
8252
|
+
request: dict = {
|
8253
|
+
'symbol': market['id'],
|
8254
|
+
'productType': productType,
|
8255
|
+
}
|
8256
|
+
response = await self.publicMixGetV2MixMarketFundingTime(self.extend(request, params))
|
8257
|
+
#
|
8258
|
+
# {
|
8259
|
+
# "code": "00000",
|
8260
|
+
# "msg": "success",
|
8261
|
+
# "requestTime": 1727930153888,
|
8262
|
+
# "data": [
|
8263
|
+
# {
|
8264
|
+
# "symbol": "BTCUSDT",
|
8265
|
+
# "nextFundingTime": "1727942400000",
|
8266
|
+
# "ratePeriod": "8"
|
8267
|
+
# }
|
8268
|
+
# ]
|
8269
|
+
# }
|
8270
|
+
#
|
8271
|
+
data = self.safe_list(response, 'data', [])
|
8272
|
+
first = self.safe_dict(data, 0, {})
|
8273
|
+
return self.parse_funding_rate(first, market)
|
8274
|
+
|
8177
8275
|
def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
|
8178
8276
|
if not response:
|
8179
8277
|
return None # fallback to default error handler
|
ccxt/async_support/bitrue.py
CHANGED
@@ -345,6 +345,7 @@ class bitrue(Exchange, ImplicitAPI):
|
|
345
345
|
# 'fetchTradesMethod': 'publicGetAggTrades', # publicGetTrades, publicGetHistoricalTrades
|
346
346
|
'fetchMyTradesMethod': 'v2PrivateGetMyTrades', # spotV1PrivateGetMyTrades
|
347
347
|
'hasAlreadyAuthenticatedSuccessfully': False,
|
348
|
+
'currencyToPrecisionRoundingMode': TRUNCATE,
|
348
349
|
'recvWindow': 5 * 1000, # 5 sec, binance default
|
349
350
|
'timeDifference': 0, # the difference between system clock and Binance clock
|
350
351
|
'adjustForTimeDifference': False, # controls the adjustment logic upon instantiation
|
@@ -534,13 +535,6 @@ class bitrue(Exchange, ImplicitAPI):
|
|
534
535
|
},
|
535
536
|
})
|
536
537
|
|
537
|
-
def currency_to_precision(self, code, fee, networkCode=None):
|
538
|
-
# info is available in currencies only if the user has configured his api keys
|
539
|
-
if self.safe_value(self.currencies[code], 'precision') is not None:
|
540
|
-
return self.decimal_to_precision(fee, TRUNCATE, self.currencies[code]['precision'], self.precisionMode, self.paddingMode)
|
541
|
-
else:
|
542
|
-
return self.number_to_string(fee)
|
543
|
-
|
544
538
|
def nonce(self):
|
545
539
|
return self.milliseconds() - self.options['timeDifference']
|
546
540
|
|
ccxt/async_support/bitvavo.py
CHANGED
@@ -284,6 +284,7 @@ class bitvavo(Exchange, ImplicitAPI):
|
|
284
284
|
},
|
285
285
|
},
|
286
286
|
'options': {
|
287
|
+
'currencyToPrecisionRoundingMode': TRUNCATE,
|
287
288
|
'BITVAVO-ACCESS-WINDOW': 10000, # default 10 sec
|
288
289
|
'networks': {
|
289
290
|
'ERC20': 'ETH',
|
@@ -296,9 +297,6 @@ class bitvavo(Exchange, ImplicitAPI):
|
|
296
297
|
},
|
297
298
|
})
|
298
299
|
|
299
|
-
def currency_to_precision(self, code, fee, networkCode=None):
|
300
|
-
return self.decimal_to_precision(fee, 0, self.currencies[code]['precision'], DECIMAL_PLACES)
|
301
|
-
|
302
300
|
def amount_to_precision(self, symbol, amount):
|
303
301
|
# https://docs.bitfinex.com/docs/introduction#amount-precision
|
304
302
|
# The amount field allows up to 8 decimals.
|
ccxt/async_support/coinex.py
CHANGED
@@ -85,6 +85,8 @@ class coinex(Exchange, ImplicitAPI):
|
|
85
85
|
'fetchDepositWithdrawFee': True,
|
86
86
|
'fetchDepositWithdrawFees': False,
|
87
87
|
'fetchFundingHistory': True,
|
88
|
+
'fetchFundingInterval': True,
|
89
|
+
'fetchFundingIntervals': False,
|
88
90
|
'fetchFundingRate': True,
|
89
91
|
'fetchFundingRateHistory': True,
|
90
92
|
'fetchFundingRates': True,
|
@@ -4294,9 +4296,19 @@ class coinex(Exchange, ImplicitAPI):
|
|
4294
4296
|
first = self.safe_dict(data, 0, {})
|
4295
4297
|
return self.parse_funding_rate(first, market)
|
4296
4298
|
|
4299
|
+
async def fetch_funding_interval(self, symbol: str, params={}) -> FundingRate:
|
4300
|
+
"""
|
4301
|
+
fetch the current funding rate interval
|
4302
|
+
:see: https://docs.coinex.com/api/v2/futures/market/http/list-market-funding-rate
|
4303
|
+
:param str symbol: unified market symbol
|
4304
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4305
|
+
:returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
4306
|
+
"""
|
4307
|
+
return await self.fetch_funding_rate(symbol, params)
|
4308
|
+
|
4297
4309
|
def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
|
4298
4310
|
#
|
4299
|
-
# fetchFundingRate, fetchFundingRates
|
4311
|
+
# fetchFundingRate, fetchFundingRates, fetchFundingInterval
|
4300
4312
|
#
|
4301
4313
|
# {
|
4302
4314
|
# "latest_funding_rate": "0",
|
ccxt/async_support/cryptocom.py
CHANGED
@@ -178,6 +178,7 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
178
178
|
'public/get-valuations': 1,
|
179
179
|
'public/get-expired-settlement-price': 10 / 3,
|
180
180
|
'public/get-insurance': 1,
|
181
|
+
'public/get-risk-parameters': 1,
|
181
182
|
},
|
182
183
|
'post': {
|
183
184
|
'public/staking/get-conversion-rate': 2,
|
ccxt/async_support/digifinex.py
CHANGED
@@ -72,6 +72,8 @@ class digifinex(Exchange, ImplicitAPI):
|
|
72
72
|
'fetchDepositWithdrawFee': 'emulated',
|
73
73
|
'fetchDepositWithdrawFees': True,
|
74
74
|
'fetchFundingHistory': True,
|
75
|
+
'fetchFundingInterval': True,
|
76
|
+
'fetchFundingIntervals': False,
|
75
77
|
'fetchFundingRate': True,
|
76
78
|
'fetchFundingRateHistory': True,
|
77
79
|
'fetchFundingRates': False,
|
@@ -3011,9 +3013,19 @@ class digifinex(Exchange, ImplicitAPI):
|
|
3011
3013
|
# }
|
3012
3014
|
# }
|
3013
3015
|
#
|
3014
|
-
data = self.
|
3016
|
+
data = self.safe_dict(response, 'data', {})
|
3015
3017
|
return self.parse_funding_rate(data, market)
|
3016
3018
|
|
3019
|
+
async def fetch_funding_interval(self, symbol: str, params={}) -> FundingRate:
|
3020
|
+
"""
|
3021
|
+
fetch the current funding rate interval
|
3022
|
+
:see: https://docs.digifinex.com/en-ww/swap/v2/rest.html#currentfundingrate
|
3023
|
+
:param str symbol: unified market symbol
|
3024
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3025
|
+
:returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
3026
|
+
"""
|
3027
|
+
return await self.fetch_funding_rate(symbol, params)
|
3028
|
+
|
3017
3029
|
def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
|
3018
3030
|
#
|
3019
3031
|
# {
|
ccxt/async_support/htx.py
CHANGED
@@ -1249,7 +1249,7 @@ class htx(Exchange, ImplicitAPI):
|
|
1249
1249
|
'SBTC': 'SUPERBITCOIN',
|
1250
1250
|
'SOUL': 'SOULSAVER',
|
1251
1251
|
'BIFI': 'BITCOINFILE', # conflict with Beefy.Finance https://github.com/ccxt/ccxt/issues/8706
|
1252
|
-
'FUD': 'FTX Users
|
1252
|
+
'FUD': 'FTX Users Debt',
|
1253
1253
|
},
|
1254
1254
|
})
|
1255
1255
|
|
ccxt/async_support/huobijp.py
CHANGED
@@ -323,6 +323,7 @@ class huobijp(Exchange, ImplicitAPI):
|
|
323
323
|
'fetchMarketsMethod': 'publicGetCommonSymbols',
|
324
324
|
'fetchBalanceMethod': 'privateGetAccountAccountsIdBalance',
|
325
325
|
'createOrderMethod': 'privatePostOrderOrdersPlace',
|
326
|
+
'currencyToPrecisionRoundingMode': TRUNCATE,
|
326
327
|
'language': 'en-US',
|
327
328
|
'broker': {
|
328
329
|
'id': 'AA03022abc',
|
@@ -1561,9 +1562,6 @@ class huobijp(Exchange, ImplicitAPI):
|
|
1561
1562
|
}),
|
1562
1563
|
]
|
1563
1564
|
|
1564
|
-
def currency_to_precision(self, code, fee, networkCode=None):
|
1565
|
-
return self.decimal_to_precision(fee, 0, self.currencies[code]['precision'], self.precisionMode)
|
1566
|
-
|
1567
1565
|
def parse_deposit_address(self, depositAddress, currency: Currency = None):
|
1568
1566
|
#
|
1569
1567
|
# {
|
ccxt/async_support/kucoin.py
CHANGED
@@ -98,6 +98,8 @@ class kucoin(Exchange, ImplicitAPI):
|
|
98
98
|
'fetchMarketLeverageTiers': False,
|
99
99
|
'fetchMarkets': True,
|
100
100
|
'fetchMarkOHLCV': False,
|
101
|
+
'fetchMarkPrice': True,
|
102
|
+
'fetchMarkPrices': True,
|
101
103
|
'fetchMyTrades': True,
|
102
104
|
'fetchOHLCV': True,
|
103
105
|
'fetchOpenInterest': False,
|
@@ -1644,7 +1646,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1644
1646
|
symbol = market['symbol']
|
1645
1647
|
baseVolume = self.safe_string(ticker, 'vol')
|
1646
1648
|
quoteVolume = self.safe_string(ticker, 'volValue')
|
1647
|
-
timestamp = self.
|
1649
|
+
timestamp = self.safe_integer_n(ticker, ['time', 'datetime', 'timePoint'])
|
1648
1650
|
return self.safe_ticker({
|
1649
1651
|
'symbol': symbol,
|
1650
1652
|
'timestamp': timestamp,
|
@@ -1665,6 +1667,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1665
1667
|
'average': self.safe_string(ticker, 'averagePrice'),
|
1666
1668
|
'baseVolume': baseVolume,
|
1667
1669
|
'quoteVolume': quoteVolume,
|
1670
|
+
'markPrice': self.safe_string(ticker, 'value'),
|
1668
1671
|
'info': ticker,
|
1669
1672
|
}, market)
|
1670
1673
|
|
@@ -1719,6 +1722,20 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1719
1722
|
result[symbol] = ticker
|
1720
1723
|
return self.filter_by_array_tickers(result, 'symbol', symbols)
|
1721
1724
|
|
1725
|
+
async def fetch_mark_prices(self, symbols: Strings = None, params={}) -> Tickers:
|
1726
|
+
"""
|
1727
|
+
fetches the mark price for multiple markets
|
1728
|
+
:see: https://www.kucoin.com/docs/rest/margin-trading/margin-info/get-all-margin-trading-pairs-mark-prices
|
1729
|
+
:param str[] [symbols]: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
1730
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1731
|
+
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
1732
|
+
"""
|
1733
|
+
await self.load_markets()
|
1734
|
+
symbols = self.market_symbols(symbols)
|
1735
|
+
response = await self.publicGetMarkPriceAllSymbols(params)
|
1736
|
+
data = self.safe_list(response, 'data', [])
|
1737
|
+
return self.parse_tickers(data)
|
1738
|
+
|
1722
1739
|
async def fetch_ticker(self, symbol: str, params={}) -> Ticker:
|
1723
1740
|
"""
|
1724
1741
|
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
@@ -1759,6 +1776,24 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1759
1776
|
data = self.safe_dict(response, 'data', {})
|
1760
1777
|
return self.parse_ticker(data, market)
|
1761
1778
|
|
1779
|
+
async def fetch_mark_price(self, symbol: str, params={}) -> Ticker:
|
1780
|
+
"""
|
1781
|
+
fetches the mark price for a specific market
|
1782
|
+
:see: https://www.kucoin.com/docs/rest/margin-trading/margin-info/get-mark-price
|
1783
|
+
:param str symbol: unified symbol of the market to fetch the ticker for
|
1784
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1785
|
+
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
|
1786
|
+
"""
|
1787
|
+
await self.load_markets()
|
1788
|
+
market = self.market(symbol)
|
1789
|
+
request: dict = {
|
1790
|
+
'symbol': market['id'],
|
1791
|
+
}
|
1792
|
+
response = await self.publicGetMarkPriceSymbolCurrent(self.extend(request, params))
|
1793
|
+
#
|
1794
|
+
data = self.safe_dict(response, 'data', {})
|
1795
|
+
return self.parse_ticker(data, market)
|
1796
|
+
|
1762
1797
|
def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
|
1763
1798
|
#
|
1764
1799
|
# [
|