refine design

This commit is contained in:
Dobromir Popov
2025-07-23 15:00:08 +03:00
parent 55ea3bce93
commit 2b3c6abdeb
2 changed files with 154 additions and 122 deletions

View File

@ -12,9 +12,9 @@ The system follows a modular architecture with clear separation of concerns:
```mermaid
graph TD
A[Data Provider] --> B[Data Processor]
A[Data Provider] --> B[Data Processor] (calculates pivot points)
B --> C[CNN Model]
B --> D[RL Model]
B --> D[RL(DQN) Model]
C --> E[Orchestrator]
D --> E
E --> F[Trading Executor]
@ -67,6 +67,13 @@ Based on the existing implementation in `core/data_provider.py`, we'll enhance i
- Enhance real-time data streaming
- Implement better error handling and fallback mechanisms
### BASE FOR ALL MODELS ###
- ***INPUTS***: COB+OHCLV data frame as described:
- OHCLV: 300 frames of (1s, 1m, 1h, 1d) ETH + 300s of 1s BTC
- COB: for each 1s OHCLV we have +- 20 buckets of COB ammounts in USD
- 1,5,15 and 60s MA of the COB imbalance counting +- 5 COB buckets
- ***OUTPUTS***: suggested trade action (BUY/SELL)
### 2. CNN Model
The CNN Model is responsible for analyzing patterns in market data and predicting pivot points across multiple timeframes.
@ -76,6 +83,8 @@ The CNN Model is responsible for analyzing patterns in market data and predictin
- **CNNModel**: Main class for the CNN model.
- **PivotPointPredictor**: Interface for predicting pivot points.
- **CNNTrainer**: Class for training the CNN model.
- ***INPUTS***: COB+OHCLV+Old Pivots (5 levels of pivots)
- ***OUTPUTS***: next pivot point for each level as price-time vector. (can be plotted as trend line) + suggested trade action (BUY/SELL)
#### Implementation Details
@ -111,13 +120,13 @@ The RL Model is responsible for learning optimal trading strategies based on mar
#### Implementation Details
The RL Model will:
- Accept market data, CNN predictions, and CNN hidden layer states as input
- Accept market data, CNN model predictions (output), and CNN hidden layer states as input
- Output trading action recommendations (buy/sell)
- Provide confidence scores for each action
- Learn from past experiences to adapt to the current market environment
Architecture:
- State representation: Market data, CNN predictions, CNN hidden layer states
- State representation: Market data, CNN model predictions (output), CNN hidden layer states
- Action space: Buy, Sell
- Reward function: PnL, risk-adjusted returns
- Policy network: Deep neural network
@ -231,6 +240,11 @@ The Orchestrator coordinates training for all models by managing the prediction-
- Monitors model performance degradation and triggers retraining
- Maintains performance metrics for model comparison and selection
**Training progress and checkpoints persistance**
- it uses the checkpoint manager to store check points of each model over time as training progresses and we have improvements
- checkpoint manager has capability to ensure only top 5 to 10 best checkpoints are stored for each model deleting the least performant ones. it stores metadata along the CPs to decide the performance
- we automatically load the best CP at startup if we have stored ones
##### 5. Decision Making and Trading Actions
Beyond coordination, the Orchestrator makes final trading decisions: