Skip to content

Commit bd550fa

Browse files
committed
feat: add SQLAlchemy and Tenacity to all repos with output dispatching and retry logic
- Added `sqlalchemy>=2.0` to all repositories supporting paper trading or database output - Added `tenacity>=8.2.2,<9.0.0` to all repositories for retry logic in output dispatchers - Audited and updated `requirements.in` for all `stock-backtest-*` repositories - Ensured core ML/quant libraries (e.g., `scikit-learn`, `tensorflow`, `torch`) are included where appropriate - Standardized base requirements across all backtest repos - Implemented and ran a Python script to append missing dependencies and recompile `requirements.txt` via `pip-compile` - Verified `output_handler.py` across repositories is finalized and production-ready - Synced all shared utility modules across repositories and verified that all enhancements were correctly integrated This ensures consistent, production-grade dependency management across the entire stock-backtest ecosystem.
1 parent 10137b5 commit bd550fa

36 files changed

+1363
-626
lines changed

.hooks/check-compiled-requirements.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def recompile(in_file: str, out_file: str) -> bool:
2929
3030
Returns:
3131
True if successful, False otherwise.
32+
3233
"""
3334
print(f"[Fix] Recompiling {in_file} -> {out_file}")
3435
try:
@@ -52,6 +53,7 @@ def check_file(in_file: str, out_file: str, autofix: bool = True) -> bool:
5253
5354
Returns:
5455
True if up to date or successfully fixed, False otherwise.
56+
5557
"""
5658
if not Path(in_file).exists():
5759
return True # Skip if input file does not exist

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Stock Poller
22

3-
This repository implements a modular polling service that collects stock data from external APIs and pushes the results to a message queue for downstream processing.
3+
This repository implements a modular polling service that collects stock data
4+
from external APIs and pushes the results to a message queue for downstream
5+
processing.
46

57
## ✅ Features
68

@@ -46,7 +48,7 @@ python -m app.main
4648
## ⚙️ Environment Variables
4749

4850
| Variable | Description |
49-
|----------------------|-----------------------------------------------|
51+
| -------------------- | --------------------------------------------- |
5052
| `QUEUE_TYPE` | `rabbitmq` or `sqs` |
5153
| `SYMBOLS` | Comma-separated list of stock symbols |
5254
| `POLLING_INTERVAL` | Interval between poll cycles (seconds) |
@@ -86,4 +88,5 @@ make k8s
8688

8789
## 📝 License
8890

89-
Licensed under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0).
91+
Licensed under the
92+
[Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0).

requirements.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ prometheus_client>=0.17.1
1616
# Security: Fix pip-audit vulnerabilities
1717
requests>=2.32.4
1818
urllib3>=2.5.0
19+
20+
# Retry logic
21+
tenacity>=8.2.2,<9.0.0

requirements.txt

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
# This file is autogenerated by pip-compile with Python 3.12
33
# by the following command:
44
#
5-
# pip-compile requirements.in
5+
# pip-compile 'D:\git\stock-data-stream\requirements.in'
66
#
77
boto3==1.38.36
8-
# via -r requirements.in
8+
# via -r D:\git\stock-data-stream\requirements.in
99
botocore==1.38.36
1010
# via
1111
# boto3
@@ -31,26 +31,26 @@ jmespath==1.0.1
3131
kiwisolver==1.4.8
3232
# via matplotlib
3333
loguru==0.7.3
34-
# via -r requirements.in
34+
# via -r D:\git\stock-data-stream\requirements.in
3535
matplotlib==3.10.3
36-
# via -r requirements.in
36+
# via -r D:\git\stock-data-stream\requirements.in
3737
numpy==1.26.4
3838
# via
39-
# -r requirements.in
39+
# -r D:\git\stock-data-stream\requirements.in
4040
# contourpy
4141
# matplotlib
4242
# pandas
4343
# scipy
4444
packaging==25.0
4545
# via matplotlib
4646
pandas==2.2.3
47-
# via -r requirements.in
47+
# via -r D:\git\stock-data-stream\requirements.in
4848
pika==1.3.2
49-
# via -r requirements.in
49+
# via -r D:\git\stock-data-stream\requirements.in
5050
pillow==11.2.1
5151
# via matplotlib
5252
prometheus-client==0.22.1
53-
# via -r requirements.in
53+
# via -r D:\git\stock-data-stream\requirements.in
5454
pyparsing==3.2.3
5555
# via matplotlib
5656
python-dateutil==2.9.0.post0
@@ -59,22 +59,24 @@ python-dateutil==2.9.0.post0
5959
# matplotlib
6060
# pandas
6161
python-dotenv==1.1.0
62-
# via -r requirements.in
62+
# via -r D:\git\stock-data-stream\requirements.in
6363
pytz==2025.2
6464
# via pandas
6565
requests==2.32.4
66-
# via -r requirements.in
66+
# via -r D:\git\stock-data-stream\requirements.in
6767
s3transfer==0.13.0
6868
# via boto3
6969
scipy==1.15.3
70-
# via -r requirements.in
70+
# via -r D:\git\stock-data-stream\requirements.in
7171
six==1.17.0
7272
# via python-dateutil
73+
tenacity==8.5.0
74+
# via -r D:\git\stock-data-stream\requirements.in
7375
tzdata==2025.2
7476
# via pandas
7577
urllib3==2.5.0
7678
# via
77-
# -r requirements.in
79+
# -r D:\git\stock-data-stream\requirements.in
7880
# botocore
7981
# requests
8082
win32-setctime==1.2.0

0 commit comments

Comments
 (0)