fixes
This commit is contained in:
+8
-9
@@ -6,7 +6,6 @@ from typing import Any, Dict, List
|
||||
|
||||
import pandas as pd
|
||||
|
||||
from strategies import SlidingFitStrategy, StaticFitStrategy
|
||||
from tools.data_loader import load_market_data
|
||||
from tools.trading_pair import TradingPair
|
||||
from results import BacktestResult
|
||||
@@ -68,21 +67,21 @@ def main() -> None:
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
CONFIG = load_config(args.config)
|
||||
config: Dict = load_config(args.config)
|
||||
|
||||
# Dynamically instantiate strategy class
|
||||
strategy_class_name = CONFIG.get("strategy_class", "strategies.StaticFitStrategy")
|
||||
strategy_class_name = config.get("strategy_class", "strategies.StaticFitStrategy")
|
||||
module_name, class_name = strategy_class_name.rsplit(".", 1)
|
||||
module = importlib.import_module(module_name)
|
||||
STRATEGY = getattr(module, class_name)()
|
||||
strategy = getattr(module, class_name)()
|
||||
|
||||
# Initialize a dictionary to store all trade results
|
||||
all_results: Dict[str, Dict[str, Any]] = {}
|
||||
bt_results = BacktestResult(config=CONFIG)
|
||||
bt_results = BacktestResult(config=config)
|
||||
|
||||
# Process each data file
|
||||
price_column = CONFIG["price_column"]
|
||||
for datafile in CONFIG["datafiles"]:
|
||||
price_column = config["price_column"]
|
||||
for datafile in config["datafiles"]:
|
||||
print(f"\n====== Processing {datafile} ======")
|
||||
|
||||
# Clear the TRADES global dictionary and reset unrealized PnL for the new file
|
||||
@@ -91,11 +90,11 @@ def main() -> None:
|
||||
# Process data for this file
|
||||
try:
|
||||
run_all_pairs(
|
||||
config=CONFIG,
|
||||
config=config,
|
||||
datafile=datafile,
|
||||
price_column=price_column,
|
||||
bt_result=bt_results,
|
||||
strategy=STRATEGY,
|
||||
strategy=strategy,
|
||||
)
|
||||
|
||||
# Store results with file name as key
|
||||
|
||||
Reference in New Issue
Block a user