mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
calculate_funding_fees is actually a public exchange interface (used in backtesting).
This commit is contained in:
parent
e9e7fd749b
commit
84c6d92d4c
|
@ -1923,7 +1923,7 @@ class Exchange:
|
|||
funding_rates = candle_histories[funding_comb]
|
||||
mark_rates = candle_histories[mark_comb]
|
||||
|
||||
return self._calculate_funding_fees(
|
||||
return self.calculate_funding_fees(
|
||||
funding_rates=funding_rates,
|
||||
mark_rates=mark_rates,
|
||||
amount=amount,
|
||||
|
@ -1931,7 +1931,7 @@ class Exchange:
|
|||
close_date=close_date
|
||||
)
|
||||
|
||||
def _calculate_funding_fees(
|
||||
def calculate_funding_fees(
|
||||
self,
|
||||
funding_rates: DataFrame,
|
||||
mark_rates: DataFrame,
|
||||
|
|
|
@ -159,7 +159,7 @@ class Kraken(Exchange):
|
|||
params['leverage'] = leverage
|
||||
return params
|
||||
|
||||
def _calculate_funding_fees(
|
||||
def calculate_funding_fees(
|
||||
self,
|
||||
funding_rates: DataFrame,
|
||||
mark_rates: DataFrame,
|
||||
|
|
|
@ -488,7 +488,7 @@ class Backtesting:
|
|||
sell_candle_time: datetime = sell_row[DATE_IDX].to_pydatetime()
|
||||
|
||||
if self.trading_mode == TradingMode.FUTURES:
|
||||
trade.funding_fees = self.exchange._calculate_funding_fees(
|
||||
trade.funding_fees = self.exchange.calculate_funding_fees(
|
||||
funding_rates=self.futures_data[CandleType.FUNDING_RATE][trade.pair],
|
||||
mark_rates=self.futures_data[CandleType.MARK][trade.pair],
|
||||
amount=trade.amount,
|
||||
|
|
|
@ -3563,7 +3563,7 @@ def test__calculate_funding_fees(
|
|||
{'date': trade_date, 'open': mark_price},
|
||||
])
|
||||
|
||||
assert exchange._calculate_funding_fees(
|
||||
assert exchange.calculate_funding_fees(
|
||||
funding_rates=funding_rates,
|
||||
mark_rates=mark_rates,
|
||||
amount=size,
|
||||
|
@ -3574,7 +3574,7 @@ def test__calculate_funding_fees(
|
|||
|
||||
if (kraken_fee is None):
|
||||
with pytest.raises(OperationalException):
|
||||
kraken._calculate_funding_fees(
|
||||
kraken.calculate_funding_fees(
|
||||
funding_rates=funding_rates,
|
||||
mark_rates=mark_rates,
|
||||
amount=size,
|
||||
|
@ -3584,7 +3584,7 @@ def test__calculate_funding_fees(
|
|||
)
|
||||
|
||||
else:
|
||||
assert kraken._calculate_funding_fees(
|
||||
assert kraken.calculate_funding_fees(
|
||||
funding_rates=funding_rates,
|
||||
mark_rates=mark_rates,
|
||||
amount=size,
|
||||
|
|
Loading…
Reference in New Issue
Block a user