fix: calculate meaningful price change properly weighting each pair

closes #12588
This commit is contained in:
Matthias
2025-12-04 21:23:53 +01:00
parent e792bafe21
commit 68e54248fd

View File

@@ -74,9 +74,10 @@ def combined_dataframes_with_rel_mean(
df_comb = combine_dataframes_by_column(data, column)
# Trim dataframes to the given timeframe
df_comb = df_comb.iloc[(df_comb.index >= fromdt) & (df_comb.index < todt)]
rel_mean = df_comb.pct_change().mean(axis=1).fillna(0).cumsum()
df_comb["count"] = df_comb.count(axis=1)
df_comb["mean"] = df_comb.mean(axis=1)
df_comb["rel_mean"] = df_comb["mean"].pct_change().fillna(0).cumsum()
df_comb["rel_mean"] = rel_mean
return df_comb[["mean", "rel_mean", "count"]]