-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
38 lines (31 loc) · 1.41 KB
/
Copy pathmain.py
File metadata and controls
38 lines (31 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import os
import time
import datetime
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-mini" # Use a different model
config["quick_think_llm"] = "gpt-5-mini" # Use a different model
config["max_debate_rounds"] = 1 # Increase debate rounds
config["llm_provider"] = "deepseek" # Switch to DeepSeek provider
config["backend_url"] = "https://api.deepseek.com/v1"
config["deep_think_llm"] = "deepseek-reasoner"
config["quick_think_llm"] = "deepseek-chat"
config["enable_on_chain_submission"] = True
config["on_chain_submit_hold_decisions"] = True # True: HOLD 也提交到 RiskRouter
config["use_trader_v2"] = True # True: 仅 BUY/SELL; False: BUY/SELL/HOLD
start_time = time.time()
# Initialize with custom config
ta = TradingAgentsGraph(debug=True, selected_analysts=['market', 'news', 'quant'], config=config, parallel_mode=True)
# XBTUSD ETHUSD SOLUSD BNBUSD
final_state, decision = ta.propagate("ETHUSD", datetime.datetime.now(datetime.timezone.utc))
end_time = time.time()
print(decision)
print('\n',"=" * 50,'\n')
print(f"Execution time: {end_time - start_time:.2f} seconds")
# Memorize mistakes and reflect
# ta.reflect_and_remember(1000) # parameter is the position returns