fetch the current funding rate https://www.bitget.com/api-doc/contract/market/Get-Current-Funding-Rate https://www.bitget.com/api-doc/contract/market/Get-Symbol-Next-Funding-Time https://www.bitget.com/api-doc/uta/public/Get-Current-Funding-Rate :param str
(self, symbol: str, params={})
| 8061 | return self.filter_by_symbol_since_limit(sorted, market['symbol'], since, limit) |
| 8062 | |
| 8063 | def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate: |
| 8064 | """ |
| 8065 | fetch the current funding rate |
| 8066 | |
| 8067 | https://www.bitget.com/api-doc/contract/market/Get-Current-Funding-Rate |
| 8068 | https://www.bitget.com/api-doc/contract/market/Get-Symbol-Next-Funding-Time |
| 8069 | https://www.bitget.com/api-doc/uta/public/Get-Current-Funding-Rate |
| 8070 | |
| 8071 | :param str symbol: unified market symbol |
| 8072 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 8073 | :param boolean [params.uta]: set to True for the unified trading account(uta), defaults to False |
| 8074 | :param str [params.method]: either(default) 'publicMixGetV2MixMarketCurrentFundRate' or 'publicMixGetV2MixMarketFundingTime' |
| 8075 | :returns dict: a `funding rate structure <https://docs.ccxt.com/?id=funding-rate-structure>` |
| 8076 | """ |
| 8077 | self.load_markets() |
| 8078 | market = self.market(symbol) |
| 8079 | if not market['swap']: |
| 8080 | raise BadSymbol(self.id + ' fetchFundingRate() supports swap contracts only') |
| 8081 | productType = None |
| 8082 | productType, params = self.handle_product_type_and_params(market, params) |
| 8083 | request = { |
| 8084 | 'symbol': market['id'], |
| 8085 | } |
| 8086 | uta = None |
| 8087 | response = None |
| 8088 | uta, params = self.handle_option_and_params(params, 'fetchFundingRate', 'uta', False) |
| 8089 | if uta: |
| 8090 | response = self.publicUtaGetV3MarketCurrentFundRate(self.extend(request, params)) |
| 8091 | # |
| 8092 | # { |
| 8093 | # "code": "00000", |
| 8094 | # "msg": "success", |
| 8095 | # "requestTime": 1750897372153, |
| 8096 | # "data": [ |
| 8097 | # { |
| 8098 | # "symbol": "BTCUSDT", |
| 8099 | # "fundingRate": "0.00001", |
| 8100 | # "fundingRateInterval": "8", |
| 8101 | # "nextUpdate": "1750924800000", |
| 8102 | # "minFundingRate": "-0.003", |
| 8103 | # "maxFundingRate": "0.003" |
| 8104 | # } |
| 8105 | # ] |
| 8106 | # } |
| 8107 | # |
| 8108 | else: |
| 8109 | request['productType'] = productType |
| 8110 | method = None |
| 8111 | method, params = self.handle_option_and_params(params, 'fetchFundingRate', 'method', 'publicMixGetV2MixMarketCurrentFundRate') |
| 8112 | if method == 'publicMixGetV2MixMarketCurrentFundRate': |
| 8113 | response = self.publicMixGetV2MixMarketCurrentFundRate(self.extend(request, params)) |
| 8114 | # |
| 8115 | # { |
| 8116 | # "code": "00000", |
| 8117 | # "msg": "success", |
| 8118 | # "requestTime": 1745500709429, |
| 8119 | # "data": [ |
| 8120 | # { |
nothing calls this directly
no test coverage detected