-
Notifications
You must be signed in to change notification settings - Fork 29
Release/v0.2.3 #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Release/v0.2.3 #49
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Update version number in README.md and Cargo.toml to reflect the latest release of the library. This prepares the project for any newly included features, bug fixes, or improvements that are part of version 0.2.3.
This commit introduces a probability analysis module for evaluating option strategies, including risk metrics. It includes implementations for calculating probabilities of profit, value expectations, and extreme profit scenarios. Several new test cases are also added to ensure accuracy for various input scenarios and configurations. (ref. #36)
Moved the `profit_range` and `probabilities` module declarations to improve logical organization within the codebase. Adjusted the formatting of the author comment block in `probabilities/mod.rs` for consistency. These changes enhance the code structure without altering functionality. (ref. #36)
Condensed the parameter formatting for ProfitRange::new function calls to improve code readability and reduce unnecessary line breaks. This change doesn't affect the functionality but makes the codebase cleaner and easier to maintain. (ref. #36)
Renamed the macro to `assert_positivef64_relative_eq` to reflect its new functionality, using `PositiveF64` instead of `Decimal` types. Added comprehensive tests to validate the macro's behavior with different value scenarios, including edge cases with zero and large values. (ref. #36)
This commit removes several unnecessary line breaks in the test functions within `src/model/types.rs`. Cleaning up these line breaks improves readability and maintains a more consistent code style across the file. (ref. #36)
Implemented default probability calculations when both volatility adjustment and trend are absent, providing default values for max profit and loss probabilities. Enhanced existing functionality with comprehensive tests for the analyze_probabilities and calculate_extreme_probabilities methods, ensuring robust performance across various scenarios. Cleaned up formatting and enhanced code readability. (ref. #36)
Reorganized the project by introducing workspaces and moving examples into respective subdirectories. Updated `.gitignore` to handle new file paths and added necessary dependencies in each `Cargo.toml`. This enhances modularity and maintains code management efficiency.
Update module visibility to allow broader access to utilities and probabilities, facilitating external usage and integration. Adjust type name in model module for consistency and clarity.
Integrated a comprehensive probability analysis feature to both ShortStrangle and LongStrangle, enhancing their capability to perform complex financial assessments. This update includes calculating profit and loss ranges, expected value with volatility and trend adjustments, and extreme probability calculations. New test cases have been added to ensure reliability and correctness of these probability functions. (ref. #36)
…s-Probability-Trait-for-Options-Strategies Feature/#36 implement success probability trait for options strategies
Introduce profit/loss charts for long and short straddle strategies to enhance visual analytics. Refactor strangle.rs by removing redundant whitespace and streamlining `ProfitLossRange` initializations for improved readability. (ref. #26)
…le-Strategy Add long and short straddle P&L charts; optimize strangle.rs
Introduce scripts for long and short straddle strategies, focusing on best profit areas and ratios. Include associated profit/loss chart images for each strategy to visualize potential outcomes and enhancements. These additions aim to improve strategy evaluation and decision-making processes in options trading. (ref. #26)
Introduce `bull_put_spread` and `bear_call_spread` strategy modules to the strategies directory. These strategies provide options for trading with expectations of moderate price movements, expanding the available trading strategies in the codebase. Additionally, update the `mod.rs` file to include these new modules.
Reorder the import statements for strategy modules in mod.rs to maintain logical grouping and improve organization. This change does not affect the functionality but enhances readability and standardizes module arrangement.
Updated max_profit and max_loss functions to return Result<PositiveF64, &str> instead of PositiveF64. This change improves error handling by making it explicit when max profit or max loss is not applicable for a strategy. Additionally, re-implemented best_ratio and best_area functions to utilize find_optimal, removing panic situations.
Change the visibility of `OptionData` from `pub(crate)` to `pub` to allow access from outside the module. This modification facilitates usage in other parts of the codebase or by external crates.
The enum OptimizationCriteria is now public to allow its use outside of the module. This change facilitates better extensibility and reuse of this utility in other parts of the code.
Refactored code by incorporating the `Optimizable` trait in strategy modules for a cleaner and more modular design. Removed unused methods `best_ratio` and `best_area` from the custom strategies implementation to enhance code maintainability and reduce redundancy. This update streamlines the strategy optimization process and aligns with best practices.
Updated the `max_profit` and `max_loss` methods to return `Result<PositiveF64, &str>` instead of directly returning `PositiveF64`. This change enhances error handling capabilities. Additionally, refactored the use of these methods to utilize `unwrap_or(PZERO)` where necessary to handle potential errors gracefully.
Updated multiple functions in the strangle strategies to employ result-based error handling, improving robustness. Introduced error checks and updated test cases to ensure functions return expected results. Enhanced code readability and maintainability by removing and refactoring redundant code.
This commit updates the `max_profit` and `max_loss` methods to return `Result` types, adding error handling for cases when the calculations yield negative or invalid results. The changes include modifications to how the values are used throughout the codebase, ensuring proper handling with `unwrap_or` where default values are necessary. Additionally, the code has been cleaned up by removing unused functions and adding missing imports.
Updated the `max_profit` and `max_loss` functions in the `PoorMansCoveredCall` strategy to return `Result<PositiveF64, &str>`, providing better error handling. Adjusted related code to handle the new return type accordingly by using unwrap_or to default to `PZERO`. Removed redundant logging of price range to streamline the application's output.
This update modifies the `max_profit` and `max_loss` functions to return a `Result` type, enhancing the robustness of error handling. The changes also include adjustments to dependent calculations to accommodate the new return type. Additionally, removed obsolete methods and updated examples to reflect these improvements.
Refactored max_profit and max_loss methods in BullCallSpread to return Results, incorporating error handling. Updated related calculations and tests to use the Results and handle potential zero or error values gracefully.
This commit introduces the Bear Call Spread strategy to the codebase, adding its implementation along with accompanying visualization features. This includes profit/loss calculations, optimal strategy selection, and a complete suite of tests to ensure accuracy and reliability. (ref. #41)
…-Strategy-Implementation Feature/#41 Implementation of Bear Call Spread Strategy with Enhanced Error Handling
The validation for matching expiration dates between short and long calls in bear call spreads has been removed. This change assumes that managing expiration dates is handled elsewhere or is unnecessary, simplifying the validation logic within this strategy module.
This commit introduces the complete implementation of the Bull Put Spread strategy, including its setup, validation, and test coverage. Key features include calculation of max profit, max loss, and break-even points, ensuring that the strategy only accepts valid configurations where the long put strike is less than the short put strike. Comprehensive test cases have been added to verify the correct behavior under various scenarios. (ref. #42)
…Strategy-Implementation Feature/#42 bull put spread strategy implementation
Simplified the logic for validating options by moving the detailed checking into the `base.rs` and removing redundant code in `bear_call_spread.rs`. Now, the `is_valid_short_option` and `is_valid_long_option` methods in `base.rs` use a more comprehensive approach based on the `FindOptimalSide` enum, enhancing code maintainability and reducing duplication.
Refactor bull_put_spread strategy by removing redundant option validation methods and the invalid price test. This change streamlines the price validation process, ensuring only essential conditions are checked while cleaning up the existing test suite for better maintainability.
Refactor the Bull Call Spread Strategy to include new features for optimization and validation. Add calculations for maximum profit, loss, and break-even points, as well as the ability to analyze profit and loss ranges, fees, and profit ratios. Tests have been added to ensure the correctness of strategy creation and its inherent calculations, improving the robustness of the implementation. (ref. #17)
…all-Spread-Strategy Feature/#17 implement bull call spread strategy
This script locates Rust comments in a given directory, detects their language using `langdetect`, and highlights those written in Spanish. It provides a summary of files with Spanish comments, aiding in translation management.
This commit removes inline comments from various strategy and test files to enhance code readability and maintain consistency across the codebase. The comments that provided instructions or explanations within the function bodies were removed to make the code cleaner, assuming that the code itself is self-explanatory or that documentation and external resources will provide the necessary context. This change should streamline the development process by reducing clutter and potential maintenance burdens.
This commit removes unnecessary trailing whitespace from several files, enhancing code readability and consistency. No functional changes were made to the codebase, ensuring existing functionality remains unchanged.
This commit removes trailing whitespace across several lines in the bull_put_spread.rs file. These cleanups improve code readability and maintain consistency with style guidelines. No functional changes have been made to the code.
Implemented the bear put spread strategy and integrated it with the option chain for optimal profit ratio calculation. This enhancement includes new visualizations for profit/loss scenarios and comprehensive testing to ensure strategy accuracy and efficiency. (ref. #16)
…ut-Spread-Strategy Feature/#16 implement bear put spread strategy
Modified several strategy-related files to use `unwrap_or(PZERO)` when calculating max profit and max loss to prevent potential runtime errors from None values. Synced library usage across the board by including the `PZERO` type from `optionstratlib`. Additionally, updated the `statrs` crate version to 0.18.0 in `Cargo.toml` for improved compatibility or performance.
This commit reorders the import statements in multiple strategy example files for better clarity and consistency. By grouping related imports together, it enhances readability and maintains a uniform style across the codebase.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request: Release v0.2.3
Summary
This pull request introduces version 0.2.3, which includes new features, strategy implementations, performance improvements, and codebase refinements. The update ensures better functionality, robustness, and maintainability of the library.
Key Changes
1. New Strategies
Bear Put Spread Strategy (Implement Bear Put Spread Strategy #16):
Bull Call Spread Strategy (Implement Bull Call Spread Strategy #17):
Bull Put Spread Strategy (Bull Put Spread Strategy Implementation #42):
Bear Call Spread Strategy (Bear Call Spread Strategy Implementation #41):
Probability Analysis for Strangle Strategies ([Enhancement] Implement Success Probability Trait for Options Strategies #36):
ShortStrangleandLongStranglewith expected value, profit/loss ranges, and extreme probability calculations.2. Enhancements and Fixes
Error Handling:
max_profitandmax_lossmethods across multiple strategies to returnResulttypes.Nonevalues with defaults.Performance Improvements:
statrscrate to v0.18.0 for better compatibility and performance.Code Cleanups:
3. Tooling and Utility Scripts
4. General Improvements
Documentation and Versioning
Cargo.tomlandREADME.mdto reflect the new version0.2.3.Testing
Labels
release,enhancement,new strategies,testing,code cleanupAdditional Notes
This release prepares the library for broader use cases and ensures alignment with project standards for maintainable and reusable code.