From 60dfadf44642005c23dc707a543623facfa30719 Mon Sep 17 00:00:00 2001 From: Wade Dyck Date: Mon, 27 Dec 2021 16:51:47 -0700 Subject: [PATCH] Don't attempt to calculate funding fees when the initial timeframe hasn't been exceeded. --- freqtrade/exchange/exchange.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index 0817df0fc..24c2de497 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -1865,8 +1865,9 @@ class Exchange: mark_rates = candle_histories[mark_comb] df = funding_rates.merge(mark_rates, on='date', how="inner", suffixes=["_fund", "_mark"]) - df = df[(df['date'] >= open_date) & (df['date'] <= close_date)] - fees = sum(df['open_fund'] * df['open_mark'] * amount) + if not df.empty: + df = df[(df['date'] >= open_date) & (df['date'] <= close_date)] + fees = sum(df['open_fund'] * df['open_mark'] * amount) return fees