Skip to content

Commit 60309b9

Browse files
committed
chore: move num_entries/exits to trade model
1 parent a05d142 commit 60309b9

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

freqtrade/persistence/trade_model.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,8 @@ def to_json(self, minified: bool = False) -> dict[str, Any]:
755755
"precision_mode": self.precision_mode,
756756
"precision_mode_price": self.precision_mode_price,
757757
"contract_size": self.contract_size,
758+
"nr_of_successful_entries": self.nr_of_successful_entries,
759+
"nr_of_successful_exits": self.nr_of_successful_exits,
758760
"has_open_orders": self.has_open_orders,
759761
"orders": orders_json,
760762
}

freqtrade/rpc/telegram.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -757,14 +757,7 @@ async def _status_msg(self, update: Update, context: CallbackContext) -> None:
757757
max_entries = self._config.get("max_entry_position_adjustment", -1)
758758
for r in results:
759759
r["open_date_hum"] = dt_humanize_delta(r["open_date"])
760-
r["num_entries"] = len([o for o in r["orders"] if o["ft_is_entry"]])
761-
r["num_exits"] = len(
762-
[
763-
o
764-
for o in r["orders"]
765-
if not o["ft_is_entry"] and not o["ft_order_side"] == "stoploss"
766-
]
767-
)
760+
768761
r["stake_amount_r"] = fmt_coin(r["stake_amount"], r["quote_currency"])
769762
r["max_stake_amount_r"] = fmt_coin(
770763
r["max_stake_amount"] or r["stake_amount"], r["quote_currency"]
@@ -790,8 +783,8 @@ async def _status_msg(self, update: Update, context: CallbackContext) -> None:
790783
max_buy_str = f"/{max_entries + 1}" if (max_entries > 0) else ""
791784
lines.extend(
792785
[
793-
f"*Number of Entries:* `{r['num_entries']}{max_buy_str}`",
794-
f"*Number of Exits:* `{r['num_exits']}`",
786+
f"*Number of Entries:* `{r['nr_of_successful_entries']}{max_buy_str}`",
787+
f"*Number of Exits:* `{r['nr_of_successful_exits']}`",
795788
]
796789
)
797790

0 commit comments

Comments
 (0)