- Deleted `app_new.py`, which was previously the main entry point for the dashboard application, to streamline the codebase. - Consolidated the application initialization and callback registration logic into `main.py`, enhancing modularity and maintainability. - Updated the logging and error handling practices in `main.py` to ensure consistent application behavior and improved debugging capabilities. These changes simplify the application structure, aligning with project standards for modularity and maintainability.
157 lines
3.5 KiB
Python
157 lines
3.5 KiB
Python
"""
|
|
Modular Chart System for Crypto Trading Bot Dashboard
|
|
|
|
This package provides a flexible, strategy-driven chart system that supports:
|
|
- Technical indicator overlays (SMA, EMA, Bollinger Bands)
|
|
- Subplot management (RSI, MACD)
|
|
- Strategy-specific configurations
|
|
- Future bot signal integration
|
|
|
|
Main Components:
|
|
- ChartBuilder: Main orchestrator for chart creation
|
|
- Layer System: Modular rendering components
|
|
- Configuration System: Strategy-driven chart configs
|
|
"""
|
|
|
|
import plotly.graph_objects as go
|
|
from typing import List
|
|
from .builder import ChartBuilder
|
|
from .utils import (
|
|
validate_market_data,
|
|
prepare_chart_data,
|
|
get_indicator_colors
|
|
)
|
|
from .config import (
|
|
get_available_indicators,
|
|
calculate_indicators,
|
|
get_overlay_indicators,
|
|
get_subplot_indicators,
|
|
get_indicator_display_config
|
|
)
|
|
from .data_integration import (
|
|
MarketDataIntegrator,
|
|
DataIntegrationConfig,
|
|
get_market_data_integrator,
|
|
fetch_indicator_data,
|
|
check_symbol_data_quality
|
|
)
|
|
from .error_handling import (
|
|
ChartErrorHandler,
|
|
ChartError,
|
|
ErrorSeverity,
|
|
InsufficientDataError,
|
|
DataValidationError,
|
|
IndicatorCalculationError,
|
|
DataConnectionError,
|
|
check_data_sufficiency,
|
|
get_error_message,
|
|
create_error_annotation
|
|
)
|
|
from .chart_data import (
|
|
get_supported_symbols,
|
|
get_supported_timeframes,
|
|
get_market_statistics,
|
|
check_data_availability,
|
|
create_data_status_indicator
|
|
)
|
|
from .chart_creation import (
|
|
create_candlestick_chart,
|
|
create_strategy_chart,
|
|
create_error_chart,
|
|
create_basic_chart,
|
|
create_indicator_chart,
|
|
create_chart_with_indicators
|
|
)
|
|
|
|
# Layer imports with error handling
|
|
from .layers.base import (
|
|
LayerConfig,
|
|
BaseLayer,
|
|
CandlestickLayer,
|
|
VolumeLayer,
|
|
LayerManager
|
|
)
|
|
|
|
from .layers.indicators import (
|
|
IndicatorLayerConfig,
|
|
BaseIndicatorLayer,
|
|
SMALayer,
|
|
EMALayer,
|
|
BollingerBandsLayer
|
|
)
|
|
|
|
from .layers.subplots import (
|
|
SubplotLayerConfig,
|
|
BaseSubplotLayer,
|
|
RSILayer,
|
|
MACDLayer
|
|
)
|
|
|
|
# Version information
|
|
__version__ = "0.1.0"
|
|
__package_name__ = "charts"
|
|
|
|
# Public API exports
|
|
__all__ = [
|
|
# Core components
|
|
"ChartBuilder",
|
|
"validate_market_data",
|
|
"prepare_chart_data",
|
|
"get_indicator_colors",
|
|
|
|
# Chart creation functions
|
|
"create_candlestick_chart",
|
|
"create_strategy_chart",
|
|
"create_empty_chart",
|
|
"create_error_chart",
|
|
"create_basic_chart",
|
|
"create_indicator_chart",
|
|
"create_chart_with_indicators",
|
|
|
|
# Data integration
|
|
"MarketDataIntegrator",
|
|
"DataIntegrationConfig",
|
|
"get_market_data_integrator",
|
|
"fetch_indicator_data",
|
|
"check_symbol_data_quality",
|
|
|
|
# Error handling
|
|
"ChartErrorHandler",
|
|
"ChartError",
|
|
"ErrorSeverity",
|
|
"InsufficientDataError",
|
|
"DataValidationError",
|
|
"IndicatorCalculationError",
|
|
"DataConnectionError",
|
|
"check_data_sufficiency",
|
|
"get_error_message",
|
|
"create_error_annotation",
|
|
|
|
# Data-related utility functions
|
|
"get_supported_symbols",
|
|
"get_supported_timeframes",
|
|
"get_market_statistics",
|
|
"check_data_availability",
|
|
"create_data_status_indicator",
|
|
|
|
# Base layers
|
|
"LayerConfig",
|
|
"BaseLayer",
|
|
"CandlestickLayer",
|
|
"VolumeLayer",
|
|
"LayerManager",
|
|
|
|
# Indicator layers
|
|
"IndicatorLayerConfig",
|
|
"BaseIndicatorLayer",
|
|
"SMALayer",
|
|
"EMALayer",
|
|
"BollingerBandsLayer",
|
|
|
|
# Subplot layers
|
|
"SubplotLayerConfig",
|
|
"BaseSubplotLayer",
|
|
"RSILayer",
|
|
"MACDLayer",
|
|
|
|
] |