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
ANNOTATE/
├── 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
# Install dependencies (if not already installed)
pip install dash plotly pandas numpy
# Run the application
python ANNOTATE/web/app.py
Usage
- Start the application: Run
python ANNOTATE/web/app.py - Open browser: Navigate to
http://localhost:8051 - Select symbol and timeframe: Choose trading pair and timeframes to display
- Navigate to time period: Use date picker or scroll to find market conditions
- Mark trades: Click on chart to mark entry point, click again for exit
- Generate test cases: Click "Generate Test Case" to create training data
- Train models: Select model and click "Train" to run training session
- 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:
# Import annotation manager in main system
from ANNOTATE.core.annotation_manager import AnnotationManager
# Import training simulator
from ANNOTATE.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:
- Update requirements in
.kiro/specs/manual-trade-annotation-ui/requirements.md - Update design in
.kiro/specs/manual-trade-annotation-ui/design.md - Add tasks to
.kiro/specs/manual-trade-annotation-ui/tasks.md - Implement changes following the task list
License
Part of the AI Trading System project.