Move backtest result dataclass to its own file

This commit is contained in:
moshferatu 2024-02-06 05:33:17 -08:00
parent 2c4fd834bb
commit 31c60d10e3
3 changed files with 16 additions and 14 deletions

View File

@ -1,5 +1,6 @@
from .available_entry_times import available_entry_times from .available_entry_times import available_entry_times
from .backtest_iron_condor import backtest_iron_condor from .backtest_iron_condor import backtest_iron_condor
from .backtest_result import BacktestResult
from .best_entry_times import best_entry_times from .best_entry_times import best_entry_times
from .credit_targeting import CreditTargetStrategy from .credit_targeting import CreditTargetStrategy
from .delta_targeting import DeltaTargetStrategy from .delta_targeting import DeltaTargetStrategy

View File

@ -3,10 +3,10 @@ import os
import pandas as pd import pandas as pd
from concurrent.futures import ProcessPoolExecutor from concurrent.futures import ProcessPoolExecutor
from dataclasses import dataclass
from datetime import datetime from datetime import datetime
from dotenv import load_dotenv from dotenv import load_dotenv
from .backtest_result import BacktestResult
from .credit_targeting import CreditTargetStrategy from .credit_targeting import CreditTargetStrategy
from .delta_targeting import DeltaTargetStrategy from .delta_targeting import DeltaTargetStrategy
from .option_spread_strategy import OptionSpreadStrategy from .option_spread_strategy import OptionSpreadStrategy
@ -22,19 +22,6 @@ MARKET_OPEN = '09:35:00'
OPTION_DATA_DIRECTORY = os.getenv('OPTION_DATA_DIRECTORY') OPTION_DATA_DIRECTORY = os.getenv('OPTION_DATA_DIRECTORY')
STRIKE_MULTIPLE = 5.0 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 # Metrics
dates = [] dates = []
max_drawdowns = [] max_drawdowns = []

View File

@ -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