Skip to content

Commit 68e5424

Browse files
committed
fix: calculate meaningful price change properly weighting each pair
closes freqtrade#12588
1 parent e792baf commit 68e5424

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

freqtrade/data/metrics.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,10 @@ def combined_dataframes_with_rel_mean(
7474
df_comb = combine_dataframes_by_column(data, column)
7575
# Trim dataframes to the given timeframe
7676
df_comb = df_comb.iloc[(df_comb.index >= fromdt) & (df_comb.index < todt)]
77+
rel_mean = df_comb.pct_change().mean(axis=1).fillna(0).cumsum()
7778
df_comb["count"] = df_comb.count(axis=1)
7879
df_comb["mean"] = df_comb.mean(axis=1)
79-
df_comb["rel_mean"] = df_comb["mean"].pct_change().fillna(0).cumsum()
80+
df_comb["rel_mean"] = rel_mean
8081
return df_comb[["mean", "rel_mean", "count"]]
8182

8283

0 commit comments

Comments
 (0)