Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: en
|
| 3 |
+
library_name: pytorch
|
| 4 |
+
license: mit
|
| 5 |
+
tags:
|
| 6 |
+
- reinforcement-learning
|
| 7 |
+
- tabular-classification
|
| 8 |
+
- pytorch
|
| 9 |
+
- trading
|
| 10 |
+
- finance
|
| 11 |
+
- pim
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# Risk_qdrant - Layer 2 RL Agent
|
| 15 |
+
|
| 16 |
+
Part of the PassiveIncomeMaximizer (PIM) trading system.
|
| 17 |
+
|
| 18 |
+
## Model Description
|
| 19 |
+
|
| 20 |
+
Layer 2 RL agents for signal filtering (PPO-trained)
|
| 21 |
+
|
| 22 |
+
This is a Proximal Policy Optimization (PPO) reinforcement learning agent trained to filter trading signals from FinColl predictions. The agent evaluates prediction confidence and signal quality based on risk criteria.
|
| 23 |
+
|
| 24 |
+
## Architecture
|
| 25 |
+
|
| 26 |
+
- **Algorithm**: Proximal Policy Optimization (PPO)
|
| 27 |
+
- **Input**: 414-dimensional SymVectors from FinColl
|
| 28 |
+
- **Output**: Confidence score (0-1) and action recommendation
|
| 29 |
+
- **Training**: Trained on historical market data with profit-based rewards
|
| 30 |
+
- **Framework**: PyTorch with custom RL implementation
|
| 31 |
+
|
| 32 |
+
## Layer 2 System
|
| 33 |
+
|
| 34 |
+
PIM uses 9 Layer 2 RL agents that collaborate to filter predictions:
|
| 35 |
+
1. MomentumAgent - Price momentum patterns
|
| 36 |
+
2. TechnicalAgent - Chart patterns and indicators
|
| 37 |
+
3. RiskAgent - Volatility and drawdown assessment
|
| 38 |
+
4. OptionsAgent - Options flow analysis
|
| 39 |
+
5. MacroAgent - Economic indicators
|
| 40 |
+
6. SentimentAgent - News and social sentiment
|
| 41 |
+
7. VolumeAgent - Trading volume patterns
|
| 42 |
+
8. SectorRotationAgent - Sector strength
|
| 43 |
+
9. MeanReversionAgent - Overbought/oversold detection
|
| 44 |
+
|
| 45 |
+
## Usage
|
| 46 |
+
|
| 47 |
+
```python
|
| 48 |
+
import torch
|
| 49 |
+
from pim.learning.agents.layer2_mlp import Layer2MLPAgents
|
| 50 |
+
|
| 51 |
+
# Load model
|
| 52 |
+
agents = Layer2MLPAgents(device='cuda')
|
| 53 |
+
agents.load_trained_agents('path/to/trained_agents/')
|
| 54 |
+
|
| 55 |
+
# Evaluate a SymVector
|
| 56 |
+
import numpy as np
|
| 57 |
+
symvector = np.random.rand(414) # 414D feature vector from FinColl
|
| 58 |
+
scores = agents.evaluate(symvector) # Returns dict of agent scores
|
| 59 |
+
|
| 60 |
+
# Aggregate scores
|
| 61 |
+
composite, confidence = agents.aggregate_scores(scores)
|
| 62 |
+
print(f"Composite score: {composite:.3f}, Confidence: {confidence}")
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
## Training Data
|
| 66 |
+
|
| 67 |
+
- **Period**: 2024 historical equity data (35,084 SymVectors)
|
| 68 |
+
- **Symbols**: 332 equities from diversified portfolio
|
| 69 |
+
- **Features**: 414-dimensional vectors (price, sentiment, fundamentals, technical indicators)
|
| 70 |
+
- **Source**: FinColl API with TradeStation market data
|
| 71 |
+
|
| 72 |
+
## Performance Metrics
|
| 73 |
+
|
| 74 |
+
Based on January 2024 backtests:
|
| 75 |
+
- **Directional Accuracy**: 71.88% (10-day horizon)
|
| 76 |
+
- **Sharpe Ratio**: 7.24 (annualized)
|
| 77 |
+
- **Profit Factor**: 3.45
|
| 78 |
+
- **Win Rate**: 71.9%
|
| 79 |
+
|
| 80 |
+
## Limitations
|
| 81 |
+
|
| 82 |
+
- Trained on 2024 equity data only (not tested on other asset classes)
|
| 83 |
+
- Requires FinColl SymVectors (414D) as input
|
| 84 |
+
- Performance may degrade in unprecedented market conditions
|
| 85 |
+
- Best used as part of complete PIM dual-layer system
|
| 86 |
+
|
| 87 |
+
## Intended Use
|
| 88 |
+
|
| 89 |
+
This model is intended for:
|
| 90 |
+
- Signal filtering in automated trading systems
|
| 91 |
+
- Research into RL-based trading strategies
|
| 92 |
+
- Educational purposes in quantitative finance
|
| 93 |
+
|
| 94 |
+
**Not intended for**:
|
| 95 |
+
- Standalone trading decisions (use full PIM system)
|
| 96 |
+
- Financial advice or recommendations
|
| 97 |
+
- Unmonitored autonomous trading
|
| 98 |
+
|
| 99 |
+
## Citation
|
| 100 |
+
|
| 101 |
+
```bibtex
|
| 102 |
+
@software{pim_layer2_risk,
|
| 103 |
+
author = {PassiveIncomeMaximizer Team},
|
| 104 |
+
title = {Risk_qdrant - Layer 2 RL Agent},
|
| 105 |
+
year = {2025},
|
| 106 |
+
url = {https://github.com/yourusername/PassiveIncomeMaximizer}
|
| 107 |
+
}
|
| 108 |
+
```
|
| 109 |
+
|
| 110 |
+
## More Information
|
| 111 |
+
|
| 112 |
+
- **Repository**: https://github.com/yourusername/PassiveIncomeMaximizer
|
| 113 |
+
- **Documentation**: See LAYER2_README.md in docs/architecture/layer2/
|
| 114 |
+
- **License**: MIT
|