Skip to content

Conversation

@joaquinbejar
Copy link
Owner

Release Notes: Version 0.2.4

We are excited to announce the release of version 0.2.4, which introduces significant enhancements to the library, focusing on strategy flexibility, delta neutrality, Greek calculations, and overall code maintainability. This release also includes key documentation improvements and optimizations for better usability.


Highlights

1. Greek Calculations

  • Implemented the Greeks trait for various strategies, enabling calculations and aggregation of Delta, Gamma, Theta, Vega, Rho, and Dividend Rho (rho_d).
  • Comprehensive unit tests ensure correctness for single and multi-position setups, including straddles, strangles, and custom strategies.

2. Delta Neutrality

  • Introduced the DeltaNeutrality trait to support delta-neutral calculations and adjustments for:
    • Spread strategies (e.g., Bull Call, Bull Put, Bear Call, Bear Put).
    • Multi-leg strategies like Butterfly Spreads, Iron Condors, and Poor Man's Covered Call.
  • Added examples and tests to demonstrate delta-neutrality adjustments and verify logic under various market conditions.

3. Flexible Strategy Legs

  • Refactored strategy creation using the new StrategyLegs enum, allowing configurations with two, four, or six option legs.
  • Enhanced support for multi-legged strategies like Iron Condors and Butterfly Spreads, improving clarity and extensibility.

4. Iterators for Option Subsets

  • Added flexible iterators for generating unique combinations of options within an OptionChain (pairs, triplets, quadruples).
  • Simplified analysis of multi-legged strategies with robust testing and validation.

5. Iron Butterfly and Condor Strategies

  • Added full implementations for the Iron Butterfly and Iron Condor strategies:
    • Validation logic for strikes and expirations.
    • Optimizations for profit area and ratios.
    • Visualizations for strategy characteristics and performance.

6. Improved Documentation

  • Enhanced documentation across the codebase, including detailed comments for:
    • The ChartPoint structure and label_offset logic.
    • Strategy modules and the new Greeks and DeltaNeutrality traits.
  • Updated the README with a comprehensive classification of strategies and examples using Mermaid flowcharts.

7. Code Quality and Maintenance

  • Refactored strategy traits to integrate the Positionable trait for better position handling.
  • Simplified optimization loops with helper methods like filter_combinations.
  • Fixed spacing inconsistencies and improved formatting for consistency and readability.

Key Updates

Enhancements

  • Added support for grouped options (OptionsInStrike) and delta calculations across strategies.
  • Introduced a LabelOffsetType for more flexible label positioning in charts.
  • Improved modularity with traits like OptionChainParams for cleaner code reuse.

Testing

  • Comprehensive tests for all new features, including edge cases for Greek calculations and delta adjustments.
  • Performance assessments for iterators and multi-legged strategy evaluations.

Build Improvements

  • Updated the publish target to include README and coverage checks, ensuring a robust release process.

Documentation Updates

  • Detailed examples for delta-neutral adjustments and Greek calculations.
  • Visual guides for strategy classifications using Mermaid graphs in the README.

Acknowledgments

Thank you to everyone who contributed to this release by improving documentation, reporting issues, and providing feedback.


Release Note: This version builds upon the foundation laid in v0.2.3, focusing on analytical robustness and user-friendly features for advanced options trading strategies.

