Don't attempt to calculate funding fees when the initial timeframe hasn't been exceeded.

This commit is contained in:
Wade Dyck 2021-12-27 16:51:47 -07:00
parent a26c82b7cc
commit 60dfadf446

View File

@ -1865,8 +1865,9 @@ class Exchange:
mark_rates = candle_histories[mark_comb] mark_rates = candle_histories[mark_comb]
df = funding_rates.merge(mark_rates, on='date', how="inner", suffixes=["_fund", "_mark"]) df = funding_rates.merge(mark_rates, on='date', how="inner", suffixes=["_fund", "_mark"])
df = df[(df['date'] >= open_date) & (df['date'] <= close_date)] if not df.empty:
fees = sum(df['open_fund'] * df['open_mark'] * amount) df = df[(df['date'] >= open_date) & (df['date'] <= close_date)]
fees = sum(df['open_fund'] * df['open_mark'] * amount)
return fees return fees