104 lines
3.3 KiB
Markdown
104 lines
3.3 KiB
Markdown
# Manual Trade Annotation UI
|
|
|
|
A web-based interface for manually marking profitable buy/sell signals on historical market data to generate training test cases for machine learning models.
|
|
|
|
## Overview
|
|
|
|
This tool allows traders to:
|
|
- View multi-timeframe candlestick charts
|
|
- Navigate through historical data
|
|
- Mark entry and exit points for trades
|
|
- Generate test cases in realtime format
|
|
- Train models with annotated data
|
|
- Simulate inference to measure model performance
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
TESTCASES/
|
|
├── web/ # Web application
|
|
│ ├── app.py # Main Flask/Dash application
|
|
│ ├── templates/ # Jinja2 HTML templates
|
|
│ │ ├── base_layout.html
|
|
│ │ ├── annotation_dashboard.html
|
|
│ │ └── components/
|
|
│ └── static/ # Static assets
|
|
│ ├── css/
|
|
│ ├── js/
|
|
│ └── images/
|
|
├── core/ # Core business logic
|
|
│ ├── annotation_manager.py
|
|
│ ├── training_simulator.py
|
|
│ └── data_loader.py
|
|
├── data/ # Data storage
|
|
│ ├── annotations/
|
|
│ ├── test_cases/
|
|
│ └── training_results/
|
|
└── tests/ # Test files
|
|
```
|
|
|
|
## Installation
|
|
|
|
```bash
|
|
# Install dependencies (if not already installed)
|
|
pip install dash plotly pandas numpy
|
|
|
|
# Run the application
|
|
python TESTCASES/web/app.py
|
|
```
|
|
|
|
## Usage
|
|
|
|
1. **Start the application**: Run `python TESTCASES/web/app.py`
|
|
2. **Open browser**: Navigate to `http://localhost:8051`
|
|
3. **Select symbol and timeframe**: Choose trading pair and timeframes to display
|
|
4. **Navigate to time period**: Use date picker or scroll to find market conditions
|
|
5. **Mark trades**: Click on chart to mark entry point, click again for exit
|
|
6. **Generate test cases**: Click "Generate Test Case" to create training data
|
|
7. **Train models**: Select model and click "Train" to run training session
|
|
8. **Simulate inference**: Click "Simulate" to test model performance
|
|
|
|
## Features
|
|
|
|
- Multi-timeframe synchronized charts (1s, 1m, 1h, 1d)
|
|
- Interactive trade marking with P&L calculation
|
|
- Test case generation in realtime format
|
|
- Model training integration
|
|
- Inference simulation with performance metrics
|
|
- Session persistence and auto-save
|
|
- Dark theme UI
|
|
|
|
## Integration with Main System
|
|
|
|
This sub-project is designed to be self-contained but can be integrated with the main trading system:
|
|
|
|
```python
|
|
# Import annotation manager in main system
|
|
from TESTCASES.core.annotation_manager import AnnotationManager
|
|
|
|
# Import training simulator
|
|
from TESTCASES.core.training_simulator import TrainingSimulator
|
|
|
|
# Use generated test cases in training
|
|
test_cases = annotation_manager.get_test_cases()
|
|
```
|
|
|
|
## Configuration
|
|
|
|
Configuration is loaded from the main `config.yaml` file. The application uses:
|
|
- Data provider settings for historical data access
|
|
- Model paths for training integration
|
|
- Symbol and timeframe configurations
|
|
|
|
## Development
|
|
|
|
To add new features:
|
|
1. Update requirements in `.kiro/specs/manual-trade-annotation-ui/requirements.md`
|
|
2. Update design in `.kiro/specs/manual-trade-annotation-ui/design.md`
|
|
3. Add tasks to `.kiro/specs/manual-trade-annotation-ui/tasks.md`
|
|
4. Implement changes following the task list
|
|
|
|
## License
|
|
|
|
Part of the AI Trading System project.
|