89 Commits

Author SHA1 Message Date
Ajasra
5ef12c650b task 2025-05-29 17:04:02 +08:00
Ajasra
5614520c58 Enhance backtesting performance and data handling
- Introduced DataCache utility for optimized data loading, reducing redundant I/O operations during strategy execution.
- Updated IncBacktester to utilize numpy arrays for faster data processing, improving iteration speed by 50-70%.
- Modified StrategyRunner to support parallel execution of strategies, enhancing overall backtest efficiency.
- Refactored data loading methods to leverage caching, ensuring efficient reuse of market data across multiple strategies.
2025-05-29 15:21:19 +08:00
Ajasra
fc7e8e9f8a plot optimisation to reduce points 2025-05-29 14:45:11 +08:00
Ajasra
d8cc1a3192 parameter optimisation for strategies (can run a matrix of strategy with different parameters) 2025-05-29 14:23:18 +08:00
Ajasra
df19ef32db bactester for strategies 2025-05-29 14:22:50 +08:00
Ajasra
b0ea701020 Enhance DataLoader and MinuteDataBuffer for improved data handling
- Added error handling in DataLoader to attempt reading CSV files with a fallback to the Python engine if the default engine fails.
- Converted numpy float32 columns to Python float for compatibility in DataLoader.
- Updated MinuteDataBuffer to accept both Python and numpy numeric types, ensuring consistent data validation and conversion.
2025-05-29 14:21:16 +08:00
Ajasra
790bd9ccdd exposing parameters for metatrand too 2025-05-29 13:05:44 +08:00
Ajasra
6195e6b1e9 added tqdm 2025-05-29 12:37:11 +08:00
Ajasra
a99ed50cfe cleanup of the old Incremental trader after refactopring 2025-05-29 00:28:48 +08:00
Ajasra
54e3f5677a cleaning up 2025-05-29 00:11:57 +08:00
Ajasra
b9836efab7 testing strategies consistency after migration
- clean up test folder from old tests
2025-05-29 00:09:11 +08:00
Ajasra
16a3b7af99 indicators comparison test (before and after refactoring) 2025-05-28 23:18:11 +08:00
Ajasra
5c6e0598c0 documentation 2025-05-28 22:37:53 +08:00
Vasily.onl
1861c336f9 TimeFrame agregator with right logic 2025-05-28 18:26:51 +08:00
Vasily.onl
78ccb15fda cursor rules 2025-05-28 18:25:13 +08:00
Vasily.onl
c9ae507bb7 Implement Incremental Trading Framework
- Introduced a comprehensive framework for incremental trading strategies, including modules for strategy execution, backtesting, and data processing.
- Added key components such as `IncTrader`, `IncBacktester`, and various trading strategies (e.g., `MetaTrendStrategy`, `BBRSStrategy`, `RandomStrategy`) to facilitate real-time trading and backtesting.
- Implemented a robust backtesting framework with configuration management, parallel execution, and result analysis capabilities.
- Developed an incremental indicators framework to support real-time data processing with constant memory usage.
- Enhanced documentation to provide clear usage examples and architecture overview, ensuring maintainability and ease of understanding for future development.
- Ensured compatibility with existing strategies and maintained a focus on performance and scalability throughout the implementation.
2025-05-28 16:29:48 +08:00
Ajasra
8055f46328 ok, kind of incremental trading and backtester, but result not alligning 2025-05-27 16:51:43 +08:00
Vasily.onl
ed6d668a8a delete test file 2025-05-26 17:13:35 +08:00
Vasily.onl
bff3413eed documentation 2025-05-26 17:11:19 +08:00
Vasily.onl
49a57df887 Implement Timeframe Aggregation in Incremental Strategy Base
- Introduced `TimeframeAggregator` class for real-time aggregation of minute-level data to higher timeframes, enhancing the `IncStrategyBase` functionality.
- Updated `IncStrategyBase` to include `update_minute_data()` method, allowing strategies to process minute-level OHLCV data seamlessly.
- Enhanced existing strategies (`IncMetaTrendStrategy`, `IncRandomStrategy`) to utilize the new aggregation features, simplifying their implementations and improving performance.
- Added comprehensive documentation in `IMPLEMENTATION_SUMMARY.md` detailing the new architecture and usage examples for the aggregation feature.
- Updated performance metrics and logging to monitor minute data processing effectively.
- Ensured backward compatibility with existing `update()` methods, maintaining functionality for current strategies.
2025-05-26 16:56:42 +08:00
Vasily.onl
bd6a0f05d7 Implement Incremental BBRS Strategy for Real-time Data Processing
- Introduced `BBRSIncrementalState` for real-time processing of the Bollinger Bands + RSI strategy, allowing minute-level data input and internal timeframe aggregation.
- Added `TimeframeAggregator` class to handle real-time data aggregation to higher timeframes (15min, 1h, etc.).
- Updated `README_BBRS.md` to document the new incremental strategy, including key features and usage examples.
- Created comprehensive tests to validate the incremental strategy against the original implementation, ensuring signal accuracy and performance consistency.
- Enhanced error handling and logging for better monitoring during real-time processing.
- Updated `TODO.md` to reflect the completion of the incremental BBRS strategy implementation.
2025-05-26 16:46:04 +08:00
Vasily.onl
ba78539cbb Add incremental MetaTrend strategy implementation
- Introduced `IncMetaTrendStrategy` for real-time processing of the MetaTrend trading strategy, utilizing three Supertrend indicators.
- Added comprehensive documentation in `METATREND_IMPLEMENTATION.md` detailing architecture, key components, and usage examples.
- Updated `__init__.py` to include the new strategy in the strategy registry.
- Created tests to compare the incremental strategy's signals against the original implementation, ensuring mathematical equivalence.
- Developed visual comparison scripts to analyze performance and signal accuracy between original and incremental strategies.
2025-05-26 16:09:32 +08:00
Vasily.onl
b1f80099fe test on original data 2025-05-26 14:55:03 +08:00
Vasily.onl
3e94387dcb tested and updated supertrand indicators to give us the same result as in original strategy 2025-05-26 14:45:44 +08:00
Vasily.onl
9376e13888 random strategy 2025-05-26 13:26:16 +08:00
Vasily.onl
d985830ecd indicators 2025-05-26 13:26:07 +08:00
Vasily.onl
e89317c65e incremental strategy realisation 2025-05-26 13:25:56 +08:00
Ajasra
d499c5b8d0 Add RandomStrategy implementation and update strategy manager 2025-05-25 18:42:47 +08:00
Ajasra
2418538747 Update dependencies and configuration files
- Added new dependencies: `plotly`, `websocket`, `cffi`, `gevent`, `greenlet`, and `narwhals` to `pyproject.toml` and `uv.lock`.
- Updated `.gitignore` to exclude the `frontend/` directory.
- Modified configuration files to set `start_date` to `2025-01-01` in `config_bbrs.json` and `config_default.json`, with `stop_date` set to `null` in both.
- Introduced a new project metadata file `.cursor/project.mdc` for project documentation and management.
2025-05-25 15:39:10 +08:00
65ae3060de revert b71faa97589d220e5046b4d530d1660f6f0abe9a
revert refactor for modularity
2025-05-23 12:47:59 +00:00
Ajasra
b71faa9758 refactor for modularity 2025-05-23 20:37:14 +08:00
Ajasra
c743e81af8 renaming for bb_rsi 2025-05-23 20:15:15 +08:00
Vasily.onl
969e011d48 if stop_date null in config it would use current date 2025-05-23 18:02:55 +08:00
Vasily.onl
cb576a9dfc Merge branch 'main' of https://dep.sokaris.link/Simon/Cycles 2025-05-23 17:55:17 +08:00
Vasily.onl
ebd8ef3d87 refactor to remove rebundant parameters and use just a config file by default too 2025-05-23 17:55:13 +08:00
Simon Moisy
1566044fa8 Merge branch 'main' of ssh://dep.sokaris.link:2222/Simon/Cycles 2025-05-23 17:17:20 +08:00
Simon Moisy
3483aaf6d7 Add CryptoComTrader class and main execution script for trading operations
- Introduced the CryptoComTrader class to handle WebSocket connections for real-time trading data and operations.
- Implemented methods for fetching price, order book, user balance, and placing orders.
- Added functionality to retrieve candlestick data and available trading instruments.
- Created a main script to initialize the trader, fetch instruments, and display candlestick data in a loop.
- Integrated Plotly for visualizing candlestick data, enhancing user interaction and data representation.
2025-05-23 17:14:26 +08:00
Vasily.onl
256ad67742 refactor 2025-05-23 17:14:08 +08:00
Vasily.onl
f67b6b8ebd removed strategy stuff from here 2025-05-23 17:13:12 +08:00
Vasily.onl
9629d3090b Enhance README and documentation for Cycles framework
- Expanded the README.md to provide a comprehensive overview of the Cycles framework, including features, quick start instructions, and configuration examples.
- Updated strategies documentation to detail the architecture, available strategies, and their configurations, emphasizing the new multi-timeframe capabilities.
- Added a new timeframe system documentation to explain the strategy-controlled timeframe management and automatic data resampling.
- Improved the strategy manager documentation to clarify its role in orchestrating multiple strategies and combining signals effectively.
- Adjusted configuration examples to reflect recent changes in strategy parameters and usage.
2025-05-23 17:06:35 +08:00
Vasily.onl
9b15f9f44f Update configuration files for BBRS strategy and add new default strategies
- Removed JSON files from .gitignore to allow tracking of configuration files.
- Added multiple new configuration files for the BBRS strategy, including multi-timeframe and default settings.
- Introduced a combined configuration file to support weighted strategy execution.
- Established a default configuration for 5-minute and 15-minute timeframes, enhancing flexibility for strategy testing.
2025-05-23 16:57:33 +08:00
Vasily.onl
5d0b707bc6 Implement BBRS strategy with multi-timeframe support and enhance strategy manager
- Added BBRS strategy implementation, incorporating Bollinger Bands and RSI for trading signals.
- Introduced multi-timeframe analysis support, allowing strategies to handle internal resampling.
- Enhanced StrategyManager to log strategy initialization and unique timeframes in use.
- Updated DefaultStrategy to support flexible timeframe configurations and improved stop-loss execution.
- Improved plotting logic in BacktestCharts for better visualization of strategy outputs and trades.
- Refactored strategy base class to facilitate resampling and data handling across different timeframes.
2025-05-23 16:56:53 +08:00
Vasily.onl
235098c045 Add strategy management system with multiple trading strategies
- Introduced a new strategies module containing the StrategyManager class to orchestrate multiple trading strategies.
- Implemented StrategyBase and StrategySignal as foundational components for strategy development.
- Added DefaultStrategy for meta-trend analysis and BBRSStrategy for Bollinger Bands + RSI trading.
- Enhanced documentation to provide clear usage examples and configuration guidelines for the new system.
- Established a modular architecture to support future strategy additions and improvements.
2025-05-23 16:41:08 +08:00
Vasily.onl
4552d7e6b5 Update test_bbrsi.py configuration dates for backtesting 2025-05-23 15:22:03 +08:00
Vasily.onl
7af8cdcb32 Enhance Bollinger Bands validation and add DatetimeIndex handling in strategies
- Added validation to ensure the specified price column exists in the DataFrame for Bollinger Bands calculations.
- Introduced a new method to ensure the DataFrame has a proper DatetimeIndex, improving time-series operations in strategy processing.
- Updated strategy run method to call the new DatetimeIndex validation method before processing data.
- Improved logging for better traceability of data transformations and potential issues.
2025-05-23 15:21:40 +08:00
Simon Moisy
e5c2988d71 Refactor Backtest class and update strategy functions for improved modularity
- Refactored the Backtest class to encapsulate state and behavior, enhancing clarity and maintainability.
- Updated strategy functions to accept the Backtest instance, streamlining data access and manipulation.
- Introduced a new plotting method in BacktestCharts for visualizing close prices with trend indicators.
- Improved handling of meta_trend data to ensure proper visualization and trend representation.
- Adjusted main execution logic to support the new Backtest structure and enhanced debugging capabilities.
2025-05-22 20:02:14 +08:00
Ajasra
00873d593f Enhance strategy output standardization and improve plotting logic
- Introduced a new method to standardize output column names across different strategies, ensuring consistency in data handling and plotting.
- Updated plotting logic in test_bbrsi.py to utilize standardized column names, improving clarity and maintainability.
- Enhanced error handling for missing data in plots and adjusted visual elements for better representation of trading signals.
- Improved the overall structure of strategy implementations to support additional indicators and metadata for better analysis.
2025-05-22 18:16:23 +08:00
Ajasra
3a9dec543c Refactor test_bbrsi.py and enhance strategy implementations
- Removed unused configuration for daily data and consolidated minute configuration into a single config dictionary.
- Updated plotting logic to dynamically handle different strategies, ensuring appropriate bands and signals are displayed based on the selected strategy.
- Improved error handling and logging for missing data in plots.
- Enhanced the Bollinger Bands and RSI classes to support adaptive parameters based on market regimes, improving flexibility in strategy execution.
- Added new CryptoTradingStrategy with multi-timeframe analysis and volume confirmation for better trading signal accuracy.
- Updated documentation to reflect changes in strategy implementations and configuration requirements.
2025-05-22 17:57:04 +08:00
Ajasra
934c807246 fixed depricated parameters 2025-05-22 17:24:16 +08:00
Ajasra
8e220b564c Merge branch 'main' of https://dep.sokaris.link/Simon/Cycles 2025-05-22 17:15:55 +08:00