Remove main application file app.py and update dependencies for modular dashboard architecture

- Deleted `app.py`, consolidating the main application logic into a modular structure for improved maintainability.
- Added `dash-mantine-components` dependency to enhance UI component capabilities.
- Updated `pyproject.toml` and `uv.lock` to reflect the new dependency.
- Adjusted imports in `components/__init__.py` and `chart_controls.py` to align with the new modular design.
- Cleaned up unused parameter controls in the market data layout to streamline the user interface.
This commit is contained in:
Vasily.onl 2025-06-04 15:30:50 +08:00
parent 010adb30f0
commit cdee9f04d6
7 changed files with 29 additions and 1642 deletions

1523
app.py

File diff suppressed because it is too large Load Diff

View File

@ -2,11 +2,10 @@
Reusable UI components for the dashboard.
"""
from .chart_controls import create_chart_config_panel
from .indicator_modal import create_indicator_modal
from .chart_controls import create_chart_config_panel, create_parameter_controls
__all__ = [
'create_indicator_modal',
'create_chart_config_panel',
'create_parameter_controls'
'create_indicator_modal'
]

View File

@ -91,105 +91,6 @@ def create_chart_config_panel(strategy_options, overlay_options, subplot_options
})
def create_parameter_controls():
"""Create the parameter controls section for indicator configuration."""
return html.Div([
html.H5("📊 Indicator Parameters", style={'color': '#2c3e50', 'margin-bottom': '15px'}),
# SMA/EMA Period Controls
html.Div([
html.Label("Moving Average Period:", style={'font-weight': 'bold', 'margin-bottom': '5px'}),
dcc.Slider(
id='ma-period-slider',
min=5, max=200, step=5, value=20,
marks={i: str(i) for i in [5, 20, 50, 100, 200]},
tooltip={'placement': 'bottom', 'always_visible': True}
)
], style={'margin-bottom': '20px'}),
# RSI Period Control
html.Div([
html.Label("RSI Period:", style={'font-weight': 'bold', 'margin-bottom': '5px'}),
dcc.Slider(
id='rsi-period-slider',
min=7, max=30, step=1, value=14,
marks={i: str(i) for i in [7, 14, 21, 30]},
tooltip={'placement': 'bottom', 'always_visible': True}
)
], style={'margin-bottom': '20px'}),
# MACD Parameters
html.Div([
html.Label("MACD Parameters:", style={'font-weight': 'bold', 'margin-bottom': '10px'}),
html.Div([
html.Div([
html.Label("Fast:", style={'font-size': '12px'}),
dcc.Input(
id='macd-fast-input',
type='number',
value=12,
min=5, max=50,
style={'width': '60px', 'margin-left': '5px'}
)
], style={'display': 'inline-block', 'margin-right': '15px'}),
html.Div([
html.Label("Slow:", style={'font-size': '12px'}),
dcc.Input(
id='macd-slow-input',
type='number',
value=26,
min=10, max=100,
style={'width': '60px', 'margin-left': '5px'}
)
], style={'display': 'inline-block', 'margin-right': '15px'}),
html.Div([
html.Label("Signal:", style={'font-size': '12px'}),
dcc.Input(
id='macd-signal-input',
type='number',
value=9,
min=3, max=20,
style={'width': '60px', 'margin-left': '5px'}
)
], style={'display': 'inline-block'})
])
], style={'margin-bottom': '20px'}),
# Bollinger Bands Parameters
html.Div([
html.Label("Bollinger Bands:", style={'font-weight': 'bold', 'margin-bottom': '10px'}),
html.Div([
html.Div([
html.Label("Period:", style={'font-size': '12px'}),
dcc.Input(
id='bb-period-input',
type='number',
value=20,
min=5, max=50,
style={'width': '60px', 'margin-left': '5px'}
)
], style={'display': 'inline-block', 'margin-right': '15px'}),
html.Div([
html.Label("Std Dev:", style={'font-size': '12px'}),
dcc.Input(
id='bb-stddev-input',
type='number',
value=2.0,
min=1.0, max=3.0, step=0.1,
style={'width': '70px', 'margin-left': '5px'}
)
], style={'display': 'inline-block'})
])
])
], style={
'border': '1px solid #bdc3c7',
'border-radius': '8px',
'padding': '15px',
'background-color': '#f8f9fa',
'margin-bottom': '20px'
})
def create_auto_update_control():
"""Create the auto-update control section."""
return html.Div([

View File

@ -10,7 +10,6 @@ from components.charts.indicator_manager import get_indicator_manager
from components.charts.indicator_defaults import ensure_default_indicators
from dashboard.components.chart_controls import (
create_chart_config_panel,
create_parameter_controls,
create_auto_update_control
)
@ -76,7 +75,6 @@ def get_market_data_layout():
# Create components using the new modular functions
chart_config_panel = create_chart_config_panel(strategy_options, overlay_options, subplot_options)
parameter_controls = create_parameter_controls()
auto_update_control = create_auto_update_control()
return html.Div([
@ -110,9 +108,6 @@ def get_market_data_layout():
# Chart Configuration Panel
chart_config_panel,
# Parameter Controls Section
parameter_controls,
# Auto-update control
auto_update_control,

View File

@ -7,6 +7,7 @@ requires-python = ">=3.10"
dependencies = [
# Core web framework
"dash>=2.14.0",
"dash-mantine-components>=0.12.0",
"plotly>=5.17.0",
# Database
"sqlalchemy>=2.0.0",

View File

@ -75,14 +75,14 @@ Implementation of a flexible, strategy-driven chart system that supports technic
- [x] 3.6 Add enhanced error handling and user guidance for missing strategies and indicators
- [x] 3.7 Unit test configuration system and validation
- [x] 4.0 Dashboard Integration and UI Controls **✅ COMPLETED**
- [x] 4.0 Dashboard Integration and UI Controls
- [x] 4.1 Add indicator selection checkboxes to dashboard layout
- [x] 4.2 Create real-time chart updates with indicator toggling
- [x] 4.3 Implement parameter adjustment controls for indicators
- [x] 4.4 Add strategy selection dropdown for predefined configurations **✅ WORKING**
- [x] 4.5 Update chart callback functions to handle new layer system **✅ COMPLETED - Modular callbacks**
- [x] 4.6 Ensure backward compatibility with existing dashboard features **✅ COMPLETED**
- [x] 4.7 Test dashboard integration with real market data **✅ COMPLETED - Confirmed working**
- [x] 4.4 Add strategy selection dropdown for predefined configurations
- [x] 4.5 Update chart callback functions to handle new layer system
- [x] 4.6 Ensure backward compatibility with existing dashboard features
- [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
@ -94,13 +94,13 @@ Implementation of a flexible, strategy-driven chart system that supports technic
- [ ] 5.7 Create foundation tests for signal layer functionality
- [ ] 6.0 Documentation **⏳ IN PROGRESS**
- [x] 6.1 Create documentation for the chart layers system **✅ COMPLETED**
- [x] 6.1 Create documentation for the chart layers system
- [ ] 6.2 Add documentation to the README
- [x] 6.3 Create documentation for the ChartBuilder class **✅ COMPLETED**
- [x] 6.4 Create documentation for the ChartUtils class **✅ COMPLETED**
- [x] 6.5 Create documentation for the ChartConfig package **✅ COMPLETED**
- [x] 6.6 Create documentation how to add new indicators **✅ COMPLETED**
- [x] 6.7 Create documentation how to add new strategies **✅ COMPLETED**
- [x] 6.3 Create documentation for the ChartBuilder class
- [x] 6.4 Create documentation for the ChartUtils class
- [x] 6.5 Create documentation for the ChartConfig package
- [x] 6.6 Create documentation how to add new indicators
- [x] 6.7 Create documentation how to add new strategies
## Current Status
@ -108,7 +108,7 @@ Implementation of a flexible, strategy-driven chart system that supports technic
- **1.0 Foundation Infrastructure**: Fully implemented with modular charts system
- **2.0 Indicator Layer System**: Complete implementation with all indicator types
- **3.0 Strategy Configuration**: Comprehensive strategy system with validation
- **4.0 Dashboard Integration**: **FULLY COMPLETED** including modular dashboard structure
- **4.0 Dashboard Integration**: Including modular dashboard structure
### 🎯 **KEY ACHIEVEMENTS**
- **Strategy dropdown**: Fully functional with auto-loading of strategy indicators

14
uv.lock generated
View File

@ -388,6 +388,18 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/0d/20/2e7ab37ea2ef1f8b2592a2615c8b3fb041ad51f32101061d8bc6465b8b40/dash-3.0.4-py3-none-any.whl", hash = "sha256:177f8c3d1fa45555b18f2f670808eba7803c72a6b1cd6fd172fd538aca18eb1d", size = 7935680 },
]
[[package]]
name = "dash-mantine-components"
version = "2.0.0"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "dash" },
]
sdist = { url = "https://files.pythonhosted.org/packages/2c/1e/535c8312f038ea688171435cefd8b5b03452353646e43bade5d92a8d9da0/dash_mantine_components-2.0.0.tar.gz", hash = "sha256:2e09b7f60b41483a06d270c621b5f23a1a9c9321a7f60d2e2b631cde493456cb", size = 850199 }
wheels = [
{ url = "https://files.pythonhosted.org/packages/77/45/a1acd23b37af85c8b824ccb3e3e4232900725830a652b762ed0c67afec2a/dash_mantine_components-2.0.0-py3-none-any.whl", hash = "sha256:e084ba1fac9a9ad8672852047d0a97dc3cd7372677d1fa55ef8e655a664fa271", size = 1262158 },
]
[[package]]
name = "dashboard"
version = "0.1.0"
@ -397,6 +409,7 @@ dependencies = [
{ name = "alembic" },
{ name = "click" },
{ name = "dash" },
{ name = "dash-mantine-components" },
{ name = "numpy" },
{ name = "pandas" },
{ name = "plotly" },
@ -441,6 +454,7 @@ requires-dist = [
{ name = "black", marker = "extra == 'dev'", specifier = ">=23.0.0" },
{ name = "click", specifier = ">=8.0.0" },
{ name = "dash", specifier = ">=2.14.0" },
{ name = "dash-mantine-components", specifier = ">=0.12.0" },
{ name = "flake8", marker = "extra == 'dev'", specifier = ">=6.0.0" },
{ name = "isort", marker = "extra == 'dev'", specifier = ">=5.12.0" },
{ name = "mypy", marker = "extra == 'dev'", specifier = ">=1.5.0" },