Skip to content

Commit 2ae194a

Browse files
committed
Add current win and current win/loss ration
1 parent 10be086 commit 2ae194a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

investing_algorithm_framework/domain/backtesting/backtest_metrics.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,12 @@ class BacktestMetrics:
104104
still open at the end of the backtest.
105105
win_rate (float): The win rate of the trades, expressed
106106
as a percentage.
107+
current_win_rate (float): The current win rate of the trades,
108+
including open trades.
107109
win_loss_ratio (float): The ratio of winning trades
108110
to losing trades.
111+
current_win_loss_ratio (float): The current ratio of winning
112+
trades to losing trades, including open trades.
109113
percentage_winning_months (float): The percentage of months
110114
with positive returns.
111115
percentage_winning_years (float): The percentage of years with
@@ -193,7 +197,9 @@ class BacktestMetrics:
193197
number_of_trades_opened: int = 0
194198
number_of_trades_open_at_end: int = 0
195199
win_rate: float = 0.0
200+
current_win_rate: float = 0.0
196201
win_loss_ratio: float = 0.0
202+
current_win_loss_ratio: float = 0.0
197203
percentage_winning_months: float = 0.0
198204
percentage_winning_years: float = 0.0
199205
average_monthly_return: float = 0.0
@@ -289,7 +295,9 @@ def ensure_iso(value):
289295
"number_of_trades_closed": self.number_of_trades_closed,
290296
"number_of_trades_opened": self.number_of_trades_opened,
291297
"win_rate": self.win_rate,
298+
"current_win_rate": self.current_win_rate,
292299
"win_loss_ratio": self.win_loss_ratio,
300+
"current_win_loss_ratio": self.current_win_loss_ratio,
293301
"percentage_winning_months": self.percentage_winning_months,
294302
"percentage_winning_years": self.percentage_winning_years,
295303
"average_monthly_return": self.average_monthly_return,

0 commit comments

Comments
 (0)