Add trading signal and execution layers with database integration

- Introduced `TradingSignalLayer` and `TradeExecutionLayer` for visualizing buy/sell signals and trade entries/exits on charts.
- Implemented signal validation and filtering mechanisms to ensure data integrity and user-configurable options.
- Enhanced market data layout to support new timeframes for improved user experience.
- Updated documentation to reflect the new signal layer architecture and its integration with the dashboard.
- Ensured compatibility with existing components while maintaining a modular structure for future enhancements.
This commit is contained in:
Vasily.onl 2025-06-04 15:54:14 +08:00
parent cdee9f04d6
commit 5506f5db64
4 changed files with 1059 additions and 9 deletions

View File

@ -14,6 +14,8 @@ Components:
- BollingerBandsLayer: Bollinger Bands overlay with fill area
- RSILayer: RSI oscillator subplot
- MACDLayer: MACD lines and histogram subplot
- TradingSignalLayer: Buy/sell/hold signal markers
- TradeExecutionLayer: Trade entry/exit point visualization
"""
from .base import (
@ -47,6 +49,22 @@ from .subplots import (
create_common_subplot_indicators
)
from .signals import (
BaseSignalLayer,
SignalLayerConfig,
TradingSignalLayer,
BaseTradeLayer,
TradeLayerConfig,
TradeExecutionLayer,
create_trading_signal_layer,
create_buy_signals_only_layer,
create_sell_signals_only_layer,
create_high_confidence_signals_layer,
create_trade_execution_layer,
create_profitable_trades_only_layer,
create_losing_trades_only_layer
)
__all__ = [
# Base layers
'BaseChartLayer',
@ -68,6 +86,16 @@ __all__ = [
'RSILayer',
'MACDLayer',
# Signal layers
'BaseSignalLayer',
'SignalLayerConfig',
'TradingSignalLayer',
# Trade layers
'BaseTradeLayer',
'TradeLayerConfig',
'TradeExecutionLayer',
# Convenience functions
'create_sma_layer',
'create_ema_layer',
@ -76,7 +104,14 @@ __all__ = [
'create_common_overlay_indicators',
'create_rsi_layer',
'create_macd_layer',
'create_common_subplot_indicators'
'create_common_subplot_indicators',
'create_trading_signal_layer',
'create_buy_signals_only_layer',
'create_sell_signals_only_layer',
'create_high_confidence_signals_layer',
'create_trade_execution_layer',
'create_profitable_trades_only_layer',
'create_losing_trades_only_layer'
]
__version__ = "0.1.0"

File diff suppressed because it is too large Load Diff

View File

@ -25,6 +25,10 @@ def get_market_data_layout():
# Create dropdown options
symbol_options = [{'label': symbol, 'value': symbol} for symbol in symbols]
timeframe_options = [
{'label': "1 Second", 'value': '1s'},
{'label': "5 Seconds", 'value': '5s'},
{'label': "15 Seconds", 'value': '15s'},
{'label': "30 Seconds", 'value': '30s'},
{'label': '1 Minute', 'value': '1m'},
{'label': '5 Minutes', 'value': '5m'},
{'label': '15 Minutes', 'value': '15m'},
@ -34,9 +38,9 @@ def get_market_data_layout():
]
# Filter timeframe options to only show those available in database
available_timeframes = [tf for tf in ['1m', '5m', '15m', '1h', '4h', '1d'] if tf in timeframes]
available_timeframes = [tf for tf in ['1s', '5s', '15s', '30s', '1m', '5m', '15m', '1h', '4h', '1d'] if tf in timeframes]
if not available_timeframes:
available_timeframes = ['1h'] # Default fallback
available_timeframes = ['5m'] # Default fallback
timeframe_options = [opt for opt in timeframe_options if opt['value'] in available_timeframes]

View File

@ -19,7 +19,7 @@ Implementation of a flexible, strategy-driven chart system that supports technic
- `components/charts/layers/base.py` - Base layer system with CandlestickLayer, VolumeLayer, and LayerManager
- `components/charts/layers/indicators.py` - Indicator overlay rendering (SMA, EMA, Bollinger Bands)
- `components/charts/layers/subplots.py` - Subplot management for indicators like RSI and MACD
- `components/charts/layers/signals.py` - Strategy signal overlays and trade markers (future bot integration)
- `components/charts/layers/signals.py` - Strategy signal overlays and trade markers with database integration
- `dashboard/` - **NEW: Modular dashboard structure with separated layouts and callbacks**
- `dashboard/layouts/market_data.py` - Enhanced market data layout with chart configuration UI
- `dashboard/callbacks/charts.py` - **NEW: Modular chart callbacks with strategy handling**
@ -43,6 +43,7 @@ Implementation of a flexible, strategy-driven chart system that supports technic
- Backward compatibility maintained with existing `components/charts.py` API
- Use `uv run pytest tests/test_chart_*.py` to run chart-specific tests
- **Modular dashboard structure implemented with complete separation of concerns**
- **Signal layer architecture implemented with database integration for bot signals**
- Create documentation with important components in ./docs/components/charts/ folder without redundancy
## Tasks
@ -85,13 +86,13 @@ Implementation of a flexible, strategy-driven chart system that supports technic
- [x] 4.7 Test dashboard integration with real market data
- [ ] 5.0 Signal Layer Foundation for Future Bot Integration
- [ ] 5.1 Create signal layer architecture for buy/sell markers
- [ ] 5.2 Implement trade entry/exit point visualization
- [x] 5.1 Create signal layer architecture for buy/sell markers
- [x] 5.2 Implement trade entry/exit point visualization
- [ ] 5.3 Add support/resistance line drawing capabilities
- [ ] 5.4 Create extensible interface for custom strategy signals
- [ ] 5.5 Add signal color and style customization options
- [ ] 5.6 Prepare integration points for bot management system
- [ ] 5.7 Create foundation tests for signal layer functionality
- [ ] 5.7 Create foundation tests for signal layer functionality
- [ ] 6.0 Documentation **⏳ IN PROGRESS**
- [x] 6.1 Create documentation for the chart layers system
@ -116,10 +117,11 @@ Implementation of a flexible, strategy-driven chart system that supports technic
- **Chart callbacks**: Updated to handle new layer system with strategy support
- **Real-time updates**: Working chart updates with indicator toggling
- **Market data integration**: Confirmed working with live data
- **Signal layer architecture**: Complete foundation for bot signal visualization
### 📋 **NEXT PHASES**
- **5.0 Signal Layer**: Foundation for bot signal integration
- **5.2-5.7**: Complete signal layer implementation
- **6.0 Documentation**: Complete README and final documentation updates
The chart layers system is now **production-ready** with full dashboard integration! 🚀
The signal layer foundation is now **implemented and ready** for bot integration! 🚀