Instructions to use RayMelius/stockex-nn-agent with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- stable-baselines3
How to use RayMelius/stockex-nn-agent with stable-baselines3:
from huggingface_sb3 import load_from_hub checkpoint = load_from_hub( repo_id="RayMelius/stockex-nn-agent", filename="{MODEL FILENAME}.zip", ) - Notebooks
- Google Colab
- Kaggle
Transformer PPO trading agent trained on live StockEx data
Browse files- .gitattributes +1 -0
- README.md +48 -0
- final_model.zip +3 -0
- scaler.pkl +3 -0
- training_metrics.png +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
training_metrics.png filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- reinforcement-learning
|
| 5 |
+
- trading
|
| 6 |
+
- PPO
|
| 7 |
+
- transformer
|
| 8 |
+
- stable-baselines3
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# StockEx Transformer Trading Agent
|
| 12 |
+
|
| 13 |
+
Advanced neural network trading agent for the StockEx Clearing House.
|
| 14 |
+
|
| 15 |
+
## Architecture
|
| 16 |
+
|
| 17 |
+
- **Feature Extractor**: Temporal Transformer Encoder (3L, 4H, d=128)
|
| 18 |
+
- **Portfolio Encoder**: 2-layer MLP (8 -> 64)
|
| 19 |
+
- **Actor-Critic**: MLP heads (192 -> 128 -> 64)
|
| 20 |
+
- **Algorithm**: PPO (Proximal Policy Optimization)
|
| 21 |
+
- **Training**: 500,000 timesteps on real ATHEX/NYSE/Euronext data
|
| 22 |
+
|
| 23 |
+
## Observation Space
|
| 24 |
+
|
| 25 |
+
3,008-dimensional vector:
|
| 26 |
+
- Market state (3,000): 60 OHLCV bars x 50 technical indicators
|
| 27 |
+
- Portfolio state (8): capital, holdings, net worth, returns, ratios
|
| 28 |
+
|
| 29 |
+
## Action Space
|
| 30 |
+
|
| 31 |
+
2-dimensional continuous:
|
| 32 |
+
- `action[0]`: 0=Hold, 1=Buy, 2=Sell
|
| 33 |
+
- `action[1]`: Position size (5%-50% of capital/holdings)
|
| 34 |
+
|
| 35 |
+
## Usage
|
| 36 |
+
|
| 37 |
+
Set `CH_RL_MODEL_REPO=RayMelius/stockex-nn-agent` in your StockEx deployment.
|
| 38 |
+
|
| 39 |
+
## Files
|
| 40 |
+
|
| 41 |
+
- `final_model.zip`: PPO model (stable-baselines3 format)
|
| 42 |
+
- `scaler.pkl`: StandardScaler for observation normalization
|
| 43 |
+
|
| 44 |
+
## Performance
|
| 45 |
+
|
| 46 |
+
- Avg PnL: -1,204.17 EUR
|
| 47 |
+
- Win Rate: 40%
|
| 48 |
+
- Avg Trades: 63 securities/episode
|
final_model.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4754d883b11015cb008bef424f6415b912df96b7e77f1173987c9324b6a91d29
|
| 3 |
+
size 5919735
|
scaler.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0626b2541b9ba86d9a3a7d7b0566aa7d24c948d7987f07e10f3c78b216c92e22
|
| 3 |
+
size 1659
|
training_metrics.png
ADDED
|
Git LFS Details
|