Remove unusued code for tracking total wins, win rate, and average premium received

This commit is contained in:
moshferatu 2024-02-07 05:58:18 -08:00
parent 21934e9e15
commit bb8ab9f556

View File

@ -278,10 +278,6 @@ def backtest_iron_condor(
filters: List[BacktestFilter] = []
) -> pd.DataFrame:
total_premium_received = 0.0
total_trades = 0.0
total_wins = 0.0
start_year = start_date.year
end_year = end_date.year
@ -313,6 +309,7 @@ def backtest_iron_condor(
futures.append(future)
backtest_results = []
total_premium_received = 0.0
for future in futures:
backtest_result = future.result()
if backtest_result:
@ -320,15 +317,6 @@ def backtest_iron_condor(
backtest_result.profit = total_premium_received
backtest_results.append(backtest_result)
if backtest_result.trade_entered:
total_trades += 1
if backtest_result.trade_pnl > 0.0:
total_wins += 1
logging.info('Overall PnL: %f', total_premium_received)
logging.info('Win Rate: %f', (total_wins / total_trades) if total_trades > 0 else 0.0)
logging.info('Average Premium Received: %f', (total_premium_received / total_trades) if total_trades > 0 else 0.0)
# TODO: Either look up the symbol in the historical option data or have the client provide it.
backtest_results = pd.DataFrame([{
'Date': result.date,