chore: move num_entries/exits to trade model

This commit is contained in:
Matthias
2025-11-22 13:40:57 +01:00
parent a05d142af6
commit 60309b9e57
2 changed files with 5 additions and 10 deletions

View File

@@ -755,6 +755,8 @@ class LocalTrade:
"precision_mode": self.precision_mode,
"precision_mode_price": self.precision_mode_price,
"contract_size": self.contract_size,
"nr_of_successful_entries": self.nr_of_successful_entries,
"nr_of_successful_exits": self.nr_of_successful_exits,
"has_open_orders": self.has_open_orders,
"orders": orders_json,
}

View File

@@ -757,14 +757,7 @@ class Telegram(RPCHandler):
max_entries = self._config.get("max_entry_position_adjustment", -1)
for r in results:
r["open_date_hum"] = dt_humanize_delta(r["open_date"])
r["num_entries"] = len([o for o in r["orders"] if o["ft_is_entry"]])
r["num_exits"] = len(
[
o
for o in r["orders"]
if not o["ft_is_entry"] and not o["ft_order_side"] == "stoploss"
]
)
r["stake_amount_r"] = fmt_coin(r["stake_amount"], r["quote_currency"])
r["max_stake_amount_r"] = fmt_coin(
r["max_stake_amount"] or r["stake_amount"], r["quote_currency"]
@@ -790,8 +783,8 @@ class Telegram(RPCHandler):
max_buy_str = f"/{max_entries + 1}" if (max_entries > 0) else ""
lines.extend(
[
f"*Number of Entries:* `{r['num_entries']}{max_buy_str}`",
f"*Number of Exits:* `{r['num_exits']}`",
f"*Number of Entries:* `{r['nr_of_successful_entries']}{max_buy_str}`",
f"*Number of Exits:* `{r['nr_of_successful_exits']}`",
]
)