mirror of
https://github.com/simonlin1212/TradingAgents-astock.git
synced 2026-08-31 01:23:38 +00:00
- 适配A股数据源(mootdx+腾讯财经+akshare),全免费无积分墙 - 新增3个A股特化分析师(政策/游资/解禁),共7位AI分析师 - A股交易规则约束(T+1/涨跌停/最小手数/ST标识) - 内置Streamlit Web UI + PDF报告导出 - 支持MiniMax/DeepSeek/智谱/通义/OpenAI/Anthropic等多家LLM - 沪深300基准替代SPY
32 lines
1.1 KiB
Python
32 lines
1.1 KiB
Python
from tradingagents.graph.trading_graph import TradingAgentsGraph
|
|
from tradingagents.default_config import DEFAULT_CONFIG
|
|
|
|
from dotenv import load_dotenv
|
|
|
|
# Load environment variables from .env file
|
|
load_dotenv()
|
|
|
|
# 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
|