From 4687ba9b6a927fbbfa33c44efe97ac5ebc10429f Mon Sep 17 00:00:00 2001 From: drupman Date: Tue, 19 Sep 2023 17:16:29 -0300 Subject: [PATCH] (fix) correct profit factor --- utils/data_manipulation.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/data_manipulation.py b/utils/data_manipulation.py index 16968a1..7d9021b 100644 --- a/utils/data_manipulation.py +++ b/utils/data_manipulation.py @@ -249,9 +249,9 @@ class SingleMarketStrategyData: @property def profit_factor(self): - total_profit = (self.trade_fill["net_realized_pnl"] >= 0).sum() - total_loss = (self.trade_fill["net_realized_pnl"] < 0).sum() - return total_profit / total_loss + total_profit = self.trade_fill.loc[self.trade_fill["realized_pnl"] >= 0, "realized_pnl"].sum() + total_loss = self.trade_fill.loc[self.trade_fill["realized_pnl"] < 0, "realized_pnl"].sum() + return total_profit / -total_loss @property def properties_table(self):