From 31c60d10e35e1bb32412cfbb49be45987d127032 Mon Sep 17 00:00:00 2001 From: moshferatu Date: Tue, 6 Feb 2024 05:33:17 -0800 Subject: [PATCH] Move backtest result dataclass to its own file --- backtesting/__init__.py | 1 + backtesting/backtest_iron_condor.py | 15 +-------------- backtesting/backtest_result.py | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 14 deletions(-) create mode 100644 backtesting/backtest_result.py diff --git a/backtesting/__init__.py b/backtesting/__init__.py index a27f14a..ad75b4f 100644 --- a/backtesting/__init__.py +++ b/backtesting/__init__.py @@ -1,5 +1,6 @@ from .available_entry_times import available_entry_times from .backtest_iron_condor import backtest_iron_condor +from .backtest_result import BacktestResult from .best_entry_times import best_entry_times from .credit_targeting import CreditTargetStrategy from .delta_targeting import DeltaTargetStrategy diff --git a/backtesting/backtest_iron_condor.py b/backtesting/backtest_iron_condor.py index 33e8c41..9dd9812 100644 --- a/backtesting/backtest_iron_condor.py +++ b/backtesting/backtest_iron_condor.py @@ -3,10 +3,10 @@ import os import pandas as pd from concurrent.futures import ProcessPoolExecutor -from dataclasses import dataclass from datetime import datetime from dotenv import load_dotenv +from .backtest_result import BacktestResult from .credit_targeting import CreditTargetStrategy from .delta_targeting import DeltaTargetStrategy from .option_spread_strategy import OptionSpreadStrategy @@ -22,19 +22,6 @@ MARKET_OPEN = '09:35:00' OPTION_DATA_DIRECTORY = os.getenv('OPTION_DATA_DIRECTORY') STRIKE_MULTIPLE = 5.0 -@dataclass -class BacktestResult: - date: str - entry_time: str - exit_time: str - spreads: list - trade_entered: bool - trade_pnl: float - profit: float - credit: float - mfe: float - mae: float - # Metrics dates = [] max_drawdowns = [] diff --git a/backtesting/backtest_result.py b/backtesting/backtest_result.py new file mode 100644 index 0000000..ff1807d --- /dev/null +++ b/backtesting/backtest_result.py @@ -0,0 +1,14 @@ +from dataclasses import dataclass + +@dataclass +class BacktestResult: + date: str + entry_time: str + exit_time: str + spreads: list + trade_entered: bool + trade_pnl: float + profit: float + credit: float + mfe: float + mae: float \ No newline at end of file