Remove unusued code for tracking total wins, win rate, and average premium received
This commit is contained in:
parent
21934e9e15
commit
bb8ab9f556
@ -278,10 +278,6 @@ def backtest_iron_condor(
|
|||||||
filters: List[BacktestFilter] = []
|
filters: List[BacktestFilter] = []
|
||||||
) -> pd.DataFrame:
|
) -> pd.DataFrame:
|
||||||
|
|
||||||
total_premium_received = 0.0
|
|
||||||
total_trades = 0.0
|
|
||||||
total_wins = 0.0
|
|
||||||
|
|
||||||
start_year = start_date.year
|
start_year = start_date.year
|
||||||
end_year = end_date.year
|
end_year = end_date.year
|
||||||
|
|
||||||
@ -313,6 +309,7 @@ def backtest_iron_condor(
|
|||||||
futures.append(future)
|
futures.append(future)
|
||||||
|
|
||||||
backtest_results = []
|
backtest_results = []
|
||||||
|
total_premium_received = 0.0
|
||||||
for future in futures:
|
for future in futures:
|
||||||
backtest_result = future.result()
|
backtest_result = future.result()
|
||||||
if backtest_result:
|
if backtest_result:
|
||||||
@ -320,15 +317,6 @@ def backtest_iron_condor(
|
|||||||
backtest_result.profit = total_premium_received
|
backtest_result.profit = total_premium_received
|
||||||
backtest_results.append(backtest_result)
|
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.
|
# TODO: Either look up the symbol in the historical option data or have the client provide it.
|
||||||
backtest_results = pd.DataFrame([{
|
backtest_results = pd.DataFrame([{
|
||||||
'Date': result.date,
|
'Date': result.date,
|
||||||
|
Loading…
Reference in New Issue
Block a user