108 Commits

Author SHA1 Message Date
Vasily.onl
5158d8a7d3 review project state and update tasks and context 2025-06-06 19:47:08 +08:00
Vasily.onl
d162368000 cursor rules updates 2025-06-06 19:26:59 +08:00
Vasily.onl
70714876bb finish custom indicators timeframe 2025-06-06 15:25:18 +08:00
Vasily.onl
b49e39dcb4 Implement multi-timeframe support for indicators
- Enhanced the `UserIndicator` class to include an optional `timeframe` attribute for custom indicator timeframes.
- Updated the `get_indicator_data` method in `MarketDataIntegrator` to fetch and calculate indicators based on the specified timeframe, ensuring proper data alignment and handling.
- Modified the `ChartBuilder` to pass the correct DataFrame for plotting indicators with different timeframes.
- Added UI elements in the indicator modal for selecting timeframes, improving user experience.
- Updated relevant JSON templates to include the new `timeframe` field for all indicators.
- Refactored the `prepare_chart_data` function to ensure it returns a DataFrame with a `DatetimeIndex` for consistent calculations.

This commit enhances the flexibility and usability of the indicator system, allowing users to analyze data across various timeframes.
2025-06-06 15:06:17 +08:00
Vasily.onl
58a754414a Removed Mantine for UI, and used bootstrap for simplicity 2025-06-06 13:33:59 +08:00
Vasily.onl
38cbf9cd2f 3.10 Enhance data analysis components with type conversion and UI improvements
- Added type conversion for relevant columns in `VolumeAnalyzer` and `PriceMovementAnalyzer` to ensure consistent data handling and avoid type errors.
- Refactored the `create_data_analysis_panel` function to implement a tabbed interface for volume and price movement analysis, improving user experience and organization of analysis tools.
- Updated styles in `indicator_modal.py` for better layout and responsiveness of the modal component.
- Marked unit testing of dashboard components as complete in the task list.
2025-06-06 13:13:11 +08:00
Vasily.onl
b4798bfc07 cursor rules 2025-06-06 13:11:45 +08:00
Vasily.onl
c121b469f0 3.9 Enhance chart functionality with indicator management and data export features
- Updated `ChartBuilder` to support dynamic indicator integration, allowing users to specify overlay and subplot indicators for enhanced chart analysis.
- Implemented a new `get_indicator_data` method in `MarketDataIntegrator` for fetching indicator data based on user configurations.
- Added `create_export_controls` in `chart_controls.py` to facilitate data export options (CSV/JSON) for user analysis.
- Enhanced error handling and logging throughout the chart and data analysis processes to improve reliability and user feedback.
- Updated documentation to reflect new features and usage guidelines for indicator management and data export functionalities.
2025-06-06 12:57:35 +08:00
Vasily.onl
8572a7a387 fixed 'store_raw_data' 2025-06-06 12:07:27 +08:00
Vasily.onl
85dc35c11d updated config to not store raw data, store 1s candles 2025-06-06 12:00:03 +08:00
Vasily.onl
74b83d77fc fix a bit time logic and refresh of the graph 2025-06-06 11:59:44 +08:00
Vasily.onl
87843a1d35 3. 7 Enhance chart functionality with time range controls and stability improvements
- Updated `app_new.py` to run the application in debug mode for stability.
- Introduced a new time range control panel in `dashboard/components/chart_controls.py`, allowing users to select predefined time ranges and custom date ranges.
- Enhanced chart callbacks in `dashboard/callbacks/charts.py` to handle time range inputs, ensuring accurate market statistics and analysis based on user selections.
- Implemented logic to preserve chart state during updates, preventing resets of zoom/pan settings.
- Updated market statistics display to reflect the selected time range, improving user experience and data relevance.
- Added a clear button for custom date ranges to reset selections easily.
- Enhanced documentation to reflect the new time range features and usage guidelines.
2025-06-05 12:54:41 +08:00
Vasily.onl
132710a9a7 3.6 Enhance market statistics with comprehensive data analysis features
- Updated `register_chart_callbacks` to include enhanced market statistics.
- Implemented new data analysis callbacks in `dashboard/callbacks/data_analysis.py` for volume and price movement analysis.
- Created `VolumeAnalyzer` and `PriceMovementAnalyzer` classes for detailed statistical calculations.
- Integrated data analysis components into the market statistics layout, providing users with insights on volume trends and price movements.
- Improved error handling and logging for data analysis operations.
- Updated documentation to reflect the new features and usage guidelines.
2025-06-05 11:24:21 +08:00
Vasily.onl
82f4e0ef48 3.5 Enhance system health monitoring dashboard with comprehensive market data tracking
- Added `psutil` dependency for system performance metrics.
- Implemented a new layout in `dashboard/layouts/system_health.py` using Mantine components for real-time monitoring of data collection services, database health, Redis status, and system performance.
- Enhanced callbacks in `dashboard/callbacks/system_health.py` for detailed status updates and error handling.
- Introduced quick status indicators for data collection, database, Redis, and performance metrics with auto-refresh functionality.
- Created modals for viewing detailed data collection information and service logs.
- Updated documentation to reflect the new features and usage guidelines.
2025-06-04 17:46:50 +08:00
Vasily.onl
8aa47731f2 docs 2025-06-04 17:05:39 +08:00
Vasily.onl
344c029f25 logs to default_logger 2025-06-04 17:03:35 +08:00
Vasily.onl
e57c33014f Add bot integration and enhanced signal layers for automated trading
- Introduced `BotIntegratedSignalLayer` and `BotIntegratedTradeLayer` to facilitate automated data fetching and visualization of bot signals and trades.
- Implemented `BotDataService` for efficient retrieval of bot-related data, including filtering and performance summaries.
- Added support for various bot-enhanced layers, including support/resistance and custom strategy layers, to improve trading analysis.
- Updated existing signal layer components to integrate with the new bot functionalities, ensuring seamless operation.
- Enhanced logging and error handling for better debugging and user feedback during bot operations.
- Included comprehensive tests for new functionalities to ensure reliability and maintainability.
- Updated documentation to reflect the new bot integration features and usage guidelines.
2025-06-04 17:03:09 +08:00
Vasily.onl
5506f5db64 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.
2025-06-04 15:54:14 +08:00
Vasily.onl
cdee9f04d6 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.
2025-06-04 15:30:50 +08:00
Vasily.onl
010adb30f0 Implement modular architecture for Crypto Trading Bot Dashboard
- Introduced a new modular structure for the dashboard, enhancing maintainability and scalability.
- Created main application entry point in `app_new.py`, integrating all components and callbacks.
- Developed layout modules for market data, bot management, performance analytics, and system health in the `layouts` directory.
- Implemented callback modules for navigation, charts, indicators, and system health in the `callbacks` directory.
- Established reusable UI components in the `components` directory, including chart controls and indicator modals.
- Enhanced documentation to reflect the new modular structure and provide clear usage guidelines.
- Ensured all components are under 300-400 lines for better readability and maintainability.
2025-06-04 13:30:16 +08:00
Vasily.onl
476bd67f14 3.4 Implement user-defined indicator management system and enhance chart capabilities
- Introduced a comprehensive user indicator management system in `components/charts/indicator_manager.py`, allowing users to create, edit, and manage custom indicators with JSON persistence.
- Added new default indicators in `components/charts/indicator_defaults.py` to provide users with immediate options for technical analysis.
- Enhanced the chart rendering capabilities by implementing the `create_chart_with_indicators` function in `components/charts/builder.py`, supporting both overlay and subplot indicators.
- Updated the main application layout in `app.py` to include a modal for adding and editing indicators, improving user interaction.
- Enhanced documentation to cover the new indicator system, including a quick guide for adding new indicators and detailed usage examples.
- Added unit tests to ensure the reliability and functionality of the new indicator management features.
2025-06-04 13:01:57 +08:00
Vasily.onl
d71cb763bc 3.4 - 3.0 Strategy Configuration System
Implement comprehensive chart configuration and validation system

