mirror of
https://github.com/Xe138/AI-Trader.git
synced 2026-04-01 17:17:24 -04:00
fix: correct BaseAgent initialization parameters in ModelDayExecutor
Fixed incorrect parameter passing to BaseAgent.__init__(): - Changed model_name to basemodel (correct parameter name) - Removed invalid config parameter - Properly mapped all configuration values to BaseAgent parameters This resolves simulation job failures with error: "BaseAgent.__init__() got an unexpected keyword argument 'model_name'" Fixes initialization of trading agents in API simulation jobs.
This commit is contained in:
@@ -191,11 +191,24 @@ class ModelDayExecutor:
|
|||||||
if not model_config:
|
if not model_config:
|
||||||
raise ValueError(f"Model {self.model_sig} not found in config")
|
raise ValueError(f"Model {self.model_sig} not found in config")
|
||||||
|
|
||||||
# Initialize agent
|
# Get agent config
|
||||||
|
agent_config = config.get("agent_config", {})
|
||||||
|
log_config = config.get("log_config", {})
|
||||||
|
|
||||||
|
# Initialize agent with properly mapped parameters
|
||||||
agent = BaseAgent(
|
agent = BaseAgent(
|
||||||
model_name=model_config.get("basemodel"),
|
|
||||||
signature=self.model_sig,
|
signature=self.model_sig,
|
||||||
config=config
|
basemodel=model_config.get("basemodel"),
|
||||||
|
stock_symbols=agent_config.get("stock_symbols"),
|
||||||
|
mcp_config=agent_config.get("mcp_config"),
|
||||||
|
log_path=log_config.get("log_path"),
|
||||||
|
max_steps=agent_config.get("max_steps", 10),
|
||||||
|
max_retries=agent_config.get("max_retries", 3),
|
||||||
|
base_delay=agent_config.get("base_delay", 0.5),
|
||||||
|
openai_base_url=model_config.get("openai_base_url"),
|
||||||
|
openai_api_key=model_config.get("openai_api_key"),
|
||||||
|
initial_cash=agent_config.get("initial_cash", 10000.0),
|
||||||
|
init_date=config.get("date_range", {}).get("init_date", "2025-10-13")
|
||||||
)
|
)
|
||||||
|
|
||||||
# Register agent (creates initial position if needed)
|
# Register agent (creates initial position if needed)
|
||||||
|
|||||||
Reference in New Issue
Block a user