TradingAgents/backend/tradingagents/default_config.py

36 lines
1.3 KiB
Python

import os
from dotenv import load_dotenv
# Get the backend directory (parent of tradingagents package)
BACKEND_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))
# Load environment variables from project root
load_dotenv(os.path.join(PROJECT_ROOT, ".env"))
DEFAULT_CONFIG = {
"project_dir": os.path.abspath(os.path.join(os.path.dirname(__file__), ".")),
"results_dir": os.getenv("TRADINGAGENTS_RESULTS_DIR", os.path.join(BACKEND_DIR, "results")),
"data_dir": os.getenv("TRADINGAGENTS_DATA_DIR", os.path.join(BACKEND_DIR, "data")),
"data_cache_dir": os.path.join(
os.path.abspath(os.path.join(os.path.dirname(__file__), ".")),
"dataflows/data_cache",
),
# API Server settings
"api_host": os.getenv("TRADINGAGENTS_API_HOST", "localhost"),
"api_port": int(os.getenv("TRADINGAGENTS_API_PORT", "8000")),
# LLM settings
"llm_provider": "openai",
"deep_think_llm": "o4-mini",
"quick_think_llm": "gpt-4o-mini",
"backend_url": "https://api.openai.com/v1",
# Debate and discussion settings
"max_debate_rounds": 1,
"max_risk_discuss_rounds": 1,
"max_recur_limit": 100,
# Tool settings
"online_tools": True,
# SerpAPI settings
"serpapi_key": os.getenv("SERPAPI_API_KEY", ""),
}