Commit b0bc0b4
authored
feat(src): support crypto market (#217)
🪙 BitMEX Crypto Trading System
New Features
Trading System
- New market type: Perpetual contract trading for 15+ cryptocurrencies
- Synchronized trading: Daily at 3 PM ET (Mon-Fri), aligned with stock
market schedule
- Paper trading: $1,000 initial capital per agent
Crypto-specific metrics:
- Funding rates (8-hour carry costs)
- `live_trade_bench/systems/bitmex_system.py:152-153` - Funding rate
fetching
- `live_trade_bench/agents/bitmex_agent.py:55-58` - Funding rate in LLM
prompts
- Order book depth (liquidity analysis)
- `live_trade_bench/systems/bitmex_system.py:157-165` - Bid/ask depth
calculation
- `live_trade_bench/fetchers/bitmex_fetcher.py` - Order book API
integration
- Open interest tracking
- `live_trade_bench/systems/bitmex_system.py:181` - Open interest data
- `live_trade_bench/agents/bitmex_agent.py:55-58` - Open interest
display
- Mark price with 10-day history
- `live_trade_bench/fetchers/bitmex_fetcher.py:199` - Price history
fetching
- `live_trade_bench/systems/bitmex_system.py:145-150` - Historical price
integration
🔧 Backend Infrastructure
Trading Cycles:
- BitMEX system integrated into production scheduler -
`backend/app/main.py:265-275`
- Synchronized with stock/polymarket at 3 PM ET (Mon-Fri) -
`backend/app/main.py:269`
- 10-minute price updates during market hours only -
`backend/app/main.py:305-311,`
backend/app/price_data.py:534-540
Data Pipelines:
- News fetching for crypto (Google News) -
`live_trade_bench/fetchers/news_fetcher.py:167`,
` live_trade_bench/systems/bitmex_system.py:229-252`
- Social media monitoring (Reddit) -
`live_trade_bench/fetchers/reddit_fetcher.py`,
` live_trade_bench/systems/bitmex_system.py:265-328`
- Price updates with BitMEX API - `backend/app/price_data.py:524-559,`
` live_trade_bench/fetchers/bitmex_fetcher.py`
- Market hours enforcement - `backend/app/price_data.py:534-540`
API Endpoints:
- /api/news/{market_type} - BitMEX supported -
`backend/app/routers/news.py:13`
- /api/social/{market_type} - BitMEX supported -
`backend/app/routers/social.py:13`
- BitMEX data integrated into models and system endpoints
🎨 Frontend Integration
UI Components:
- BitMEX tabs added to News and SocialMedia pages
- Crypto-specific color theming in allocation charts
- BitMEX dashboard support (routing ready)
🧪 Backtesting Enhancements
Updated `examples/backtest_demo.py`:
- BitMEX support added alongside stock/polymarket
- Parallel backtesting for all three markets
- Crypto benchmark models (BTC-HOLD, ETH-HOLD)
- All 21 models tested (removed flagship-only filter)
🔧 System Reliability
- Synchronized schedules: All trading systems update together at 3 PM ET
<img width="2021" height="1052" alt="Screenshot 2025-11-08 at 14 29 23"
src="https://github.com/user-attachments/assets/3120ecef-f4cc-435b-a1ea-dd6d9ef106f9"
/>
<img width="2022" height="1053" alt="Screenshot 2025-11-08 at 14 30 06"
src="https://github.com/user-attachments/assets/5c189c4a-96d8-466c-a948-29c4d944d172"
/>1 parent 59ac754 commit b0bc0b4
File tree
41 files changed
+3489
-324
lines changed- backend
- app
- routers
- examples
- frontend/src
- components
- utils
- live_trade_bench
- accounts
- agents
- fetchers
- systems
- tests
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
41 files changed
+3489
-324
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| |||
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
| 67 | + | |
66 | 68 | | |
67 | 69 | | |
68 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
| |||
19 | 22 | | |
20 | 23 | | |
21 | 24 | | |
22 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
23 | 30 | | |
24 | 31 | | |
25 | 32 | | |
| |||
37 | 44 | | |
38 | 45 | | |
39 | 46 | | |
| 47 | + | |
40 | 48 | | |
41 | 49 | | |
42 | 50 | | |
43 | 51 | | |
44 | 52 | | |
45 | 53 | | |
46 | 54 | | |
| 55 | + | |
| 56 | + | |
47 | 57 | | |
48 | 58 | | |
49 | 59 | | |
| 60 | + | |
50 | 61 | | |
51 | 62 | | |
52 | 63 | | |
| |||
68 | 79 | | |
69 | 80 | | |
70 | 81 | | |
| 82 | + | |
71 | 83 | | |
72 | 84 | | |
73 | 85 | | |
| |||
78 | 90 | | |
79 | 91 | | |
80 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
81 | 97 | | |
82 | 98 | | |
83 | | - | |
| 99 | + | |
84 | 100 | | |
85 | 101 | | |
86 | 102 | | |
87 | 103 | | |
| 104 | + | |
88 | 105 | | |
89 | 106 | | |
90 | 107 | | |
| |||
99 | 116 | | |
100 | 117 | | |
101 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
102 | 125 | | |
103 | 126 | | |
104 | 127 | | |
| |||
194 | 217 | | |
195 | 218 | | |
196 | 219 | | |
197 | | - | |
| 220 | + | |
198 | 221 | | |
199 | 222 | | |
200 | 223 | | |
201 | 224 | | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
202 | 235 | | |
203 | 236 | | |
204 | 237 | | |
| |||
227 | 260 | | |
228 | 261 | | |
229 | 262 | | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
230 | 277 | | |
231 | 278 | | |
232 | 279 | | |
| |||
250 | 297 | | |
251 | 298 | | |
252 | 299 | | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
253 | 313 | | |
254 | 314 | | |
255 | 315 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| 107 | + | |
107 | 108 | | |
108 | 109 | | |
109 | 110 | | |
| |||
122 | 123 | | |
123 | 124 | | |
124 | 125 | | |
125 | | - | |
| 126 | + | |
126 | 127 | | |
127 | 128 | | |
128 | 129 | | |
| |||
158 | 159 | | |
159 | 160 | | |
160 | 161 | | |
161 | | - | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
162 | 170 | | |
163 | 171 | | |
164 | 172 | | |
| |||
199 | 207 | | |
200 | 208 | | |
201 | 209 | | |
202 | | - | |
| 210 | + | |
203 | 211 | | |
204 | 212 | | |
205 | | - | |
| 213 | + | |
206 | 214 | | |
207 | 215 | | |
208 | 216 | | |
209 | 217 | | |
210 | 218 | | |
| 219 | + | |
| 220 | + | |
211 | 221 | | |
212 | 222 | | |
213 | 223 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | | - | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| 27 | + | |
| 28 | + | |
26 | 29 | | |
27 | 30 | | |
28 | 31 | | |
29 | 32 | | |
| 33 | + | |
30 | 34 | | |
31 | 35 | | |
32 | 36 | | |
33 | 37 | | |
34 | 38 | | |
35 | 39 | | |
| 40 | + | |
36 | 41 | | |
37 | 42 | | |
38 | 43 | | |
39 | 44 | | |
40 | 45 | | |
41 | 46 | | |
42 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
43 | 51 | | |
44 | 52 | | |
45 | 53 | | |
| |||
0 commit comments