Add comprehensive project documentation and fix data pipeline

- Add detailed README with architecture diagram and usage instructions
- Add API, configuration, and development documentation
- Fix price data column handling for yfinance auto_adjust=True
- Fix model feature dimension indexing and temporal attention batching
- Add missing imports and position tracking in paper broker
- Add python-dotenv support for environment variables
- Update .gitignore with Python artifacts and environment files
This commit is contained in:
2026-05-26 14:10:48 +02:00
parent 4bf7394a0a
commit 0cf37e786a
17 changed files with 1536 additions and 277 deletions
+69
View File
@@ -0,0 +1,69 @@
# Configuration Guide
All configuration is centralized in `config.py` via the `Config` class.
## GPU Settings
| Parameter | Default | Description |
|-----------|---------|-------------|
| `DEVICE` | `'cuda'` | PyTorch device (auto-detected) |
| `AMD_GPU` | `True` | Enable AMD-specific optimizations |
| `GPU_MEMORY_LIMIT` | `0.9` | Fraction of GPU memory to use (0.01.0) |
| `ROCM_OPT_LEVEL` | `'O2'` | ROCm JIT optimization level |
| `MIXED_PRECISION` | `True` | Enable AMP |
| `PRECISION` | `'bf16'` | `'bf16'` or `'fp16'` |
## Model Hyperparameters
| Parameter | Default | Description |
|-----------|---------|-------------|
| `HIDDEN_CHANNELS` | `128` | GNN hidden dimension |
| `NUM_HEADS` | `16` | Attention heads |
| `DROPOUT` | `0.3` | Dropout rate |
| `LEARNING_RATE` | `0.0005` | AdamW learning rate |
| `BATCH_SIZE` | `128` | Training batch size |
| `SEQUENCE_LENGTH` | `60` | Temporal window length |
| `EPOCHS` | `200` | Max training epochs |
## Trading Settings
| Parameter | Default | Description |
|-----------|---------|-------------|
| `TRADING_FREQUENCY` | `'5min'` | Signal generation interval |
| `INITIAL_CAPITAL` | `100000` | Starting portfolio value |
| `MAX_POSITION_SIZE` | `0.03` | Max position as fraction of portfolio |
| `MAX_DAILY_LOSS` | `0.01` | Daily loss circuit breaker |
| `MAX_DRAWDOWN` | `0.05` | Max portfolio drawdown |
## Data Providers
| Parameter | Default | Description |
|-----------|---------|-------------|
| `DATA_PROVIDER` | `'polygon'` | Live data source |
| `POLYGON_API_KEY` | — | Polygon.io API key |
| `ALPHA_VANTAGE_API_KEY` | — | Alpha Vantage API key |
| `IB_HOST` | `'127.0.0.1'` | Interactive Brokers TWS host |
| `IB_PORT` | `7497` | TWS API port |
## Feature Definitions
Three feature vectors are defined and referenced by the models:
```python
NEWS_FEATURES = ['sentiment', 'volume', 'recency', 'source_reliability', 'topic_relevance']
SOCIAL_FEATURES = ['twitter_sentiment', 'twitter_volume', 'reddit_sentiment', 'reddit_volume', 'social_momentum']
INTRADAY_FEATURES = ['return', 'volatility', 'momentum', 'volume_momentum', 'bid_ask_spread', 'bid_ask_spread_pct', 'volume_imbalance', 'order_flow', 'vwap_deviation']
```
## Environment Variables
Sensitive keys can be overridden via environment variables:
```bash
export POLYGON_API_KEY="your_key"
export ALPHA_VANTAGE_API_KEY="your_key"
export NEWS_API_KEY="your_key"
export TWITTER_BEARER_TOKEN="your_token"
```
These are read in `config.py` and fall back to hardcoded placeholders if not set.