64 Commits

Author SHA1 Message Date
Simon Moisy
6916722a43 Merge branch 'main' of ssh://dep.sokaris.link:2222/Simon/Cycles 2025-05-27 16:48:33 +08:00
Simon Moisy
47551d6781 ignoring credentials jsons 2025-05-27 16:47:20 +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
Ajasra
1107346594 refactor to move inside strategy calculations 2025-05-22 17:15:51 +08:00
Simon Moisy
45c853efab Moved supertrend.py to Analysis subfolder 2025-05-22 17:09:29 +08:00
Simon Moisy
268bc33bbf Merge branch 'main' of ssh://dep.sokaris.link:2222/Simon/Cycles 2025-05-22 17:05:39 +08:00
Simon Moisy
e286dd881a - Refactored the Backtest class for strategy modularity
- Updated entry and exit strategy functions
2025-05-22 17:05:19 +08:00
Ajasra
736b278ee2 aggregate for specific condition 2025-05-22 16:53:23 +08:00
Ajasra
a924328c90 Implement Market Regime Strategy and refactor Bollinger Bands and RSI classes
- Introduced a new Strategy class to encapsulate trading strategies, including the Market Regime Strategy that adapts to different market conditions.
- Refactored BollingerBands and RSI classes to accept configuration parameters for improved flexibility and maintainability.
- Updated test_bbrsi.py to utilize the new strategy implementation and adjusted date ranges for testing.
- Enhanced documentation to include details about the new Strategy class and its components.
2025-05-22 16:44:59 +08:00
Simon Moisy
f4873c56ff minor fixes 2025-05-21 17:23:35 +08:00
Simon Moisy
2fd73085b8 Refactor backtest logic for improved index retrieval
- Updated the method for determining the start index of the current trade to directly use the DataFrame index, enhancing clarity and performance.
- Removed the deprecated get_current_min1_end_idx method to streamline the codebase.
2025-05-21 17:06:16 +08:00
Simon Moisy
806697116d Refactor backtesting logic and introduce new components
- Replaced TrendDetectorSimple with a new Backtest class for improved backtesting functionality.
- Integrated argparse for configuration file input, allowing dynamic parameter setting.
- Added MarketFees and Supertrends classes to handle fee calculations and trend detection, respectively.
- Removed deprecated main_debug.py and trend_detector_simple.py files to streamline the codebase.
- Enhanced process_timeframe_data to utilize the new Backtest class for executing trades and calculating results.
- Updated Storage class to support writing backtest results with metadata.
2025-05-21 17:03:34 +08:00
Simon Moisy
14905017c8 Add total fees calculation to storage results
- Included total_fees_usd in the results dictionary of the Storage class to enhance fee tracking in the output.
- removed plots from TrendDetectorSimple
2025-05-21 15:35:12 +08:00
Simon Moisy
ec1a86e098 Fixing last merge 2025-05-21 15:14:00 +08:00
Simon Moisy
0a919f825e Merge branch 'main' of ssh://dep.sokaris.link:2222/Simon/Cycles 2025-05-21 15:06:56 +08:00
Simon Moisy
c2886a2aab Enhance trading logic and fee calculations in main.py and trend_detector_simple.py
- Added total fees calculation to process_timeframe_data and aggregate_results functions in main.py.
- Updated trade logging in TrendDetectorSimple to include transaction fees in USD.
- Introduced calculate_okx_fee function for consistent fee calculations based on maker/taker status.
- Adjusted backtesting logic to account for fees when buying and selling, ensuring accurate profit calculations.
- Expanded stop loss percentages and timeframes for broader analysis in main.py.
2025-05-21 14:54:44 +08:00
Ajasra
10cc047975 Merge branch 'main' with resolved conflicts 2025-05-20 18:44:24 +08:00
Ajasra
955a340d02 docs 2025-05-20 18:40:16 +08:00
Ajasra
07b9824b69 docs 2025-05-20 18:36:59 +08:00
Ajasra
369b3c1daf added seaborn to plot ( a bit simpler and more features than matplotlib) 2025-05-20 18:29:12 +08:00
Ajasra
08c871e05a Boilinger Band and RSI implementation 2025-05-20 18:28:53 +08:00
Ajasra
837c505828 Refactor 2025-05-20 16:59:17 +08:00
Ajasra
1cdfe3973a Uv package manager 2025-05-20 16:22:11 +08:00
Simon Moisy
8ff86339d6 Add taxes functionality and refactor trading logic
- Introduced Taxes class in taxes.py to calculate and apply taxes on profits in backtest results.
- Updated main.py to include tax calculations in the results processing flow.
- Refactored trade logging in TrendDetectorSimple to account for transaction fees and ensure accurate profit calculations.
- Added a utility script (apply_taxes_to_file.py) for applying taxes to existing CSV files.
- Adjusted date range and timeframe settings in main.py for broader analysis.
2025-05-20 16:14:40 +08:00
Simon Moisy
7f788a4d4e Update .gitignore to include JSON files for version control, ensuring proper handling of data formats in the project. 2025-05-19 18:04:24 +08:00
Simon Moisy
0eb7fc77f9 Enhance data loading in main.py to support both CSV and JSON formats, improving flexibility for input data. Update date filtering and logging for better traceability. Refactor trade collection logic to ensure all trades are captured and written to separate CSV files by timeframe and stop loss percentage. Adjusted main execution parameters for broader timeframe analysis. 2025-05-19 17:35:17 +08:00
Simon Moisy
170751db0e Implement Google Sheets integration in main.py for batch updates of backtest results
- Added GSheetBatchPusher class to handle background updates to Google Sheets.
- Refactored write_results_per_combination function to write results directly to Google Sheets instead of CSV files.
- Updated process_timeframe function to handle single stop loss percentages.
- Introduced a global queue for batching results and trades for efficient updates.
- Enhanced error handling for Google Sheets API quota limits.
- Adjusted main execution flow to start the batch pusher and ensure all results are pushed after processing.
2025-05-19 02:02:03 +08:00
Simon Moisy
f7f0fc6dd5 Cleanup 2025-05-17 14:48:30 +08:00