Fix docs and add outer join support for merging funding rates across full timerange

This commit is contained in:
froggleston
2022-05-18 12:47:37 +01:00
parent c41d4c4f45
commit 736f9f4972
2 changed files with 10 additions and 4 deletions

View File

@@ -294,9 +294,15 @@ class Backtesting:
self.futures_data[pair] = mark_rates_dict[pair]
else:
self.futures_data[pair] = mark_rates_dict[pair].merge(
funding_rates_dict[pair], on='date',
how="inner", suffixes=["_fund", "_mark"])
if "futures_funding_rate" in self.config:
self.futures_data[pair] = mark_rates_dict[pair].merge(
funding_rates_dict[pair], on='date',
how="outer", suffixes=["_fund", "_mark"]).fillna(
self.config.get('futures_funding_rate'))
else:
self.futures_data[pair] = mark_rates_dict[pair].merge(
funding_rates_dict[pair], on='date',
how="inner", suffixes=["_fund", "_mark"])
if unavailable_pairs:
raise OperationalException(