Changelog
Version 0.1.0
Goals
- The effectiveness and scalability of using OOP in the implementation and analysis of strategies is to be studied.
Results
Conclusions
- Using OOP is not suitable for strategy testing since it seems it is difficult to define an instance of a
strategy with a method that is scalable, and it does not seem natural to give such a description.
Comments
-
These are historical versions with approaches and implementation code both explained. In future versions, most implementation code will be post on GitHub.
Version 0.2.0
Goals
- A functional based approach is implemented and the focus is on execution, not architecture.
Results
Conclusions
-
Functional programming is a much more natural framework to execute and analyze trading strategies. It's dynamic nature allows for ease in changing implementation constantly and its minimal structure allows for focus on correct execution logic, rather than architecture.
Version 0.3.0
Goals
-
Increase time performance to allow for faster strategies testing.
-
Implement more focused storage capabilities to store a massive range of possible results for efficient retrieval.
-
Implement better data analysis methods for efficient analysis and visualization of both time series data and the results of strategies.
Details
- The operations are fully vectorized with the use of Dataframes instead of series with lists. The result is a working
model of backtesting which tests cointegrated pairs as filtered through the ADF test
- Parallel processing is used to improve performance
- parquet files are used for storage.
- Walk forward testing is used based upon a series of 5 tests
- Implements pre-strategy and post-strategy classification of various stocks.
- Provides graphs are given of the highest performing pairs in the example time period.
Results
Conclusions
- Parameter optimization will be done next, along with validation testing.
- Approach is in the right direction but some of the strategy implementation not correct because of incorrect implementation logic of
the beta portfolio weights. This will be corrected in the next one.
Version 0.3.1
Goals
- Cointegration must be executed correctly on hourly data
- The foundational mathematical framework is given.
Results
Conclusions
- Cointegration beta
based implementation for the entry/exit is corrected, and the best performing assets pairs are shown.
Version 0.3.2
Goals
-
Cointegration is done on daily data to create a replicable rolling forward, validating backtest.
Results
Conclusions
-
Future goals include implementation over several periods to find patterns related to cointegrated assets and to find optimal parameters to a greater degree of accuracy.
Version 0.3.3
Goals
- Correct strategies logic
- Correct implementation of neutrality and dynamic filters
- 2.0 Sharpe and 1.7 alpha across time periods.
Strategies Implementation Updates
- Cross-sectional mean reversion, cross-sectional momentum, cointegration, time based momentum, and mean reversion.
- Implemented neutrality conditions of beta neutrality, PC(n) neutrality, dollar.
- Implemented a regime detector based on state variables of correlation, volatility, trending, autocorrelation, and dispersion.
- Implemented the use of rolling filters and EMA filters.
- Implemented the classification of assets in terms of defined aspects.
- Implemented rank based weighting.
Architecture Updates
- Implemented basic SQL storage.
- Implemented optimization of parameters.
Results Updates
Report
- The goal remains 2.0 Sharpe and 1.7 alpha across time periods across several epochs.
- The closest is Sharpe > 1.5 and Alpha > 0.4 which was based on the implementation of regime based strategies, along with neutrality conditions.
Comments
Future Goals
- Improvements to focus on include weighted strategy execution, and a more accurate regime filter.
- Bayesian filtering must be added
Version 0.3.4
Goals
- Testing of regime filters based on learning and non learning methods.
Strategies Implementation Updates
- Allocation of strategies based on regime filters. Regime states were average pairwise correlation, autocorrelation, dispersion, volatility, liquidity, and trending. Each was either high, medium, or low in each type of state.
- Regime filters constructed from preset allocation rules and based on learning methods, including SVM, kernel methods, logistic regression, elastic, neural networks, transformers, trees, and forests. No learning was used explicitly in the strategy implementation logic itself yet.
- Parameters of both strategies and filters optimization on the validation period. Methods of optimization were grid search, ADAM, and Bayesian.
Architecture Updates
- Implemented regime filter and learning based implementation with the help of coding based agent (Codex).
Results Updates
Report
- Learning models underperformed compared to preset regime based models.
- Cointegration was not successful either alone or along with other strategies. This should be analyzed for possible weight allocation issues and period independent revised implementation
- Gaussian mixture based regime filter was the most successful. Random forest was also well performing. Raw neural network was the worst performing learned model.
- Separation of validation period usage strategies parameters and regime parameters may help. Cross validation across training and validation periods can be attempted.