TCPDashboard/dashboard/callbacks/data_analysis.py

49 lines
2.0 KiB
Python
Raw Normal View History

"""
Data analysis callbacks for the dashboard.
"""
from dash import Output, Input, html, dcc
import dash_mantine_components as dmc
from utils.logger import get_logger
from dashboard.components.data_analysis import (
VolumeAnalyzer,
PriceMovementAnalyzer,
create_volume_analysis_chart,
create_price_movement_chart,
create_volume_stats_display,
create_price_stats_display
)
logger = get_logger("data_analysis_callbacks")
def register_data_analysis_callbacks(app):
"""Register data analysis related callbacks."""
logger.info("🚀 STARTING to register data analysis callbacks...")
# Initial callback to populate charts on load
@app.callback(
[Output('analysis-chart-container', 'children'),
Output('analysis-stats-container', 'children')],
[Input('analysis-type-selector', 'value'),
Input('analysis-period-selector', 'value')],
prevent_initial_call=False
)
def update_data_analysis(analysis_type, period):
"""Update data analysis with statistical cards only (no duplicate charts)."""
logger.info(f"🎯 DATA ANALYSIS CALLBACK TRIGGERED! Type: {analysis_type}, Period: {period}")
# Return placeholder message since we're moving to enhanced market stats
info_msg = html.Div([
html.H4("📊 Statistical Analysis"),
html.P("Data analysis has been integrated into the Market Statistics section above."),
html.P("The enhanced statistics now include volume analysis, price movement analysis, and trend indicators."),
html.P("Change the symbol and timeframe in the main chart to see updated analysis."),
html.Hr(),
html.Small("This section will be updated with additional analytical tools in future versions.")
], style={'border': '2px solid #17a2b8', 'padding': '20px', 'margin': '10px', 'background-color': '#d1ecf1'})
return info_msg, html.Div()
logger.info("✅ Data analysis callbacks registered successfully")