joaquinbejar and others added 30 commits December 7, 2024 08:33
Updated the version number from 0.2.3 to 0.2.4 in both the README.md and Cargo.toml files to reflect improvements or changes made in the library. This ensures consistency in documentation and configuration files, signaling to users and developers the latest iteration of the project.
This change introduces a new rule to the Makefile, which prints the git log for the current branch compared to the main branch. It checks if the repository is in a detached HEAD state and prompts an error message, preventing potential issues with log display.
Revised the create_strategy function signature in base.rs to accept a StrategyLegs parameter, enhancing code clarity and alignment with modular components. Introduced a new module, legs, in the chains directory, and re-exported StrategyLegs for broader accessibility.
This update introduces the StrategyLegs enum to encapsulate the legs of different strategies, reducing the need for multiple function parameters. The StrategyLegs enum supports configurations with two, four, and six legs, improving code clarity and maintenance. (ref. #48)
…gyLegs-enum-to-support-variable-option-positions-in-strategy-creation

Feature/#48 implement strategy legs enum to support variable option positions in strategy creation
Reorganized the `create_strategy` method to directly return a new `PoorMansCoveredCall` instance, simplifying the strategy initialization process. This change removes redundant code and clarifies the logic for setting up the long and short call options using provided data. Additionally, updated associated image files to reflect these changes.
Remove unnecessary trailing whitespace and blank lines to improve code readability and maintain a clean codebase. This change does not affect functionality but enhances the code's visual clarity.
Integrating Optimizable allows the IronCondor strategy to determine optimal setup based on criteria such as profit ratio and area. This enhancement provides automatic selection of the best combination of option legs based on the specified optimization goals.
Refactored the `are_valid_prices` function across various strategies to accept a `StrategyLegs` object instead of separate option parameters. This change improves the code's consistency and encourages better structuring for strategies using two legs, enhancing readability and maintainability. (fix #48)
Refactor are_valid_prices to use StrategyLegs
Spanish comments in test cases were removed for consistency and readability. The essential logic and assertions remain unchanged, ensuring tests still verify the correct profit calculations for various price scenarios.
Implemented validation logic to ensure the correct order of strike prices in the Iron Condor strategy. This change includes new utility functions to validate long and short options, as well as two new binaries to determine the best area and ratio for strategy optimization. Enhanced error logging was also added to handle invalid conditions during strategy creation and execution. (ref. #23)
…ondor-Strategy

Feature/#23 implement iron condor strategy
Introduce the Iron Butterfly strategy in the options trading library. This update includes the implementation of the strategy logic, calculation of profit and loss, and new visualizations to illustrate strategy characteristics and optimal configurations. (ref. #54)
…utterfly-Strategy

Add Iron Butterfly strategy implementation
Integrated a detailed classification of options strategies into the README using a mermaid graph. This addition provides a visual breakdown of options strategies categorized by market direction (bullish, bearish, neutral) and volatility conditions. The enhancement is intended to improve clarity and provide users with a comprehensive reference guide.
The mermaid diagram syntax has been changed from 'graph' to 'flowchart' style to improve readability and consistency. Additionally, terms like "Vol" have been expanded to "Volatility," and updates to strategy nomenclature were made for clarity. Unnecessary comments and styling directives have been removed to focus the diagram on the essential information.
Replaced "With Stock" with "With Underlying" to improve clarity and accuracy in the descriptions of options strategies. This change ensures consistency with common financial terminology and better reflects the nature of the strategies described.
Simplified the Mermaid.js flowchart structure by merging parallel paths using combinational syntax to enhance readability. Removed redundant individual connections to streamline the diagram and used associative linking to clearly represent categories and subcategories.
Introduce `LabelOffsetType` for more flexible label positioning in charts, allowing absolute, relative, and automatic offset options. Updated various strategies and utilities to use this new system, improving readability and adaptability of label positions within different chart dimensions. (ref. #47)
…et-in-ChartPoint-Struct-to-Consider-Coordinate-Size

Refactor label offset logic in chart visualization
This commit enhances the existing code by introducing comprehensive documentation for the `ChartPoint` and `ChartVerticalLine` structures. These comments cover the usage, fields, and type parameters of each structure, aiding in understanding and maintaining the codebase. This addition improves the clarity and usability for future developers and contributors.
This commit introduces detailed module-level documentation for the model module in `src/model/mod.rs`, outlining core data structures and functionalities for financial options modeling. The documentation includes descriptions of the core components, key features, and type systems, which aids in better understanding and maintaining the codebase. Additionally, minor formatting adjustments were made in `README.md` for improved readability. (ref. #50)
…readme-for-Automatic-README.md-Generation

Add comprehensive documentation for model module
Introduce new LongButterfly and ShortButterfly strategies in the base strategy enum. Additionally, implement support for strategies with three legs in the legs module to accommodate these new butterfly strategies. (ref. #18)
Added new implementations for Long and Short Butterfly Spread strategies, along with profit/loss calculation and graph generation. These strategies include options for buy/sell configurations at different strike and expiration points, with added validation and optimization functions. Charts were generated for visualization purposes. (ref. #18)
Renamed butterfly strategies for consistency and precision. Updated logging levels from `error` to `debug` where appropriate to better reflect the severity of the events. Added TODO annotations for further code review on specific conditions.
Removed an unnecessary comment in `iron_butterfly.rs` and improved formatting consistency in `legs.rs`. These changes enhance readability and maintainability without altering functionality.
Updated the long and short butterfly spread strategies to use more robust validation, better calculation of break-even points, profit area, and profit ratio. Added new optimization examples (`best_area` and `best_ratio`) for long and short butterfly strategies. Simplified chart handling and refactored strike evaluations. (ref. #18)
joaquinbejar and others added 27 commits December 12, 2024 09:43
This update includes the new "examples_strategies_delta" directory in the workspace members list in Cargo.toml. It ensures the project recognizes and builds this example as part of the overall workspace.
Introduce a new example demonstrating the short strangle strategy, including its calculations and logging. This addition highlights key metrics such as break-even points, max profit/loss, fees, and delta neutrality. Dependencies like `chrono`, `tracing`, and `optionstratlib` were included to support the example.
The `delta_neutral` module was changed from private to public. This ensures the module can now be accessed outside of its crate, supporting broader usage scenarios.
Introduce `DeltaNeutrality` trait to manage delta adjustment logic and integrate it into the `ShortStrangle` strategy. The update includes methods to calculate net delta, suggest neutralizing adjustments, and generate reducing or increasing delta adjustments. Comprehensive tests for the new functionality ensure accuracy and robustness. (ref. #37)
Improved code clarity and consistency by standardizing indentation and formatting in multiple strategy-related modules. This includes aligning function calls, removing unnecessary spaces, and rearranging imports.
Enhanced the `LongStrangle` to calculate and suggest delta neutrality adjustments. Added relevant tests and a new example showcasing its usage. Refactored some methods and adjusted formatting for consistency across the codebase. (ref. #37)
Enhanced the `ShortStraddle` and `LongStraddle` strategies to support delta neutrality calculations and Greek parameter aggregation. Introduced related tests and delta adjustment suggestions to ensure functionality and edge case handling. Added logging examples for better strategy insights. (ref. #37)
Implemented `DeltaNeutrality` and `Greeks` traits for the Poor Man's Covered Call strategy. Added delta calculation, adjustment suggestions, and related tests to improve flexibility and optimize delta-neutral performance. (ref. #37)
Update the delta adjustment logic by factoring in the option quantity for increased accuracy in all strategies. Added comprehensive tests for strangle, straddle, and poor man's covered call strategies to validate the changes, ensuring delta-neutrality adjustments are properly handled. (ref. #37)
Implemented `Greeks` and `DeltaNeutrality` traits for the IronCondor strategy, enabling precise delta-neutral calculations and adjustment capabilities. Included related unit tests and added a new example to demonstrate delta adjustment suggestions. (ref. #37)
Implemented delta-neutrality features for the IronButterfly strategy, including net delta calculation, adjustment suggestions, and Greek calculations. Added comprehensive tests to validate adjustment logic and ensure accurate delta management in different market conditions. (ref. #37)
The unnecessary println statement used for debugging net delta and long call delta has been removed. This cleanup improves code readability and eliminates unneeded console output in production.
Introduced delta-neutral calculations and adjustment methods, enabling the CallButterfly strategy to assess and suggest delta adjustments. Added implementation of Greeks and detailed testing to ensure accuracy and robustness of the new features. (ref. #37)
The `create_test_short_strangle` function and related test function names were renamed to improve clarity and reduce redundancy. This ensures better alignment with naming conventions across the codebase and facilitates easier maintenance and understanding. (ref. #37)
Implemented delta-neutrality and Greeks calculations for Long and Short Butterfly Spreads. Added corresponding tests and support for delta adjustments, enhancing the flexibility and accuracy of the strategies. (ref. #37)
Implemented `DeltaNeutrality` and `Greeks` traits across multiple spread strategies including bull call, bull put, bear call, and bear put. Added example binaries for testing and demonstrating each strategy's delta-neutral functionality and suggestions for delta adjustments. Extensive test coverage was also provided to verify delta-related logic and adjustments. (ref. #37)
Simplified the import path for volatility-related utilities by moving them under `optionstratlib::volatility`. This improves clarity and ensures consistency in module access. (ref. #37)
…Neutrality-Trait-for-Options-Strategies

Feature/#37 implement delta neutrality trait for options strategies
Introduced a new Makefile target to run a script for Spanish checks. This ensures better handling of language-specific validations within the project.
Introduced iterators for generating unique and inclusive combinations (pairs, triplets, quadruples) of options within an OptionChain. This enhancement facilitates streamlined analysis of multi-legged strategies. Comprehensive tests ensure correctness and robustness across various use cases. (ref. #37)
Simplified the strategy optimization loop by introducing a `filter_combinations` helper method, reducing repetitive checks and improving code readability. Adjusted fee parameters and updated relevant tests for consistency with the refactored logic.  (ref. #61)
Enhanced the `filter_combinations` method by adding comprehensive documentation, including parameters, process steps, examples, and related references. This improves clarity and usability, especially for developers integrating or maintaining the bull put spread strategy. (ref. #61)
…ors-for-Subsets-of-OptionData-in-OptionChain

Feature/#61 implement iterators for subsets of option data in option chain
The `publish` target now depends on `readme` and `coverage` to ensure these steps are executed before publishing. This improves consistency and guarantees that necessary checks and generation are completed pre-publication.
Resolved minor spacing issues and trailing whitespace throughout the documentation comments. These changes improve formatting consistency without altering the functionality or logic of the code.
Implemented the `Greeks` trait for `CustomStrategy` to aggregate the Greeks across all positions. Added comprehensive unit tests to validate Greek calculations for different strategies, including single long/short positions and multi-position setups like straddles. (ref. #59)
…eek-Trait-in-Strategies

Feature/#59 implement the greek trait in strategies
@joaquinbejar joaquinbejar merged commit dff69ec into main Dec 13, 2024
2 checks passed
@codecov
Copy link

codecov bot commented Dec 13, 2024

@joaquinbejar joaquinbejar deleted the release/v0.2.4 branch December 13, 2024 18:38
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