Skip to content

Commit e69aaab

Browse files
author
QuantTradeAI Maintainer
committed
Merge branch 'main' of https://github.com/AKKI0511/QuantTradeAI into feat/backtest-model-cli
2 parents 3f0f9bf + 6958462 commit e69aaab

21 files changed

+2073
-1711
lines changed

.env.example

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# QuantTradeAI example environment file
2+
#
3+
# Copy to .env and fill in values. Do NOT commit .env.
4+
5+
########################################
6+
# Data Providers (optional)
7+
########################################
8+
# Required ONLY if you use AlphaVantageDataSource
9+
ALPHAVANTAGE_API_KEY=""
10+
11+
########################################
12+
# LLM Sentiment (optional)
13+
########################################
14+
# Required if sentiment.enabled=true AND provider=openai
15+
OPENAI_API_KEY=""
16+
17+
# Required if sentiment.enabled=true AND provider=anthropic
18+
ANTHROPIC_API_KEY=""
19+
20+
# Required if sentiment.enabled=true AND provider=huggingface
21+
HUGGINGFACE_API_KEY=""
22+
23+
# Ollama typically runs locally and does not require an API key
24+
# (no env var needed)
25+
26+
########################################
27+
# Streaming Providers (optional)
28+
########################################
29+
# For providers using `auth_method: api_key`, the convention is:
30+
# <PROVIDER>_API_KEY and <PROVIDER>_API_SECRET
31+
32+
# Alpaca example (required if using provider name "alpaca")
33+
ALPACA_API_KEY=""
34+
ALPACA_API_SECRET=""
35+
36+
# Other providers (uncomment as needed)
37+
# INTERACTIVE_BROKERS_API_KEY=""
38+
# INTERACTIVE_BROKERS_API_SECRET=""
39+
# BINANCE_API_KEY=""
40+
# BINANCE_API_SECRET=""
41+
# COINBASE_API_KEY=""
42+
# COINBASE_API_SECRET=""

AGENTS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,9 @@
3737
- Centralize knobs in YAML under `config/`; validate changes with `verify_config_loading.py`.
3838
- Write outputs to `data/`, `models/`, `reports/` (these paths are gitignored by default).
3939

40+
## Evaluation & Splitting (Important)
41+
- Train/test splits are time-aware:
42+
- Prefer `data.test_start` and optional `data.test_end` in `config/model_config.yaml`.
43+
- If unset, the last `training.test_size` fraction is used as test chronologically (no shuffle).
44+
- Hyperparameter tuning uses `TimeSeriesSplit(n_splits=training.cv_folds)` to avoid leakage.
45+
- Ensure any configured test window falls within `data.start_date`/`data.end_date`.

LLM.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ make test # pytest testing
6868
- **Pydantic** - Configuration validation
6969
- **joblib** - Model persistence
7070

71-
## API Structure
71+
## API Structure
7272

7373
### Data Loading
7474
```python
@@ -84,15 +84,19 @@ df_processed = processor.process_data(df)
8484
df_labeled = processor.generate_labels(df_processed)
8585
```
8686

87-
### Model Training
88-
```python
89-
from quanttradeai import MomentumClassifier
90-
91-
# Initialize and train
92-
classifier = MomentumClassifier("config/model_config.yaml")
93-
X, y = classifier.prepare_data(df_labeled)
94-
classifier.train(X, y)
95-
```
87+
### Model Training
88+
```python
89+
from quanttradeai import MomentumClassifier
90+
91+
# Initialize and train
92+
classifier = MomentumClassifier("config/model_config.yaml")
93+
X, y = classifier.prepare_data(df_labeled)
94+
classifier.train(X, y)
95+
```
96+
97+
### Evaluation & Splitting
98+
- CLI training performs time‑aware splits using `data.test_start` and optional `data.test_end` in `config/model_config.yaml`. If unset, the last `training.test_size` fraction is used chronologically (no shuffle).
99+
- Hyperparameter tuning uses `TimeSeriesSplit(n_splits=training.cv_folds)` to prevent look‑ahead bias during CV.
96100

97101
### Backtesting
98102
```python
@@ -338,4 +342,4 @@ For CLI and Python examples see [docs/llm-sentiment.md](docs/llm-sentiment.md).
338342

339343
---
340344

341-
**Remember**: Always test thoroughly, follow coding standards, and maintain documentation. This codebase is used for financial applications - accuracy and reliability are paramount.
345+
**Remember**: Always test thoroughly, follow coding standards, and maintain documentation. This codebase is used for financial applications - accuracy and reliability are paramount.

0 commit comments

Comments
 (0)