- Introduced a modular chart configuration system in `components/charts/config/` to manage indicator definitions, default configurations, and strategy-specific setups.
- Added new modules for error handling and validation, enhancing user guidance and error reporting capabilities.
- Implemented detailed schema validation for indicators and strategies, ensuring robust configuration management.
- Created example strategies and default configurations to facilitate user onboarding and usage.
- Enhanced documentation to provide clear guidelines on the configuration system, validation rules, and usage examples.
- Added unit tests for all new components to ensure functionality and reliability across the configuration system.
2025-06-03 14:33:25 +08:00
Vasily.onl
a969defe1f 3.4 -2.0 Indicator Layer System Implementation
Implement modular chart layers and error handling for Crypto Trading Bot Dashboard

- Introduced a comprehensive chart layer system in `components/charts/layers/` to support various technical indicators and subplots.
- Added base layer components including `BaseLayer`, `CandlestickLayer`, and `VolumeLayer` for flexible chart rendering.
- Implemented overlay indicators such as `SMALayer`, `EMALayer`, and `BollingerBandsLayer` with robust error handling.
- Created subplot layers for indicators like `RSILayer` and `MACDLayer`, enhancing visualization capabilities.
- Developed a `MarketDataIntegrator` for seamless data fetching and validation, improving data quality assurance.
- Enhanced error handling utilities in `components/charts/error_handling.py` to manage insufficient data scenarios effectively.
- Updated documentation to reflect the new chart layer architecture and usage guidelines.
- Added unit tests for all chart layer components to ensure functionality and reliability.
2025-06-03 13:56:15 +08:00
Vasily.onl
371c0a4591 Eliminates the "coroutine was never awaited" warnings
 Properly handles lock acquisition with timeout
 Maintains the same functionality (timeout protection for lock acquisition)
 Ensures proper lock cleanup in the finally block
