chore: use "filled" over amount for balance distribution
This commit is contained in:
@@ -91,7 +91,7 @@ def balance_distribution_over_time(
|
|||||||
orders = [o for o in trade.orders if o["order_filled_timestamp"]]
|
orders = [o for o in trade.orders if o["order_filled_timestamp"]]
|
||||||
for order in sorted(orders, key=lambda x: x["order_filled_timestamp"]):
|
for order in sorted(orders, key=lambda x: x["order_filled_timestamp"]):
|
||||||
filled_at = pd.Timestamp(dt_from_ts(order["order_filled_timestamp"]))
|
filled_at = pd.Timestamp(dt_from_ts(order["order_filled_timestamp"]))
|
||||||
real_amount = order["amount"] / trade.leverage
|
real_amount = order.get("filled", order["amount"]) / trade.leverage
|
||||||
stake = order["safe_price"] * real_amount
|
stake = order["safe_price"] * real_amount
|
||||||
if order["ft_is_entry"]:
|
if order["ft_is_entry"]:
|
||||||
fee = stake * trade.fee_open
|
fee = stake * trade.fee_open
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ def migrate_wallet_history(config: Config, exchange: Exchange, starting_balance:
|
|||||||
|
|
||||||
|
|
||||||
def _migrate_wallet_history(config: Config, exchange: Exchange, starting_balance: float):
|
def _migrate_wallet_history(config: Config, exchange: Exchange, starting_balance: float):
|
||||||
trade_df = trade_list_to_dataframe(Trade.get_trades_proxy())
|
trade_df = trade_list_to_dataframe(Trade.get_trades_proxy(), minified=False)
|
||||||
if trade_df.empty:
|
if trade_df.empty:
|
||||||
# no trades, nothing to do
|
# no trades, nothing to do
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user