Skip to content

Conversation

@joaquinbejar
Copy link
Owner

Release Notes: Version 0.2.5 - Advanced Strategy Optimization and Integration

Summary

This release focuses on enhancing options trading strategies by introducing integration tests, refining optimization logic, and expanding delta-neutrality support. The update also includes significant improvements to test coverage, performance, and maintainability, with optimizations leveraging parallel processing and reusable code patterns.


What's New

  • Integration Tests for Strategies: Comprehensive tests added for Poor Man's Covered Call, Straddles, Strangles, Butterfly Spreads, Condors, and Custom Strategies, ensuring accurate profit/loss calculations.
  • Delta Neutrality and Greeks Enhancements:
    • Added delta-neutral functionality to strategies such as Iron Condor, Iron Butterfly, and Butterfly Spreads.
    • Improved calculations for Greeks (Delta, Gamma, Theta, Vega, Rho) across all supported strategies.
  • Dynamic Strategy Optimization:
    • Refactored filtering logic for strategies like Call Butterfly, Straddle, and Strangle to streamline validation and optimization processes.
    • Introduced reusable methods for filtering and grouping combinations.

Enhancements

  • Refactored process_n_times_iter using parallel processing (via Rayon), improving performance for combination analysis.
  • Modularized strategy tests for better organization and scalability.
  • Improved charting for profit/loss visualizations:
    • Updates to Butterfly, Condor, Straddle, and Strangle strategies for enhanced clarity and accuracy.
  • Logging improvements with tracing::info replacing println! for consistent debug output.
  • Enhanced OptionChain initialization with support for parameters like risk-free rate and dividend yield.

Bug Fixes

  • Resolved delta adjustment inaccuracies for strategies like Straddles and Strangles, ensuring precise delta-neutral calculations.
  • Fixed inconsistencies in Bear Put Spread and Iron Condor validation logic.
  • Removed redundant and outdated tests to streamline the testing framework.

Breaking Changes

  • Refactor to Strategy Structures:
    • Introduced StrategyLegs enum, replacing individual leg parameters in strategy creation.
    • Requires updates to custom strategies to align with the new StrategyLegs structure.
  • filter_combinations logic now central to all strategies, necessitating adaptation in any custom implementations.

Documentation Updates

  • Expanded README with detailed strategy classifications, updated profit/loss charts, and new Mermaid.js diagrams.
  • Added comprehensive examples for delta-neutrality adjustments and optimization workflows.
  • Improved inline documentation across modules for better clarity.

Migration Notes

  • Users implementing custom strategies must adapt to the StrategyLegs enum for position handling.
  • Ensure tests are updated to leverage the modularized structure for compatibility with the enhanced suite.

Acknowledgments

Special thanks to contributors for implementing robust delta-neutrality features, expanding integration tests, and improving documentation.


Release Links

