feat: improve balance_history response
This commit is contained in:
@@ -791,13 +791,15 @@ class RPC:
|
|||||||
:return: DataFrame with the balance history and the timestamp of the migration
|
: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 = 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 = results.rename({"timestamp": "date"}, axis=1)
|
||||||
results.loc[:, "__date_ts"] = results.loc[:, "date"].astype("int64") // 1000 // 1000
|
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")
|
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(
|
def __balance_get_est_stake(
|
||||||
self, coin: str, stake_currency: str, amount: float, balance: Wallet
|
self, coin: str, stake_currency: str, amount: float, balance: Wallet
|
||||||
|
|||||||
Reference in New Issue
Block a user