Use exchange method to combine funding and mark candles
This commit is contained in:
parent
0e158b66b0
commit
6bd5535d6c
@ -2420,7 +2420,7 @@ class Exchange:
|
|||||||
:param mark_rates: Dataframe containing Mark rates (Type mark_ohlcv_price)
|
:param mark_rates: Dataframe containing Mark rates (Type mark_ohlcv_price)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return funding_rates.merge(mark_rates, on='date', how="inner", suffixes=["_fund", "_mark"])
|
return mark_rates.merge(funding_rates, on='date', how="inner", suffixes=["_mark", "_fund"])
|
||||||
|
|
||||||
def calculate_funding_fees(
|
def calculate_funding_fees(
|
||||||
self,
|
self,
|
||||||
|
@ -296,9 +296,10 @@ class Backtesting:
|
|||||||
how="outer", suffixes=["_mark", "_fund"])['open_fund'].fillna(
|
how="outer", suffixes=["_mark", "_fund"])['open_fund'].fillna(
|
||||||
self.config.get('futures_funding_rate'))
|
self.config.get('futures_funding_rate'))
|
||||||
else:
|
else:
|
||||||
self.futures_data[pair] = mark_rates_dict[pair].merge(
|
self.futures_data[pair] = self.exchange.combine_funding_and_mark(
|
||||||
funding_rates_dict[pair], on='date',
|
funding_rates=funding_rates_dict[pair],
|
||||||
how="inner", suffixes=["_mark", "_fund"])
|
mark_rates=mark_rates_dict[pair]
|
||||||
|
)
|
||||||
|
|
||||||
if unavailable_pairs:
|
if unavailable_pairs:
|
||||||
raise OperationalException(
|
raise OperationalException(
|
||||||
|
Loading…
Reference in New Issue
Block a user