diff --git a/freqtrade/exchange/binance.py b/freqtrade/exchange/binance.py index 4161b627d..fa96eae1a 100644 --- a/freqtrade/exchange/binance.py +++ b/freqtrade/exchange/binance.py @@ -92,7 +92,7 @@ class Binance(Exchange): except ccxt.BaseError as e: raise OperationalException(e) from e - def _get_funding_rate(self, pair: str, when: datetime) -> Optional[float]: + def _calculate_funding_rate(self, pair: str, premium_index: float) -> Optional[float]: """ Get's the funding_rate for a pair at a specific date and time in the past """ @@ -101,9 +101,10 @@ class Binance(Exchange): def _get_funding_fee( self, + pair: str, contract_size: float, mark_price: float, - funding_rate: Optional[float], + premium_index: Optional[float], ) -> float: """ Calculates a single funding fee @@ -113,8 +114,8 @@ class Binance(Exchange): - interest rate: 0.03% daily, BNBUSDT, LINKUSDT, and LTCUSDT are 0% - premium: varies by price difference between the perpetual contract and mark price """ - if funding_rate is None: + if premium_index is None: raise OperationalException("Funding rate cannot be None for Binance._get_funding_fee") nominal_value = mark_price * contract_size - adjustment = nominal_value * funding_rate + adjustment = nominal_value * _calculate_funding_rate(pair, premium_index) return adjustment diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index 3236ee8f8..2f49cdcaa 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -1555,14 +1555,6 @@ class Exchange: except ccxt.BaseError as e: raise OperationalException(e) from e - def _get_mark_price(self, pair: str, when: datetime): - """ - Get's the value of the underlying asset for a futures contract - at a specific date and time in the past - """ - # TODO-lev: implement - raise OperationalException(f"get_mark_price has not been implemented for {self.name}") - def _get_funding_rate(self, pair: str, when: datetime): """ Get's the funding_rate for a pair at a specific date and time in the past