progress
This commit is contained in:
+24
-1
@@ -12,7 +12,7 @@ import pandas as pd
|
||||
|
||||
from tools.data_loader import load_market_data
|
||||
from tools.trading_pair import TradingPair
|
||||
from results import BacktestResult, create_result_database, store_results_in_database
|
||||
from results import BacktestResult, create_result_database, store_results_in_database, store_config_in_database
|
||||
|
||||
|
||||
def load_config(config_path: str) -> Dict:
|
||||
@@ -202,6 +202,29 @@ def main() -> None:
|
||||
# Initialize a dictionary to store all trade results
|
||||
all_results: Dict[str, Dict[str, Any]] = {}
|
||||
bt_results = BacktestResult(config=config)
|
||||
|
||||
# Store configuration in database for reference
|
||||
if args.result_db.upper() != "NONE":
|
||||
# Get list of all instruments for storage
|
||||
all_instruments = []
|
||||
for datafile in datafiles:
|
||||
if args.instruments:
|
||||
file_instruments = [inst.strip() for inst in args.instruments.split(",")]
|
||||
else:
|
||||
file_instruments = get_available_instruments_from_db(datafile, config)
|
||||
all_instruments.extend(file_instruments)
|
||||
|
||||
# Remove duplicates while preserving order
|
||||
unique_instruments = list(dict.fromkeys(all_instruments))
|
||||
|
||||
store_config_in_database(
|
||||
db_path=args.result_db,
|
||||
config_file_path=args.config,
|
||||
config=config,
|
||||
strategy_class=strategy_class_name,
|
||||
datafiles=datafiles,
|
||||
instruments=unique_instruments
|
||||
)
|
||||
|
||||
# Process each data file
|
||||
price_column = config["price_column"]
|
||||
|
||||
Reference in New Issue
Block a user