joaquinbejar and others added 30 commits December 13, 2024 19:38
Updated README, library docs, and Cargo.toml to reflect the new version 0.2.5. This update prepares the library for the next release, ensuring consistency across metadata and documentation.
Replaced relative image URLs with absolute links to ensure proper rendering on external platforms. Added new badges for issues, pull requests, and documentation to improve project visibility and accessibility. The updates enhance the overall presentation and usability of both the README and library documentation.
Updated the OptionChain struct and related methods to include optional fields for risk-free rate and dividend yield. Adjusted tests and iterators to reflect the new parameters. Added functionality to retrieve pricing parameters with default fallbacks for the new fields. (ref. #62)
Introduce `filter_combinations` method in the base strategy to outline potential logic for filtering and grouping option data. Currently, the method returns an empty iterator and logs an error, serving as a scaffold for future implementation. (ref. #62)
The `OptionChainParams` trait now includes a `strike_price` parameter in the `get_params` method for enhanced flexibility. Additionally, the `OptionDataGroup` enum was introduced to handle grouped option data efficiently. These changes improve functionality and code organization. (ref. #62)
This new method allows creating `ExpirationDate` instances from strings. It supports parsing both durations in days and RFC3339 datetime formats, with appropriate error handling for invalid input. (ref. #62)
Added new optional parameters to `OptionChain` initialization across strategies and modified their usage accordingly. Enhanced `BullPutSpread` with new traits and functionalities, including position handling, validation, and optimization logic. (ref. #62)
Refreshed multiple strategy-related profit/loss charts to improve clarity and accuracy. This update ensures consistency and better representation across visual assets for analytical purposes.
Refreshed the profit/loss visualizations for long and short strangle strategies to improve accuracy and presentation. Ensures the charts align with the latest calculations and strategy updates.
Updated visualizations to reflect the latest calculations for best area and best ratio scenarios. These changes provide clearer and more accurate insights for the respective strategies.
Refined the profit/loss chart images for better clarity and precision. This ensures more accurate visual representation of the best area and ratio in the iron butterfly strategy.
Refined the visuals for best area and best ratio charts to improve clarity and presentation. These updates ensure better readability and enhanced interpretation of the strategy metrics.
Introduce a new 'zip' target to package the project into a ZIP file, excluding 'target' directories, 'Cargo.lock', and hidden files. This simplifies project archiving and distribution while ensuring unnecessary files are excluded.
This new method provides an iterator to access the `options` field in the `OptionChain` structure. It simplifies traversal of the `OptionData` elements, leveraging `BTreeSet` ordering for consistent iteration.
Introduced the `One` variant to the `OptionDataGroup` enum to handle a single `OptionData` reference. This enhancement improves flexibility for cases with only one `OptionData` item.
This update modifies the chart configuration to disable the mesh grid. The change ensures a cleaner visualization by removing the grid lines while retaining x and y axis labels.
Replaced nested loops with a reusable `filter_combinations` method for both Iron Condor and Iron Butterfly strategies. This improves code readability, reduces redundancy, and ensures better validation of strategy constraints. Minor logging adjustments and dead code removal were also made. (ref. #62)
Introduced a shared filtering method across spread strategies to standardize and simplify combination selection. Ensured invalid options and strategy constraints are consistently handled, improving optimization accuracy and maintainability. Enhanced logging for better debugging and diagnostics.(ref. #62)
Simplify and modularize the combination filtering and validation logic for long and short butterfly spreads. Removed redundant tests and methods to improve code clarity and reusability. Enhanced maintainability by consolidating filtering logic into `filter_combinations`. (ref. #62)
Introduced a unified `filter_combinations` method to streamline option filtering and validation logic for both Short and Long Straddle strategies. Removed redundant methods like `is_valid_short_option`, `is_valid_long_option`, and `are_valid_prices`. This simplifies code readability, reduces duplication, and improves maintainability.(ref. #62)
Revised the internal representation of positions for better clarity and consistency, changing long_call_itm/otm to long_call and short_call_low/high. Adjusted logic for validations, profit calculations, and option interactions to align with the new structure. Removed outdated tests and added modifications to reflect these updates. (ref. #62)
Streamline the `ShortStrangle` and `LongStrangle` optimization processes by introducing a reusable `filter_combinations` function, improving efficiency and clarity. Removed redundant validations and refactored chart point generation for better consistency. Updated tests to align with the new strategy validation logic, ensuring correctness. (ref. #62)
Eliminated unused and outdated test cases from `bear_put_spread.rs`, `call_butterfly.rs`, and `iron_condor.rs`. This cleanup improves maintainability by focusing on relevant and correctly functioning tests. Adjusted remaining test assertions for consistency with updated strategy logic. (ref. #62)
Refreshed the visuals for the bull call spread profit/loss chart and the intrinsic value chart. The updates ensure improved clarity and accuracy in representation.
This commit integrates the logging of Greeks for better strategy debugging and analysis. Additionally, some parameter adjustments and minor refactoring have been made for consistency and improved code clarity. (ref. #62)
Updated strategy examples to use `ZERO` for short quantities for clarity. Enhanced the `OptionChain` example by adding additional parameters to the constructor, preparing for extended functionality.
Updated the short_quantity value from `2.0` to `97.8` to ensure correct calculations in the call butterfly strategy. Additionally, added a missing close_fee entry to maintain consistency in the input parameters.
…_combinations-Method-for-All-Remaining-Strategies

Feature/#62 implement filter combinations method for all remaining strategies
This commit introduces extensive unit tests for the BearCallSpread strategy, covering validation, profit/loss calculations, position integrity, and optimization logic. It ensures robustness by testing edge cases, different input scenarios, and error handling. (ref. #67)
This commit introduces comprehensive tests to validate the filtering logic for Bear Put Spread strategies. It ensures correct handling of valid/invalid combinations, pricing constraints, empty option chains, and different optimization criteria. These tests improve the reliability and robustness of the strategy implementation. (ref. #67)
joaquinbejar and others added 9 commits December 18, 2024 18:07
…s-for-Optimizable-Trait-Implementation

Feature/#67 create unit tests for optimizable trait implementation
Cleaned up formatting inconsistencies and enhanced code readability across strategy implementations and tests. Additionally, introduced new modularized unit test files for better organization and extended testing capabilities. (ref. #66)
Replaced `println!` statements with `tracing::info` in multiple examples and modules for better logging consistency. Removed an unused test file and added several new unit tests for strategies such as Iron Condor and Butterfly Spread to enhance coverage. (ref. #66)
Updated the Makefile to set LOGLEVEL to WARN when running tests. This reduces noise in test output by suppressing non-critical log messages, improving clarity during execution.(ref. #66)
Introduced a new module for testing various "optimal" trading strategies. This includes a range of strategies like butterfly spreads, iron condors, and custom strategies, ensuring comprehensive coverage and modular organization. Updated the test suite to include the `optimal` module. (ref. #66)
Refactored `process_n_times_iter` to leverage Rayon for parallel processing of combinations, significantly enhancing performance. Added `Send` and `Sync` bounds to ensure thread safety and wrapped the closure in a `Mutex` to safely handle `FnMut` in parallel contexts. (ref. #66)
This commit introduces unit tests for multiple options trading strategies, including poor man's covered call, straddles, strangles, butterfly spreads, condors, and a custom strategy. Each test ensures the correct calculation of profit areas and ratios using realistic data and configurations. (ref. #66)
Streamline combination filtering and optimize strategy creation by introducing reusable methods and removing redundant code. Enhancements include improved validation, dynamic leg grouping, and added test coverage to ensure robustness of the updated logic. (ref. #66)
…-examples-to-Integration-Tests

Feature/#66 convert strategy examples to integration tests
@joaquinbejar joaquinbejar merged commit c3c1f3d into main Dec 19, 2024
2 checks passed
@codecov
Copy link

codecov bot commented Dec 19, 2024

@joaquinbejar joaquinbejar deleted the release/v0.2.5 branch December 19, 2024 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants