Skip to content

Commit 3d1e700

Browse files
committed
add CLAUDE.md, trading_agents folder (contains logic to orchestrate a team of trading agents), and .claude folder
1 parent 6bd9c4a commit 3d1e700

7 files changed

Lines changed: 2457 additions & 0 deletions

File tree

trading_agents/README.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Trading_agents
2+
3+
The architecture of `trading_agents.py` follows `TradingAgents.md`.
4+
5+
### Phase Hierarchy
6+
7+
| Phase | Designation | Agents | Model | Notes |
8+
| :--- | :--- | :--- | :--- | :--- |
9+
| **Phase I** | **Eyes** | Fundamental, Technical, Sentiment, Macro | `claude-haiku-4-5` | Fast, structured data-to-text |
10+
| **Phase II** | **Brain** | Bull, Bear, (Facilitator loop) | `claude-opus-4-6` + Adaptive Thinking | Dialectical debate, N rounds |
11+
| **Phase III** | **Hands** | Trader, Risk ×3, Fund Manager | `claude-opus-4-6` + Adaptive Thinking | Weighted vote, self-reflection |
12+
13+
---
14+
15+
### Key Design Decisions
16+
17+
* **Global State Management**: State is maintained as a Python `dataclass`, JSON-serialized as context for each agent to prevent hallucination drift.
18+
* **Reasoning Framework**: ReAct is embedded in every system prompt ("reason before concluding").
19+
* **Stress Testing**: Facilitator's mandatory question (*"What makes this bullish signal a trap?"*) is hardcoded into the Bear prompt for each round.
20+
* **Execution Safety**:
21+
* Fund Manager self-reflection is mandatory in the system prompt.
22+
* A `no_trade_reason` field surfaces automatically when self-reflection triggers a halt.
23+
* Confidence threshold set at **0.35**; any value below this defaults to "No Trade" regardless of suggested action.
24+
* **Model Optimization**: `Haiku 4.5` for Phase I (high speed/no thinking); `Opus 4.6` + Adaptive Thinking for high-stakes reasoning in Phases II/III.
25+
26+
---
27+
28+
### Usage
29+
30+
**Environment Setup:**
31+
```bash
32+
export ANTHROPIC_API_KEY=sk-...
33+
pip install anthropic yfinance pandas
34+
```
35+
36+
**Dry Run (Default):**
37+
```bash
38+
python trading_agents.py BTC --exchange hyperliquid --portfolio 1000
39+
```
40+
41+
**Full Pipeline & Trade Submission:**
42+
```bash
43+
python trading_agents.py ETH --exchange binance --market perp --portfolio 5000 --rounds 3 --execute
44+
```
45+
46+
**Save State:**
47+
```bash
48+
python trading_agents.py HYPE --exchange hyperliquid --output state.json
49+
```
50+
51+
---
52+
53+
### Run Simulation
54+
55+
`cd trading_agents`
56+
57+
#### Single scenario
58+
```bash
59+
python simulate.py btc # BTC/Hyperliquid spot → BUY
60+
61+
python simulate.py eth # ETH/Binance perp → HOLD
62+
63+
python simulate.py hype # HYPE/Hyperliquid spot → SELL
64+
```
65+
66+
#### All three in sequence
67+
```bash
68+
python simulate.py all
69+
```
70+
71+
#### Skip streaming delays (instant output)
72+
```bash
73+
python simulate.py btc --fast
74+
75+
python simulate.py all --fast
76+
```
77+
78+
No API keys or network access required — everything runs on mock data.
47.3 KB
Binary file not shown.
38.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)