From 7b223f3d380d8cce3f02222015a670dc13615195 Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 6 Jan 2026 16:07:44 +0100 Subject: [PATCH] feat: improve balance_history response --- freqtrade/rpc/rpc.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/freqtrade/rpc/rpc.py b/freqtrade/rpc/rpc.py index f9939c604..77faa2e62 100644 --- a/freqtrade/rpc/rpc.py +++ b/freqtrade/rpc/rpc.py @@ -791,13 +791,15 @@ class RPC: :return: DataFrame with the balance history and the timestamp of the migration """ results = read_sql("wallet_history", con=Trade.session.bind, parse_dates=["timestamp"]) - results.loc[:, "total"] = results["price"] * results["balance"] + results.loc[:, "total"] = results["price"] * results["balance"] / results["leverage"] results = results.rename({"timestamp": "date"}, axis=1) results.loc[:, "__date_ts"] = results.loc[:, "date"].astype("int64") // 1000 // 1000 + # Exclude non-bot managed for now + results = results.loc[results["bot_managed"]] - results = results.groupby(["date", "__date_ts"]).agg({"total": "sum"}).reset_index() + results_final = results.groupby(["date", "__date_ts"]).agg({"total": "sum"}).reset_index() hist = KeyValueStore.get_datetime_value("wallet_history_migration_date") - return results, dt_ts_def(hist, 0) + return results_final, dt_ts_def(hist, 0) def __balance_get_est_stake( self, coin: str, stake_currency: str, amount: float, balance: Wallet