-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patherror.txt
More file actions
650 lines (593 loc) · 33.1 KB
/
error.txt
File metadata and controls
650 lines (593 loc) · 33.1 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
samoradc@SYSNOT-0541:/mnt/c/Users/DaviCastroSamora/Documents/SamoraDC/RustAlgorithmTrading$ ./scripts/autonomous_trading_system.sh --mode=backtest-only
[INFO] 2025-11-02 16:18:45 - ==========================================
[INFO] 2025-11-02 16:18:45 - AUTONOMOUS TRADING SYSTEM
[INFO] 2025-11-02 16:18:45 - Mode: backtest-only
[INFO] 2025-11-02 16:18:45 - ==========================================
[INFO] 2025-11-02 16:18:45 - Setting up autonomous trading environment...
[SUCCESS] 2025-11-02 16:18:45 - Environment setup complete
[INFO] 2025-11-02 16:18:45 - Validating system configuration...
[SUCCESS] 2025-11-02 16:18:49 - Configuration validation complete
[INFO] 2025-11-02 16:18:49 - Building Rust services in release mode...
warning: unused import: `Side`
--> execution-engine/src/slippage.rs:1:39
|
1 | use common::types::{Order, OrderType, Side};
| ^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: unused variable: `assumed_mid`
--> execution-engine/src/slippage.rs:99:17
|
99 | let assumed_mid = limit_price.0;
| ^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_assumed_mid`
|
= note: `#[warn(unused_variables)]` on by default
warning: use of deprecated method `pyo3::deprecations::GilRefs::<T>::function_arg`: use `&Bound<'_, T>` instead for this function argument
--> signal-bridge/src/bridge.rs:111:51
|
111 | pub fn compute_batch(&self, py: Python, bars: &PyList) -> PyResult<Vec<Vec<f64>>> {
| ^
|
= note: `#[warn(deprecated)]` on by default
warning: use of deprecated method `pyo3::deprecations::GilRefs::<T>::function_arg`: use `&Bound<'_, T>` instead for this function argument
--> signal-bridge/src/bridge.rs:197:31
|
197 | fn signal_bridge(_py: Python, m: &PyModule) -> PyResult<()> {
| ^
warning: unused variable: `py`
--> signal-bridge/src/bridge.rs:111:33
|
111 | pub fn compute_batch(&self, py: Python, bars: &PyList) -> PyResult<Vec<Vec<f64>>> {
| ^^ help: if this is intentional, prefix it with an underscore: `_py`
|
= note: `#[warn(unused_variables)]` on by default
warning: field `feature_engine` is never read
--> signal-bridge/src/lib.rs:17:5
|
16 | pub struct SignalBridgeService {
| ------------------- field in this struct
17 | feature_engine: FeatureEngine,
| ^^^^^^^^^^^^^^
|
= note: `#[warn(dead_code)]` on by default
warning: field `engine` is never read
--> signal-bridge/src/bridge.rs:43:5
|
42 | pub struct FeatureComputer {
| --------------- field in this struct
43 | engine: FeatureEngine,
| ^^^^^^
warning: unused import: `TradingError`
--> market-data/src/publisher.rs:1:22
|
1 | use common::{Result, TradingError, messaging::Message};
| ^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: unused import: `error`
--> market-data/src/lib.rs:17:21
|
17 | use tracing::{info, error};
| ^^^^^
warning: unused variable: `data`
--> market-data/src/websocket.rs:174:31
|
174 | Message::Ping(data) => {
| ^^^^ help: if this is intentional, prefix it with an underscore: `_data`
|
= note: `#[warn(unused_variables)]` on by default
warning: unused variable: `message`
--> market-data/src/publisher.rs:14:27
|
14 | pub fn publish(&self, message: Message) -> Result<()> {
| ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_message`
warning: fields `ws_client`, `orderbook_manager`, `bar_aggregator`, and `publisher` are never read
--> market-data/src/lib.rs:21:5
|
20 | pub struct MarketDataService {
| ----------------- fields in this struct
21 | ws_client: WebSocketClient,
| ^^^^^^^^^
22 | orderbook_manager: OrderBookManager,
| ^^^^^^^^^^^^^^^^^
23 | bar_aggregator: BarAggregator,
| ^^^^^^^^^^^^^^
24 | publisher: MarketDataPublisher,
| ^^^^^^^^^
|
= note: `#[warn(dead_code)]` on by default
warning: constant `HEARTBEAT_INTERVAL_MS` is never used
--> market-data/src/websocket.rs:12:7
|
12 | const HEARTBEAT_INTERVAL_MS: u64 = 30000;
| ^^^^^^^^^^^^^^^^^^^^^
warning: field `address` is never read
--> market-data/src/publisher.rs:4:5
|
3 | pub struct MarketDataPublisher {
| ------------------- field in this struct
4 | address: String,
| ^^^^^^^
warning: `execution-engine` (lib) generated 2 warnings (run `cargo fix --lib -p execution-engine` to apply 1 suggestion)
warning: `signal-bridge` (lib) generated 5 warnings
warning: `market-data` (lib) generated 7 warnings (run `cargo fix --lib -p market-data` to apply 2 suggestions)
Finished `release` profile [optimized] target(s) in 44.51s
[SUCCESS] 2025-11-02 16:19:32 - Rust services built successfully
[INFO] 2025-11-02 16:19:32 - ==========================================
[INFO] 2025-11-02 16:19:32 - PHASE 0: DATA PREPARATION
[INFO] 2025-11-02 16:19:32 - ==========================================
[INFO] 2025-11-02 16:19:32 - Checking for historical market data...
[INFO] 2025-11-02 16:19:32 - Found 6 data files in /mnt/c/Users/DaviCastroSamora/Documents/SamoraDC/RustAlgorithmTrading/data/historical
[WARNING] 2025-11-02 16:19:32 - Found 3 data files older than 7 days
[INFO] 2025-11-02 16:19:32 - Refreshing market data...
[INFO] 2025-11-02 16:19:32 - Downloading historical market data...
2025-11-02 16:20:06,931 - __main__ - INFO - Initialized downloader for 3 symbols
2025-11-02 16:20:06,931 - __main__ - INFO - Starting download for 3 symbols
2025-11-02 16:20:06,932 - __main__ - INFO - Processing AAPL...
2025-11-02 16:20:06,932 - __main__ - INFO - Date range: 2024-11-01 to 2025-10-31
2025-11-02 16:20:06,932 - __main__ - INFO - Fetching AAPL (attempt 1/3)
2025-11-02 16:20:07,845 - __main__ - WARNING - No data returned for AAPL
2025-11-02 16:20:07,845 - __main__ - INFO - Retrying AAPL with 90-day range
2025-11-02 16:20:07,845 - __main__ - INFO - Fetching AAPL (attempt 1/2)
2025-11-02 16:20:08,002 - __main__ - WARNING - No data returned for AAPL
2025-11-02 16:20:08,002 - __main__ - INFO - Retrying AAPL with 90-day range
2025-11-02 16:20:08,002 - __main__ - INFO - Fetching AAPL (attempt 1/1)
2025-11-02 16:20:08,170 - __main__ - WARNING - No data returned for AAPL
2025-11-02 16:20:08,170 - __main__ - INFO - Retrying AAPL with 90-day range
2025-11-02 16:20:08,170 - __main__ - ERROR - Failed to fetch AAPL after 0 attempts
2025-11-02 16:20:08,171 - __main__ - ERROR - No data for AAPL
2025-11-02 16:20:08,171 - __main__ - INFO - Processing MSFT...
2025-11-02 16:20:08,171 - __main__ - INFO - Date range: 2024-11-01 to 2025-10-31
2025-11-02 16:20:08,171 - __main__ - INFO - Fetching MSFT (attempt 1/3)
2025-11-02 16:20:08,341 - __main__ - WARNING - No data returned for MSFT
2025-11-02 16:20:08,342 - __main__ - INFO - Retrying MSFT with 90-day range
2025-11-02 16:20:08,342 - __main__ - INFO - Fetching MSFT (attempt 1/2)
2025-11-02 16:20:08,508 - __main__ - WARNING - No data returned for MSFT
2025-11-02 16:20:08,508 - __main__ - INFO - Retrying MSFT with 90-day range
2025-11-02 16:20:08,508 - __main__ - INFO - Fetching MSFT (attempt 1/1)
2025-11-02 16:20:09,179 - __main__ - WARNING - No data returned for MSFT
2025-11-02 16:20:09,179 - __main__ - INFO - Retrying MSFT with 90-day range
2025-11-02 16:20:09,179 - __main__ - ERROR - Failed to fetch MSFT after 0 attempts
2025-11-02 16:20:09,180 - __main__ - ERROR - No data for MSFT
2025-11-02 16:20:09,180 - __main__ - INFO - Processing GOOGL...
2025-11-02 16:20:09,180 - __main__ - INFO - Date range: 2024-11-01 to 2025-10-31
2025-11-02 16:20:09,180 - __main__ - INFO - Fetching GOOGL (attempt 1/3)
2025-11-02 16:20:09,356 - __main__ - WARNING - No data returned for GOOGL
2025-11-02 16:20:09,356 - __main__ - INFO - Retrying GOOGL with 90-day range
2025-11-02 16:20:09,356 - __main__ - INFO - Fetching GOOGL (attempt 1/2)
2025-11-02 16:20:09,526 - __main__ - WARNING - No data returned for GOOGL
2025-11-02 16:20:09,526 - __main__ - INFO - Retrying GOOGL with 90-day range
2025-11-02 16:20:09,527 - __main__ - INFO - Fetching GOOGL (attempt 1/1)
2025-11-02 16:20:10,195 - __main__ - WARNING - No data returned for GOOGL
2025-11-02 16:20:10,196 - __main__ - INFO - Retrying GOOGL with 90-day range
2025-11-02 16:20:10,196 - __main__ - ERROR - Failed to fetch GOOGL after 0 attempts
2025-11-02 16:20:10,196 - __main__ - ERROR - No data for GOOGL
2025-11-02 16:20:10,196 - __main__ - INFO - ============================================================
2025-11-02 16:20:10,197 - __main__ - INFO - DOWNLOAD SUMMARY
2025-11-02 16:20:10,197 - __main__ - INFO - ============================================================
2025-11-02 16:20:10,197 - __main__ - INFO - Total symbols: 3
2025-11-02 16:20:10,197 - __main__ - INFO - Successful: 0
2025-11-02 16:20:10,197 - __main__ - INFO - Failed: 3
2025-11-02 16:20:10,197 - __main__ - INFO - Total rows: 0
2025-11-02 16:20:10,197 - __main__ - INFO - Duration: 3.26s
2025-11-02 16:20:10,198 - __main__ - INFO - ============================================================
2025-11-02 16:20:10,198 - __main__ - WARNING - Completed with 3 failures
[ERROR] 2025-11-02 16:20:10 - Failed to download market data
[INFO] 2025-11-02 16:20:10 - Attempting fallback download with shorter time range...
2025-11-02 16:20:17,990 - __main__ - INFO - Initialized downloader for 3 symbols
2025-11-02 16:20:17,990 - __main__ - INFO - Starting download for 3 symbols
2025-11-02 16:20:17,990 - __main__ - INFO - Processing AAPL...
2025-11-02 16:20:17,990 - __main__ - INFO - Date range: 2025-08-04 to 2025-10-31
2025-11-02 16:20:17,990 - __main__ - INFO - Fetching AAPL (attempt 1/3)
2025-11-02 16:20:18,567 - __main__ - WARNING - No data returned for AAPL
2025-11-02 16:20:18,567 - __main__ - INFO - Fetching AAPL (attempt 2/3)
2025-11-02 16:20:18,734 - __main__ - WARNING - No data returned for AAPL
2025-11-02 16:20:18,734 - __main__ - INFO - Fetching AAPL (attempt 3/3)
2025-11-02 16:20:18,893 - __main__ - WARNING - No data returned for AAPL
2025-11-02 16:20:18,893 - __main__ - ERROR - Failed to fetch AAPL after 3 attempts
2025-11-02 16:20:18,894 - __main__ - ERROR - No data for AAPL
2025-11-02 16:20:18,894 - __main__ - INFO - Processing MSFT...
2025-11-02 16:20:18,894 - __main__ - INFO - Date range: 2025-08-04 to 2025-10-31
2025-11-02 16:20:18,894 - __main__ - INFO - Fetching MSFT (attempt 1/3)
2025-11-02 16:20:19,056 - __main__ - WARNING - No data returned for MSFT
2025-11-02 16:20:19,056 - __main__ - INFO - Fetching MSFT (attempt 2/3)
2025-11-02 16:20:19,218 - __main__ - WARNING - No data returned for MSFT
2025-11-02 16:20:19,218 - __main__ - INFO - Fetching MSFT (attempt 3/3)
2025-11-02 16:20:19,369 - __main__ - WARNING - No data returned for MSFT
2025-11-02 16:20:19,369 - __main__ - ERROR - Failed to fetch MSFT after 3 attempts
2025-11-02 16:20:19,369 - __main__ - ERROR - No data for MSFT
2025-11-02 16:20:19,370 - __main__ - INFO - Processing GOOGL...
2025-11-02 16:20:19,370 - __main__ - INFO - Date range: 2025-08-04 to 2025-10-31
2025-11-02 16:20:19,370 - __main__ - INFO - Fetching GOOGL (attempt 1/3)
2025-11-02 16:20:19,524 - __main__ - WARNING - No data returned for GOOGL
2025-11-02 16:20:19,524 - __main__ - INFO - Fetching GOOGL (attempt 2/3)
2025-11-02 16:20:19,691 - __main__ - WARNING - No data returned for GOOGL
2025-11-02 16:20:19,691 - __main__ - INFO - Fetching GOOGL (attempt 3/3)
2025-11-02 16:20:19,874 - __main__ - WARNING - No data returned for GOOGL
2025-11-02 16:20:19,874 - __main__ - ERROR - Failed to fetch GOOGL after 3 attempts
2025-11-02 16:20:19,874 - __main__ - ERROR - No data for GOOGL
2025-11-02 16:20:19,874 - __main__ - INFO - ============================================================
2025-11-02 16:20:19,874 - __main__ - INFO - DOWNLOAD SUMMARY
2025-11-02 16:20:19,874 - __main__ - INFO - ============================================================
2025-11-02 16:20:19,874 - __main__ - INFO - Total symbols: 3
2025-11-02 16:20:19,874 - __main__ - INFO - Successful: 0
2025-11-02 16:20:19,875 - __main__ - INFO - Failed: 3
2025-11-02 16:20:19,875 - __main__ - INFO - Total rows: 0
2025-11-02 16:20:19,875 - __main__ - INFO - Duration: 1.88s
2025-11-02 16:20:19,875 - __main__ - INFO - ============================================================
2025-11-02 16:20:19,875 - __main__ - WARNING - Completed with 3 failures
[ERROR] 2025-11-02 16:20:20 - Market data download failed
[ERROR] 2025-11-02 16:20:20 - Please check:
[ERROR] 2025-11-02 16:20:20 - 1. Alpaca API credentials in .env
[ERROR] 2025-11-02 16:20:20 - 2. Internet connection
[ERROR] 2025-11-02 16:20:20 - 3. API rate limits
[SUCCESS] 2025-11-02 16:20:20 - ==========================================
[SUCCESS] 2025-11-02 16:20:20 - AUTONOMOUS TRADING SYSTEM COMPLETE
[SUCCESS] 2025-11-02 16:20:20 - ==========================================
[INFO] 2025-11-02 16:20:20 - Cleanup triggered...
[INFO] 2025-11-02 16:20:20 - Stopping all services...
[SUCCESS] 2025-11-02 16:20:20 - All services stopped
samoradc@SYSNOT-0541:/mnt/c/Users/DaviCastroSamora/Documents/SamoraDC/RustAlgorithmTrading$ ./scripts/autonomous_trading_system.sh --mode=backtest-only
[INFO] 2025-11-02 16:23:15 - ==========================================
[INFO] 2025-11-02 16:23:15 - AUTONOMOUS TRADING SYSTEM
[INFO] 2025-11-02 16:23:15 - Mode: backtest-only
[INFO] 2025-11-02 16:23:15 - ==========================================
[INFO] 2025-11-02 16:23:15 - Setting up autonomous trading environment...
[SUCCESS] 2025-11-02 16:23:15 - Environment setup complete
[INFO] 2025-11-02 16:23:15 - Validating system configuration...
[SUCCESS] 2025-11-02 16:23:18 - Configuration validation complete
[INFO] 2025-11-02 16:23:18 - Building Rust services in release mode...
warning: unused import: `Side`
--> execution-engine/src/slippage.rs:1:39
|
1 | use common::types::{Order, OrderType, Side};
| ^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: unused variable: `assumed_mid`
--> execution-engine/src/slippage.rs:99:17
|
99 | let assumed_mid = limit_price.0;
| ^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_assumed_mid`
|
= note: `#[warn(unused_variables)]` on by default
warning: unused import: `TradingError`
--> market-data/src/publisher.rs:1:22
|
1 | use common::{Result, TradingError, messaging::Message};
| ^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: unused import: `error`
--> market-data/src/lib.rs:17:21
|
17 | use tracing::{info, error};
| ^^^^^
warning: unused variable: `data`
--> market-data/src/websocket.rs:174:31
|
174 | Message::Ping(data) => {
| ^^^^ help: if this is intentional, prefix it with an underscore: `_data`
|
= note: `#[warn(unused_variables)]` on by default
warning: unused variable: `message`
--> market-data/src/publisher.rs:14:27
|
14 | pub fn publish(&self, message: Message) -> Result<()> {
| ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_message`
warning: fields `ws_client`, `orderbook_manager`, `bar_aggregator`, and `publisher` are never read
--> market-data/src/lib.rs:21:5
|
20 | pub struct MarketDataService {
| ----------------- fields in this struct
21 | ws_client: WebSocketClient,
| ^^^^^^^^^
22 | orderbook_manager: OrderBookManager,
| ^^^^^^^^^^^^^^^^^
23 | bar_aggregator: BarAggregator,
| ^^^^^^^^^^^^^^
24 | publisher: MarketDataPublisher,
| ^^^^^^^^^
|
= note: `#[warn(dead_code)]` on by default
warning: constant `HEARTBEAT_INTERVAL_MS` is never used
--> market-data/src/websocket.rs:12:7
|
12 | const HEARTBEAT_INTERVAL_MS: u64 = 30000;
| ^^^^^^^^^^^^^^^^^^^^^
warning: field `address` is never read
--> market-data/src/publisher.rs:4:5
|
3 | pub struct MarketDataPublisher {
| ------------------- field in this struct
4 | address: String,
| ^^^^^^^
warning: `execution-engine` (lib) generated 2 warnings (run `cargo fix --lib -p execution-engine` to apply 1 suggestion)
warning: `market-data` (lib) generated 7 warnings (run `cargo fix --lib -p market-data` to apply 2 suggestions)
warning: use of deprecated method `pyo3::deprecations::GilRefs::<T>::function_arg`: use `&Bound<'_, T>` instead for this function argument
--> signal-bridge/src/bridge.rs:111:51
|
111 | pub fn compute_batch(&self, py: Python, bars: &PyList) -> PyResult<Vec<Vec<f64>>> {
| ^
|
= note: `#[warn(deprecated)]` on by default
warning: use of deprecated method `pyo3::deprecations::GilRefs::<T>::function_arg`: use `&Bound<'_, T>` instead for this function argument
--> signal-bridge/src/bridge.rs:197:31
|
197 | fn signal_bridge(_py: Python, m: &PyModule) -> PyResult<()> {
| ^
warning: unused variable: `py`
--> signal-bridge/src/bridge.rs:111:33
|
111 | pub fn compute_batch(&self, py: Python, bars: &PyList) -> PyResult<Vec<Vec<f64>>> {
| ^^ help: if this is intentional, prefix it with an underscore: `_py`
|
= note: `#[warn(unused_variables)]` on by default
warning: field `feature_engine` is never read
--> signal-bridge/src/lib.rs:17:5
|
16 | pub struct SignalBridgeService {
| ------------------- field in this struct
17 | feature_engine: FeatureEngine,
| ^^^^^^^^^^^^^^
|
= note: `#[warn(dead_code)]` on by default
warning: field `engine` is never read
--> signal-bridge/src/bridge.rs:43:5
|
42 | pub struct FeatureComputer {
| --------------- field in this struct
43 | engine: FeatureEngine,
| ^^^^^^
warning: `signal-bridge` (lib) generated 5 warnings
Finished `release` profile [optimized] target(s) in 11.98s
[SUCCESS] 2025-11-02 16:23:30 - Rust services built successfully
[INFO] 2025-11-02 16:23:30 - ==========================================
[INFO] 2025-11-02 16:23:30 - PHASE 0: DATA PREPARATION
[INFO] 2025-11-02 16:23:30 - ==========================================
[INFO] 2025-11-02 16:23:30 - Checking for historical market data...
[INFO] 2025-11-02 16:23:30 - Found 6 data files in /mnt/c/Users/DaviCastroSamora/Documents/SamoraDC/RustAlgorithmTrading/data/historical
[WARNING] 2025-11-02 16:23:30 - Found 3 data files older than 7 days
[INFO] 2025-11-02 16:23:30 - Refreshing market data...
[INFO] 2025-11-02 16:23:30 - Downloading historical market data...
2025-11-02 16:23:38,979 - __main__ - INFO - Initialized downloader for 3 symbols
2025-11-02 16:23:38,979 - __main__ - INFO - Starting download for 3 symbols
2025-11-02 16:23:38,979 - __main__ - INFO - Processing AAPL...
2025-11-02 16:23:38,979 - __main__ - INFO - Date range: 2024-11-01 to 2025-10-31
2025-11-02 16:23:38,979 - __main__ - INFO - Fetching AAPL (attempt 1/3)
2025-11-02 16:23:39,727 - __main__ - WARNING - No data returned for AAPL
2025-11-02 16:23:39,727 - __main__ - INFO - Retrying AAPL with 90-day range
2025-11-02 16:23:39,727 - __main__ - INFO - Fetching AAPL (attempt 1/2)
2025-11-02 16:23:39,894 - __main__ - WARNING - No data returned for AAPL
2025-11-02 16:23:39,895 - __main__ - INFO - Retrying AAPL with 90-day range
2025-11-02 16:23:39,895 - __main__ - INFO - Fetching AAPL (attempt 1/1)
2025-11-02 16:23:40,060 - __main__ - WARNING - No data returned for AAPL
2025-11-02 16:23:40,060 - __main__ - INFO - Retrying AAPL with 90-day range
2025-11-02 16:23:40,061 - __main__ - ERROR - Failed to fetch AAPL after 0 attempts
2025-11-02 16:23:40,061 - __main__ - ERROR - No data for AAPL
2025-11-02 16:23:40,061 - __main__ - INFO - Processing MSFT...
2025-11-02 16:23:40,061 - __main__ - INFO - Date range: 2024-11-01 to 2025-10-31
2025-11-02 16:23:40,061 - __main__ - INFO - Fetching MSFT (attempt 1/3)
2025-11-02 16:23:40,234 - __main__ - WARNING - No data returned for MSFT
2025-11-02 16:23:40,234 - __main__ - INFO - Retrying MSFT with 90-day range
2025-11-02 16:23:40,234 - __main__ - INFO - Fetching MSFT (attempt 1/2)
2025-11-02 16:23:40,401 - __main__ - WARNING - No data returned for MSFT
2025-11-02 16:23:40,401 - __main__ - INFO - Retrying MSFT with 90-day range
2025-11-02 16:23:40,401 - __main__ - INFO - Fetching MSFT (attempt 1/1)
2025-11-02 16:23:40,567 - __main__ - WARNING - No data returned for MSFT
2025-11-02 16:23:40,567 - __main__ - INFO - Retrying MSFT with 90-day range
2025-11-02 16:23:40,567 - __main__ - ERROR - Failed to fetch MSFT after 0 attempts
2025-11-02 16:23:40,568 - __main__ - ERROR - No data for MSFT
2025-11-02 16:23:40,568 - __main__ - INFO - Processing GOOGL...
2025-11-02 16:23:40,568 - __main__ - INFO - Date range: 2024-11-01 to 2025-10-31
2025-11-02 16:23:40,568 - __main__ - INFO - Fetching GOOGL (attempt 1/3)
2025-11-02 16:23:40,742 - __main__ - WARNING - No data returned for GOOGL
2025-11-02 16:23:40,742 - __main__ - INFO - Retrying GOOGL with 90-day range
2025-11-02 16:23:40,742 - __main__ - INFO - Fetching GOOGL (attempt 1/2)
2025-11-02 16:23:40,906 - __main__ - WARNING - No data returned for GOOGL
2025-11-02 16:23:40,907 - __main__ - INFO - Retrying GOOGL with 90-day range
2025-11-02 16:23:40,907 - __main__ - INFO - Fetching GOOGL (attempt 1/1)
2025-11-02 16:23:41,081 - __main__ - WARNING - No data returned for GOOGL
2025-11-02 16:23:41,081 - __main__ - INFO - Retrying GOOGL with 90-day range
2025-11-02 16:23:41,082 - __main__ - ERROR - Failed to fetch GOOGL after 0 attempts
2025-11-02 16:23:41,082 - __main__ - ERROR - No data for GOOGL
2025-11-02 16:23:41,082 - __main__ - INFO - ============================================================
2025-11-02 16:23:41,082 - __main__ - INFO - DOWNLOAD SUMMARY
2025-11-02 16:23:41,082 - __main__ - INFO - ============================================================
2025-11-02 16:23:41,082 - __main__ - INFO - Total symbols: 3
2025-11-02 16:23:41,082 - __main__ - INFO - Successful: 0
2025-11-02 16:23:41,082 - __main__ - INFO - Failed: 3
2025-11-02 16:23:41,082 - __main__ - INFO - Total rows: 0
2025-11-02 16:23:41,083 - __main__ - INFO - Duration: 2.10s
2025-11-02 16:23:41,083 - __main__ - INFO - ============================================================
2025-11-02 16:23:41,083 - __main__ - WARNING - Completed with 3 failures
[ERROR] 2025-11-02 16:23:41 - Failed to download market data
[INFO] 2025-11-02 16:23:41 - Attempting fallback download with shorter time range...
2025-11-02 16:23:51,767 - __main__ - INFO - Initialized downloader for 3 symbols
2025-11-02 16:23:51,767 - __main__ - INFO - Starting download for 3 symbols
2025-11-02 16:23:51,767 - __main__ - INFO - Processing AAPL...
2025-11-02 16:23:51,767 - __main__ - INFO - Date range: 2025-08-04 to 2025-10-31
2025-11-02 16:23:51,768 - __main__ - INFO - Fetching AAPL (attempt 1/3)
2025-11-02 16:23:52,358 - __main__ - WARNING - No data returned for AAPL
2025-11-02 16:23:52,358 - __main__ - INFO - Fetching AAPL (attempt 2/3)
2025-11-02 16:23:52,524 - __main__ - WARNING - No data returned for AAPL
2025-11-02 16:23:52,524 - __main__ - INFO - Fetching AAPL (attempt 3/3)
2025-11-02 16:23:52,688 - __main__ - WARNING - No data returned for AAPL
2025-11-02 16:23:52,688 - __main__ - ERROR - Failed to fetch AAPL after 3 attempts
2025-11-02 16:23:52,688 - __main__ - ERROR - No data for AAPL
2025-11-02 16:23:52,688 - __main__ - INFO - Processing MSFT...
2025-11-02 16:23:52,689 - __main__ - INFO - Date range: 2025-08-04 to 2025-10-31
2025-11-02 16:23:52,689 - __main__ - INFO - Fetching MSFT (attempt 1/3)
2025-11-02 16:23:52,851 - __main__ - WARNING - No data returned for MSFT
2025-11-02 16:23:52,852 - __main__ - INFO - Fetching MSFT (attempt 2/3)
2025-11-02 16:23:53,014 - __main__ - WARNING - No data returned for MSFT
2025-11-02 16:23:53,015 - __main__ - INFO - Fetching MSFT (attempt 3/3)
2025-11-02 16:23:53,182 - __main__ - WARNING - No data returned for MSFT
2025-11-02 16:23:53,182 - __main__ - ERROR - Failed to fetch MSFT after 3 attempts
2025-11-02 16:23:53,182 - __main__ - ERROR - No data for MSFT
2025-11-02 16:23:53,182 - __main__ - INFO - Processing GOOGL...
2025-11-02 16:23:53,183 - __main__ - INFO - Date range: 2025-08-04 to 2025-10-31
2025-11-02 16:23:53,183 - __main__ - INFO - Fetching GOOGL (attempt 1/3)
2025-11-02 16:23:53,346 - __main__ - WARNING - No data returned for GOOGL
2025-11-02 16:23:53,346 - __main__ - INFO - Fetching GOOGL (attempt 2/3)
2025-11-02 16:23:53,520 - __main__ - WARNING - No data returned for GOOGL
2025-11-02 16:23:53,520 - __main__ - INFO - Fetching GOOGL (attempt 3/3)
2025-11-02 16:23:53,683 - __main__ - WARNING - No data returned for GOOGL
2025-11-02 16:23:53,684 - __main__ - ERROR - Failed to fetch GOOGL after 3 attempts
2025-11-02 16:23:53,684 - __main__ - ERROR - No data for GOOGL
2025-11-02 16:23:53,684 - __main__ - INFO - ============================================================
2025-11-02 16:23:53,684 - __main__ - INFO - DOWNLOAD SUMMARY
2025-11-02 16:23:53,684 - __main__ - INFO - ============================================================
2025-11-02 16:23:53,684 - __main__ - INFO - Total symbols: 3
2025-11-02 16:23:53,684 - __main__ - INFO - Successful: 0
2025-11-02 16:23:53,684 - __main__ - INFO - Failed: 3
2025-11-02 16:23:53,684 - __main__ - INFO - Total rows: 0
2025-11-02 16:23:53,684 - __main__ - INFO - Duration: 1.92s
2025-11-02 16:23:53,684 - __main__ - INFO - ============================================================
2025-11-02 16:23:53,684 - __main__ - WARNING - Completed with 3 failures
[ERROR] 2025-11-02 16:23:53 - Market data download failed
[ERROR] 2025-11-02 16:23:53 - Please check:
[ERROR] 2025-11-02 16:23:53 - 1. Alpaca API credentials in .env
[ERROR] 2025-11-02 16:23:54 - 2. Internet connection
[ERROR] 2025-11-02 16:23:54 - 3. API rate limits
[SUCCESS] 2025-11-02 16:23:54 - ==========================================
[SUCCESS] 2025-11-02 16:23:54 - AUTONOMOUS TRADING SYSTEM COMPLETE
[SUCCESS] 2025-11-02 16:23:54 - ==========================================
[INFO] 2025-11-02 16:23:54 - Cleanup triggered...
[INFO] 2025-11-02 16:23:54 - Stopping all services...
[SUCCESS] 2025-11-02 16:23:54 - All services stopped
================================================================================
API DIAGNOSTIC TEST RESULTS - Expected vs Actual Behavior
Test Date: 2025-11-02
Tester Agent: api_limit hive mind swarm
================================================================================
ISSUE SUMMARY:
--------------
All symbols (AAPL, MSFT, GOOGL) fail to download with "No data returned" errors.
The system attempts multiple retries with 90-day fallback ranges but continues to fail.
ROOT CAUSE ANALYSIS:
-------------------
1. FUTURE DATE ISSUE (CRITICAL):
Expected: End date should never be in the future
Actual: Date range "2024-11-01 to 2025-10-31" includes dates 11 months in future
Impact: Alpaca API rejects requests for future dates with empty response
Fix Required: Cap end_date at today's date, never allow future dates
2. DATE RANGE VALIDATION:
Expected: Validate start_date < end_date < today
Actual: No validation preventing future dates or invalid ranges
Impact: Invalid API requests waste retry attempts
Fix Required: Add date validation before API calls
3. RETRY LOGIC BEHAVIOR:
Expected: Exponential backoff with meaningful delays between retries
Actual: Retries happen too quickly without proper backoff delays
Impact: May trigger rate limits, wastes API quota
Fix Required: Implement exponential backoff (5s, 10s, 20s, 40s...)
4. ERROR MESSAGES:
Expected: Clear indication of root cause (future dates, rate limits, etc.)
Actual: Generic "No data returned" message without specifics
Impact: Difficult to diagnose actual problem
Fix Required: Enhanced error messages with specific failure reasons
5. RESPONSE VALIDATION:
Expected: Check response for rate limit headers and error codes
Actual: Only checks if response is empty
Impact: Misses important API feedback (429, 403, 404)
Fix Required: Parse response headers and HTTP status codes
FAILING TEST CASES:
------------------
Test Case 1: Download AAPL with current date range
Expected: Success with historical data
Actual: "No data returned for AAPL"
Reason: End date is 11 months in the future (2025-10-31 vs 2025-11-02)
Test Case 2: 90-day fallback download
Expected: Shorter range should succeed
Actual: Still fails with "No data returned"
Reason: Fallback logic doesn't fix future date issue, just reduces range
Test Case 3: Multiple retry attempts
Expected: Retries with exponential backoff
Actual: Attempts counter shows "0 attempts" indicating logic error
Reason: Retry counter not incrementing properly in fallback logic
Test Case 4: All symbols fail
Expected: At least one symbol should succeed
Actual: 100% failure rate (3/3 failed)
Reason: Same date range issue affects all symbols
EXPECTED BEHAVIOR (After Fixes):
--------------------------------
1. Date Range Calculation:
- Today: 2025-11-02
- Valid Range: 2024-11-02 to 2025-11-02 (exactly 1 year, never future)
- 90-day Fallback: 2025-08-04 to 2025-11-02 (exactly 90 days, never future)
2. Retry Logic with Exponential Backoff:
Attempt 1: Initial request (0s delay)
Attempt 2: Retry after 5 seconds
Attempt 3: Retry after 10 seconds (5 * 2^1)
Attempt 4: Retry after 20 seconds (5 * 2^2)
Max Delay: 40 seconds (5 * 2^3)
3. Error Handling:
- 403 Forbidden → "Invalid API credentials, check .env file"
- 404 Not Found → "Symbol AAPL not found, verify ticker is correct"
- 429 Too Many Requests → "Rate limit exceeded, waiting 60 seconds..."
- Empty Response → "No trading data for date range (weekends/holidays?)"
4. Success Criteria:
- At least 1 bar of OHLCV data received
- Data has required columns: timestamp, open, high, low, close, volume
- Prices are valid: high >= low, no negative prices
- Timestamps are within requested range
DIAGNOSTIC TEST COVERAGE:
-------------------------
Created: tests/test_alpaca_api_limits.py
- TestDateRangeCalculation: Validates no future dates, format, 90-day logic
- TestRetryLogic: Tests retry attempts, max retries, empty responses
- TestRateLimitDetection: Tests 403, 404, 429 error detection
- TestExponentialBackoff: Validates backoff timing calculation and delays
- TestDataValidation: Tests DataFrame validation, required columns, price checks
Created: scripts/test_alpaca_connection.py
- Test 1: API credentials validation
- Test 2: API connection initialization
- Test 3: Single symbol download with minimal date range
- Test 4: Response format validation
- Test 5: Rate limit information check
RUN TESTS:
----------
cd /mnt/c/Users/DaviCastroSamora/Documents/SamoraDC/RustAlgorithmTrading
python -m pytest tests/test_alpaca_api_limits.py -v
python scripts/test_alpaca_connection.py --symbol AAPL --days 7
RECOMMENDED FIXES:
-----------------
1. Fix date range in download_historical_data.py:
Line ~631: Replace with:
```python
if not args.end_date:
args.end_date = datetime.now().strftime('%Y-%m-%d')
else:
# Cap end_date at today to prevent future dates
end_date_parsed = datetime.strptime(args.end_date, '%Y-%m-%d').date()
today = datetime.now().date()
if end_date_parsed > today:
logger.warning(f"End date {end_date_parsed} is in future, capping at {today}")
args.end_date = today.strftime('%Y-%m-%d')
```
2. Add retry counter fix in _fetch_data_with_retry:
Line ~236: Ensure retry counter increments properly
```python
for attempt in range(self.config.retry_attempts):
logger.info(f"Attempt {attempt + 1}/{self.config.retry_attempts}")
```
3. Implement exponential backoff delay:
Line ~326: Replace with:
```python
if attempt < self.config.retry_attempts - 1:
delay = self.config.retry_delay * (2 ** attempt)
logger.info(f"Retrying in {delay} seconds (exponential backoff)...")
time.sleep(delay)
```
4. Add comprehensive error detection:
Lines ~315-323: Enhance error parsing to detect specific API errors
PRIORITY:
---------
P0 (Critical): Fix future date issue - blocks all downloads
P1 (High): Implement exponential backoff - prevents rate limits
P2 (Medium): Enhance error messages - improves debugging
P3 (Low): Add response header parsing - better monitoring
================================================================================
End of Diagnostic Report
================================================================================