Files
tradingagents/main.py
Yijia-Xiao db7e0a67e2 fix(cli): load .env from user's CWD when run as console script
load_dotenv() with no arguments walks up from site-packages instead
of the user's CWD, so the installed tradingagents console script
silently misses the project's .env. Pass find_dotenv(usecwd=True)
so the search starts from CWD; same treatment for .env.enterprise.

#726 #755 #612 #747 #743 #753 #729 #728 #751
2026-05-10 09:49:07 +00:00

31 lines
1.1 KiB
Python

from tradingagents.graph.trading_graph import TradingAgentsGraph
from tradingagents.default_config import DEFAULT_CONFIG
from dotenv import find_dotenv, load_dotenv
load_dotenv(find_dotenv(usecwd=True))
# Create a custom config
config = DEFAULT_CONFIG.copy()
config["deep_think_llm"] = "gpt-5.4-mini" # Use a different model
config["quick_think_llm"] = "gpt-5.4-mini" # Use a different model
config["max_debate_rounds"] = 1 # Increase debate rounds
# Configure data vendors (default uses yfinance, no extra API keys needed)
config["data_vendors"] = {
"core_stock_apis": "yfinance", # Options: alpha_vantage, yfinance
"technical_indicators": "yfinance", # Options: alpha_vantage, yfinance
"fundamental_data": "yfinance", # Options: alpha_vantage, yfinance
"news_data": "yfinance", # Options: alpha_vantage, yfinance
}
# Initialize with custom config
ta = TradingAgentsGraph(debug=True, config=config)
# forward propagate
_, decision = ta.propagate("NVDA", "2024-05-10")
print(decision)
# Memorize mistakes and reflect
# ta.reflect_and_remember(1000) # parameter is the position returns