2025-06-03 13:11:51 +08:00
Vasily.onl
c4ec3fac9f 3.4 Enhance logging and modular chart system for Crypto Trading Bot Dashboard
- Suppressed SQLAlchemy logging in `app.py` and `main.py` to reduce console verbosity.
- Introduced a new modular chart system in `components/charts/` with a `ChartBuilder` class for flexible chart creation.
- Added utility functions for data processing and validation in `components/charts/utils.py`.
- Implemented indicator definitions and configurations in `components/charts/config/indicator_defs.py`.
- Created a comprehensive documentation structure for the new chart system, ensuring clarity and maintainability.
- Added unit tests for the `ChartBuilder` class to verify functionality and robustness.
- Updated existing components to integrate with the new chart system, enhancing overall architecture and user experience.
2025-06-03 12:49:46 +08:00
Vasily.onl
720002a441 3.1 - 3.3 Add main Dash application for Crypto Trading Bot Dashboard
- Introduced `app.py` as the main entry point for the dashboard, providing real-time visualization and bot management interface.
- Implemented layout components including header, navigation tabs, and content areas for market data, bot management, performance analytics, and system health.
- Added callbacks for dynamic updates of market data charts and statistics, ensuring real-time interaction.
- Created reusable UI components in `components` directory for modularity and maintainability.
- Enhanced database operations for fetching market data and checking data availability.
- Updated `main.py` to start the dashboard application with improved user instructions and error handling.
- Documented components and functions for clarity and future reference.
2025-06-03 12:09:37 +08:00
Vasily.onl
74d7e1ab2c docs 2025-06-03 12:08:43 +08:00
Vasily.onl
d508616677 fix recursion error on reconnection 2025-06-03 11:42:10 +08:00
Vasily.onl
01cea1d5e5 Enhance OKX WebSocket client with improved task management and error handling
- Implemented enhanced task synchronization to prevent race conditions during WebSocket operations.
- Introduced reconnection locking to avoid concurrent reconnection attempts.
- Improved error handling in message processing and reconnection logic, ensuring graceful shutdown and task management.
- Added unit tests to verify the stability and reliability of the WebSocket client under concurrent operations.
2025-06-02 23:14:04 +08:00
Vasily.onl
aaebd9a308 2.9 Implement unit tests for data collection and aggregation logic
- Marked task 2.9 as complete in the project documentation by adding comprehensive unit tests for data collection and aggregation functionality.
- Created `test_data_collection_aggregation.py` to cover OKX data collection, real-time candle aggregation, data validation, and transformation.
- Included tests for error handling, edge cases, and performance to ensure robustness and reliability of the data processing components.
- Enhanced documentation within the test module to provide clarity on the testing approach and coverage.
2025-06-02 14:44:50 +08:00
Vasily.onl
1cca8cda16 Remove complete time series aggregation example and add data collection service implementation
- Deleted `example_complete_series_aggregation.py` as it is no longer needed.
- Introduced `data_collection_service.py`, a production-ready service for cryptocurrency market data collection with clean logging and robust error handling.
- Added configuration management for multiple trading pairs and exchanges, supporting health monitoring and graceful shutdown.
- Created `data_collection.json` for service configuration, including exchange settings and logging preferences.
- Updated `CandleProcessingConfig` to reflect changes in timeframes for candle processing.
- Enhanced documentation to cover the new data collection service and its configuration, ensuring clarity for users.
2025-06-02 14:23:08 +08:00
Vasily.onl
24b6a3feed Add technical indicators module for OHLCV data analysis
- Introduced `indicators.py` containing implementations for SMA, EMA, RSI, MACD, and Bollinger Bands, optimized for handling sparse OHLCV data.
- Added `IndicatorResult` dataclass to encapsulate results of indicator calculations.
- Implemented methods for calculating multiple indicators efficiently with JSON configuration support and validation.
- Updated `__init__.py` to include new indicators in the module's exports.
- Enhanced documentation to cover the new technical indicators module, including usage examples and integration details.
- Added comprehensive unit tests to ensure accuracy and robustness of the indicators module.
2025-06-02 13:42:00 +08:00
Vasily.onl
cffc54b648 Add complete time series aggregation example and refactor OKXCollector for repository pattern
- Introduced `example_complete_series_aggregation.py` to demonstrate time series aggregation, emitting candles even when no trades occur.
- Implemented `CompleteSeriesProcessor` extending `RealTimeCandleProcessor` to handle time-based candle emission and empty candle creation.
- Refactored `OKXCollector` to utilize the new repository pattern for database operations, enhancing modularity and maintainability.
- Updated database operations to centralize data handling through `DatabaseOperations`, improving error handling and logging.
- Enhanced documentation to include details on the new aggregation example and repository pattern implementation, ensuring clarity for users.
2025-06-02 13:27:01 +08:00
Vasily.onl
5b4547edd5 Add force_update_candles configuration to OKX data collector
- Introduced `force_update_candles` option in `okx_config.json` to control candle update behavior.
- Updated `OKXCollector` to handle candle storage based on the `force_update_candles` setting, allowing for either updating existing records or preserving them.
- Enhanced logging to reflect the action taken during candle storage, improving traceability.
- Updated database schema to include `updated_at` timestamp for better tracking of data changes.
2025-06-02 12:41:31 +08:00
Vasily.onl
02a51521a0 Update OKX configuration and aggregation logic for enhanced multi-timeframe support
- Increased health check interval from 30s to 120s in `okx_config.json`.
- Added support for additional timeframes (1s, 5s, 10s, 15s, 30s) in the aggregation logic across multiple components.
- Updated `CandleProcessingConfig` and `RealTimeCandleProcessor` to handle new timeframes.
- Enhanced validation and parsing functions to include new second-based timeframes.
- Updated database schema to support new timeframes in `schema_clean.sql`.
- Improved documentation to reflect changes in multi-timeframe aggregation capabilities.
2025-06-02 12:35:19 +08:00
Vasily.onl
cecb5fd411 Enhance OKXCollector with improved heartbeat and logging functionality
- Added logger parameter to the OKXCollector to enable detailed ping/pong logging.
- Updated message processing methods to maintain heartbeat and track data reception timestamps.
- Adjusted ProductionManager to disable auto-restart and enable full logging for debugging WebSocket issues.
- Enhanced overall logging capabilities to facilitate better monitoring and troubleshooting of data collection processes.
2025-06-02 12:09:34 +08:00
Vasily.onl
bc13cfcbe0 Enhance logging capabilities across data collection components
- Added optional logger parameter to various classes including `BaseDataCollector`, `CollectorManager`, `RealTimeCandleProcessor`, and `BatchCandleProcessor` to support conditional logging.
- Implemented error-only logging mode, allowing components to log only error and critical messages when specified.
- Updated logging calls to utilize new helper methods for improved readability and maintainability.
- Enhanced documentation to include details on the new logging system and its usage across components.
- Ensured that child components inherit the logger from their parent components for consistent logging behavior.
2025-06-01 14:42:29 +08:00
Vasily.onl
0697be75da Add clean monitoring and production data collection scripts
- Introduced `monitor_clean.py` for monitoring database status with detailed logging and status updates.
- Added `production_clean.py` for running OKX data collection with minimal console output and comprehensive logging.
- Implemented command-line argument parsing for both scripts to customize monitoring intervals and collection durations.
- Enhanced logging capabilities to provide clear insights into data collection and monitoring processes.
- Updated documentation to include usage examples and descriptions for the new scripts, ensuring clarity for users.
2025-05-31 22:30:56 +08:00
Vasily.onl
8bb5f28fd2 Add common data processing framework for OKX exchange
- Introduced a modular architecture for data processing, including common utilities for validation, transformation, and aggregation.
- Implemented `StandardizedTrade`, `OHLCVCandle`, and `TimeframeBucket` classes for unified data handling across exchanges.
- Developed `OKXDataProcessor` for OKX-specific data validation and processing, leveraging the new common framework.
- Enhanced `OKXCollector` to utilize the common data processing utilities, improving modularity and maintainability.
- Updated documentation to reflect the new architecture and provide guidance on the data processing framework.
- Created comprehensive tests for the new data processing components to ensure reliability and functionality.
2025-05-31 21:58:47 +08:00
Vasily.onl
fa63e7eb2e documentation 2025-05-31 20:55:52 +08:00
Vasily.onl
4510181b39 Add OKX data collector implementation and modular exchange architecture
- Introduced the `OKXCollector` and `OKXWebSocketClient` classes for real-time market data collection from the OKX exchange.
- Implemented a factory pattern for creating exchange-specific collectors, enhancing modularity and scalability.
- Added configuration support for the OKX collector in `config/okx_config.json`.
- Updated documentation to reflect the new modular architecture and provide guidance on using the OKX collector.
- Created unit tests for the OKX collector and exchange factory to ensure functionality and reliability.
- Enhanced logging and error handling throughout the new implementation for improved monitoring and debugging.
2025-05-31 20:49:31 +08:00
Vasily.onl
4936e5cd73 Implement enhanced data collection system with health monitoring and management
- Introduced `BaseDataCollector` and `CollectorManager` classes for standardized data collection and centralized management.
- Added health monitoring features, including auto-restart capabilities and detailed status reporting for collectors.
- Updated `env.template` to include new logging and health check configurations.
- Enhanced documentation in `docs/data_collectors.md` to provide comprehensive guidance on the new data collection system.
- Added unit tests for `BaseDataCollector` and `CollectorManager` to ensure reliability and functionality.
2025-05-30 20:33:56 +08:00
Vasily.onl
b7263b023f Enhance logging system and update dependencies
- Updated `.gitignore` to exclude log files from version control.
- Added `pytest` as a dependency in `pyproject.toml` for testing purposes.
- Included `pytest` in `uv.lock` to ensure consistent dependency management.
- Introduced comprehensive documentation for the new unified logging system in `docs/logging.md`, detailing features, usage, and configuration options.
2025-05-30 19:54:56 +08:00
Vasily.onl
8a378c8d69 Add Alembic migration system for database schema versioning
- Introduced `alembic.ini` for Alembic configuration, enabling structured database migrations.
- Created `database/migrations/env.py` to manage migration environment and database URL retrieval.
- Added migration script template `database/migrations/script.py.mako` for generating migration scripts.
- Updated `.gitignore` to exclude migration versions from version control.
- Enhanced `setup.md` documentation to include details on the migration system and commands for managing migrations.
2025-05-30 18:33:23 +08:00
Vasily.onl
dd75546508 Add Redis connection utility for pub/sub messaging
- Introduced `database/redis_manager.py` to manage Redis connections, including synchronous and asynchronous clients.
- Implemented pub/sub messaging capabilities for real-time data distribution, with structured channel definitions for market data, bot signals, and system health.
- Added configuration options for Redis connection pooling and error handling, ensuring robust integration with the Crypto Trading Bot Platform.
2025-05-30 18:27:32 +08:00
Vasily.onl
73b7e8bb9d Refactor database configuration and schema for Crypto Trading Bot Platform
- Updated `docker-compose.yml` to remove hardcoded passwords, relying on environment variables for PostgreSQL and Redis configurations.
- Modified `env.template` to reflect new password settings and ensure secure handling of sensitive information.
- Introduced a new `database/connection.py` file for improved database connection management, including connection pooling and session handling.
- Updated `database/models.py` to align with the new schema in `schema_clean.sql`, utilizing JSONB for optimized data storage.
- Enhanced `setup.md` documentation to clarify the initialization process and emphasize the importance of the `.env` file for configuration.
- Added a new `scripts/init_database.py` script for automated database initialization and verification, ensuring all tables are created as expected.
2025-05-30 18:20:38 +08:00
Vasily.onl
8121ce0430 Update database schema and configuration for Crypto Trading Bot Platform
- Added new SQLAlchemy models in `database/models.py` for market data, trades, bots, signals, and performance tracking.
- Updated `docker-compose.yml` to use TimescaleDB for PostgreSQL and configured shared preload libraries.
- Created new schema files: `schema.sql` for the complete database setup and `schema_clean.sql` for a simplified version without hypertables.
- Updated documentation in `setup.md` to reflect changes in database initialization and service setup.
2025-05-30 17:45:57 +08:00
Vasily.onl
692611d3ae init setup 2025-05-30 17:27:32 +08:00
Vasily.onl
3e4a965895 PRD tasks 2025-05-30 17:06:41 +08:00
Vasily.onl
4e46c82ff1 PRD 2025-05-30 16:43:09 +08:00