Releases: joaquinbejar/OptionStratLib
v0.3.7
This release brings significant improvements to the simulator and strategy framework, focusing on enhanced configurability, refactoring for better maintainability, and expanded visualization capabilities. Key updates include the introduction of Monte Carlo simulations, improved delta neutrality handling, extended random walk configuration, and additional financial metric calculations.
What's New
- Monte Carlo Strategy Simulation: Implemented Monte Carlo-based strategy performance simulations, including profit probability, max drawdown, VaR, and Sharpe ratio calculations.
- Strategy Surface Plot: Added
strategy_surface.png
visualization for improved data representation. Curvable
andSurfacable
Traits: Introduced new traits for 2D and 3D curve representations in random walk graphs and simulations.- DeltaNeutrality Enhancements: Added
DeltaNeutralResponse
struct and serialization capabilities for better integration with ShortStrangle strategies. - Extended Walk Simulation Metrics: Introduced
calculate_extra_metrics
to compute realized volatility, Sharpe/Sortino ratios, drawdowns, and skewness/kurtosis.
Enhancements
- Simulator Configuration Expansion: Updated
SimulationConfig
andSimulator
with additional fields and better documentation. - Refactored Simulation Logic: Improved readability and modularity by restructuring simulation-related modules.
- Random Walk Model Updates:
- Adjusted standard deviation parameters for consistency and accuracy.
- Enhanced volatility calculation with realized and target volatility blending.
- Introduced time frame conversion utilities for precise unit adjustments.
- Visualization Improvements:
- Added new diagrams (
strategy_walk.png
) to illustrate simulation strategies. - Updated existing simulation images for consistency.
- Added new diagrams (
- Financial Metric Utilities:
- Added new functions for PnL distributions, risk analysis, and additional financial metrics.
- Introduced unit tests for validating these computations.
Bug Fixes
- Fixed Delta Adjustment Issues: Corrected logic in
delta_adjustments
to properly divide delta by option quantity. - Resolved Index Mismatch in Tests: Improved test accuracy by adjusting delta neutrality assertions.
- Memory Optimization: Removed unnecessary
.clone()
calls to reduce overhead. - Clippy Lint Suppression: Allowed lint suppression for complex function argument handling to maintain functionality.
Breaking Changes
- Refactored Strategy Traits:
StrategyWithGreeks
andOptimizable
were removed and replaced withStrategable
for a simplified interface.StrategyBasic
was replaced withStrategable
, affecting existing implementations.
- Modified Simulator API:
Simulator::new
now requires configuration to be passed as a reference.generate_random_walks
now includes additional configuration parameters.
Documentation Updates
- Expanded API Documentation: Added detailed explanations for new and updated simulation components.
- Updated README: Revised examples and configuration guides to align with new simulator features.
- Strategy Examples: Introduced a new walk strategy example (
walk_strategy.rs
) showcasing short strangle evaluation with logs and graphs.
Migration Notes
- Code Refactoring Implications:
- Users relying on
StrategyBasic
should migrate toStrategable
. - Function signatures for
Simulator::new
andgenerate_random_walks
may require adjustment.
- Users relying on
- Upgrade to Rust 2024 Edition: All
Cargo.toml
files were updated to ensure compatibility with the latest Rust edition. - Serde Version Update: Bumped
serde
dependency from1.0.217
to1.0.218
for stability and compatibility.
Acknowledgments
Special thanks to Joaquin Bejar for extensive contributions to this release, including code refactoring, simulation improvements, and documentation updates.
Release Links
v0.3.6
Changes Made
- Implemented
PnLCalculator
Trait for the following strategies:- Poor Man’s Covered Call (PMCC)
- Short & Long Straddle
- Iron Condor
- Iron Butterfly
- Bull Put Spread
- Butterfly Spread (Long & Short)
- Call Butterfly
- Bull Call Spread
- Bear Put Spread
- Bear Call Spread
- Refactored Break-even Calculation Logic:
- Extracted break-even point calculations into the
BreakEvenable
trait for modularity. - Applied
update_break_even_points
across strategies to standardize calculations. - Updated profit/loss chart outputs to align with the new logic.
- Extracted break-even point calculations into the
- Refactored Strategy Structures:
- Renamed
options
topositions
inStrategyRequest
for improved clarity. - Modified
StrategyRequest
to returnStrategyWithGreeks
instead ofStrategies
, enhancing compatibility with Greek calculations. - Standardized the
StrategyBasic
trait implementation across all strategies.
- Renamed
- Serialization & Deserialization Enhancements:
- Added
Serialize
andDeserialize
implementations forOptionChain
,ExpirationDate
, and related data structures. - Implemented custom Serde serialization logic for handling positive values and expiration dates.
- Added
- Refactored Strategy Constructor:
- Improved error handling in
get_strategy
methods with proper propagation. - Updated
get_strategy
to use slices (&[OptionWithCosts]
) instead ofVec
, improving API flexibility.
- Improved error handling in
- Other Refactors & Enhancements:
- Replaced redundant Black-Scholes calculations with a modular approach.
- Improved logging by replacing
println!
statements with structured logging viatracing
macros. - Added unit tests for strategy break-even points, PnL calculations, and serialization.
- Fixed formatting inconsistencies across multiple files.
Testing
- Unit Tests:
- Added comprehensive unit tests for
PnLCalculator
across all strategies. - Verified break-even calculations with new
update_break_even_points
tests. - Ensured serialization/deserialization correctness for
OptionChain
,ExpirationDate
, and related structs.
- Added comprehensive unit tests for
- Edge Cases Covered:
- PnL calculations for extreme market conditions (high volatility, near expiration).
- Break-even calculations for different spread configurations.
- Error handling for invalid inputs in strategy requests.
- Manual Testing:
- Manually validated PnL calculations against real-world option scenarios.
- Compared break-even points with expected values from standard market calculations.
Additional Notes
- This PR significantly improves the maintainability of strategy-related calculations.
- Future work could extend PnL calculations to support adjustments based on volatility skew.
- Ensuring backward compatibility, existing strategy structures are updated with minimal disruption.
References
- Implements feature request #126 (Break-even logic standardization).
- Fixes issue #124 (Ensuring
BreakEvenable
consistency across strategies). - Improves strategy serialization & PnL calculations as part of ongoing refactors.
Checklist
- Code changes reviewed and tested.
- Unit tests added for PnL and break-even calculations.
- Documentation updated with usage examples.
- All tests passing.
- Backward compatibility maintained.
Version 0.3.4 - Advanced Error Handling, Surface Operations, and WASM Integration
Release Notes: Version 0.3.4 - Advanced Error Handling, Surface Operations, and WASM Integration
Summary
This release focuses on enhancing analytical precision, improving modular design, and expanding support for WebAssembly (WASM) environments. It introduces new features for option Greeks validation, surface computations, and implied volatility analysis while refining error handling, unit testing, and visualization modules.
What's New
- Greeks Validation Test: Introduced rigorous testing for advanced option Greeks calculations.
- Implied Volatility Calculation: Added new algorithms for computing implied volatility with comprehensive test coverage.
- Mid-Price Calculation: Enabled computation of mid-prices for call and put options, streamlining option valuation workflows.
- Surface Module Enhancements:
- Introduced traits for 3D surface operations, including
LinearInterpolation
. - Added cubic and spline interpolation methods.
- Enhanced surface plotting with new examples for Greeks and delta curves.
- Introduced
SurfaceConstructionMethod
enum and arithmetic operations for surface merging. - Added axis-based computations for curves and surfaces.
- Introduced traits for 3D surface operations, including
- WASM Support:
- Added conditional imports and annotations specific to WASM environments.
- Enhanced logging utilities and test configurations for WASM.
Enhancements
- Error Handling:
- Refactored error handling with extended test coverage for
ChainError
,OptionsError
,ProbabilityError
, andCurvesError
. - Unified error types across interpolation and geometric modules.
- Improved error formatting and added detailed documentation.
- Refactored error handling with extended test coverage for
- Geometric and Interpolation Refactors:
- Modularized surface and geometric handling with dedicated modules and re-exports.
- Unified parameter structures for curve and surface operations.
- Standardized interpolation frameworks and related error handling.
- Codebase Improvements:
- Simplified
Makefile
targets, removing redundant dependencies. - Refactored imports, hashing, collections, and formatting for cleaner code.
- Simplified
- Visualization Updates:
- Added surface plotting examples for D2 metrics, Greeks, and delta curves.
- Refined graph rendering and mock charting features.
Bug Fixes
- Resolved WASM-specific configuration issues to ensure compatibility and cleaner testing workflows.
- Fixed formatting and modularization inconsistencies across surface and interpolation modules.
- Addressed redundant comments and unused code for a leaner implementation.
Documentation Updates
- Expanded documentation for error handling modules, surface operations, and interpolation frameworks.
- Updated example file names for improved clarity in usage scenarios.
- Added new surface and curve plotting examples to illustrate functionality.
Migration Notes
- Users upgrading to this version should note:
- The
Surface
module has been modularized, requiring updates to import paths. - Deprecated modules related to interpolation have been removed in favor of unified geometric handling.
- Review new parameter structures for curves and surfaces to adapt existing workflows.
- The
Release Links
Enhanced Precision and Visualization for Greeks
Release Notes: Version 0.3.3 - Enhanced Precision and Visualization for Greeks
Summary
This release focuses on refining the precision of options Greeks calculations, introducing new visualization tools, and improving test reliability across strategies. Key updates include revamped calculations for Delta, Theta, Vega, and other Greeks, enhanced curve plotting examples, and streamlined code for better maintainability. Special thanks to Ravi Nagabhyru for their valuable contributions to this release.
What's New
- Greek Curve Visualizations: Added scripts to generate and visualize curves for Vega, Theta, and Delta under various scenarios.
- Examples include
vega_volatility_vector_curve
,theta_volatility_curve
, andgamma_volatility_vector_curve
.
- Examples include
- New Greek - Alpha: Introduced
Alpha
, calculated using Gamma and Theta, to provide additional insights into strategy behavior.
Enhancements
- Refactored Rho and Rho_d calculations for consistency and introduced basis point support for improved granularity.
- Improved Theta calculation with pre-computed terms, resulting in cleaner code and better performance.
- Enhanced Vega calculations to return percentage-based values, ensuring consistent scaling.
- Standardized and refactored Delta-related calculations:
- Introduced the
DELTA_THRESHOLD
constant for unified precision handling across strategies. - Improved assertion logic with
assert_decimal_eq!
andassert_pos_relative_eq!
for better precision in tests.
- Introduced the
- Simplified imports and documentation paths across modules for better readability.
- Updated test cases for accuracy and alignment with refined Greek calculations.
Bug Fixes
- Resolved incorrect Rho and Rho_d values in Delta strategy tests, ensuring precise decimal validation.
- Fixed clamping issues in Delta and Gamma calculations to enhance precision in edge cases.
- Addressed CI/CD pipeline errors for WebAssembly (Wasm) targets, ensuring reliable builds and tests.
Breaking Changes
- Removed the
d2fu!
macro in favor of direct calls for Delta calculations. This may require users to update custom implementations relying on the macro. - Updated Delta calculations to use
Decimal
for improved precision, replacingf64
.
Documentation Updates
- Expanded module-level documentation for Delta Neutral strategies to include detailed descriptions and usage guidelines.
- Updated README and project metadata to reflect the new release version.
- Added examples demonstrating the use of Greek curves and their applications in strategy analysis.
Migration Notes
- Users upgrading to this version should review changes to Delta, Rho, and Vega calculations to ensure compatibility.
- Replace any usage of the
d2fu!
macro with the new direct call structure for Delta calculations.
Acknowledgments
We extend our gratitude to Ravi Nagabhyru for their contributions to improving WebAssembly support, CI/CD configurations, and overall project quality.
Release Links
v0.3.1
Summary
This release focuses on improving benchmarking capabilities, strengthening input validation, and enhancing the type safety and precision across financial computations. Several features, including support for the Criterion
benchmarking framework and improved probability analysis in strategies, provide a robust foundation for accurate and reliable performance evaluations.
What's New
-
Enhanced Benchmarking with Criterion:
- Added comprehensive benchmarking support for models and strategies, including
Position
,Option
, and chains. - Integrated HTML report generation for benchmarking results.
- Introduced a new
bench-json
target in the Makefile for structured output management.
- Added comprehensive benchmarking support for models and strategies, including
-
Probability Analysis in Strategies:
- Implemented
ProbabilityAnalysis
for strategies likeIron Butterfly
,Iron Condor
, andPoor Man's Covered Call
. - Calculations for profit and loss probabilities now include volatility adjustments and edge case handling.
- Implemented
-
Risk-Neutral Density (RND) Analysis:
- Added RND calculation to
OptionChain
, providing insights into market expectations and volatility skew analysis.
- Added RND calculation to
Enhancements
-
Improved Input Validation:
- Replaced raw numeric literals with strongly-typed macros (
pos!
,dec!
) for safety and precision. - Enforced non-negative values in
volatility
,fees
, and other financial fields using thePositive
type.
- Replaced raw numeric literals with strongly-typed macros (
-
Makefile Updates:
- Refined
cargo criterion
commands for better output control (e.g., quiet/verbose modes). - Simplified benchmarking tasks by introducing dedicated targets for structured output.
- Refined
-
Code Refactoring:
- Streamlined probability calculations, reducing redundancy and improving readability.
- Updated profit and loss calculations to use
Decimal
for precision and better error handling. - Refactored test cases for better alignment with updated logic and numerical representations.
Bug Fixes
- Corrected break-even calculations in strategies like
Iron Condor
andBull Put Spread
to use consistent formulas. - Resolved edge cases in
Positive
arithmetic to prevent invalid negative results. - Fixed macro scoping issues in
Positive
, ensuring accurate method resolution. - Addressed test inconsistencies caused by outdated values or incorrect assertions.
Breaking Changes
- Fields such as
volatility
,fees
, andrisk-free rates
now usePositive
orDecimal
types, requiring updates to dependent code. - Deprecated redundant functions like
fees
in several strategies, requiring users to transition to new implementations.
Documentation Updates
- Updated examples and test cases to reflect the new type-safe numeric representations.
- Added detailed benchmarking documentation, including usage of
bench-json
for structured performance analysis. - Improved strategy documentation with updated profit-loss visualizations and probability explanations.
Migration Notes
-
Type Safety Updates:
- Replace
f64
withPositive
orDecimal
in your custom implementations and inputs. - Ensure all numeric literals in your codebase use the provided macros (
pos!
,dec!
) for compatibility.
- Replace
-
Transitioning from Deprecated Functions:
- Migrate to the updated fee and profit calculation methods.
- Update any custom strategy tests to align with the new logic and benchmarks.
Acknowledgments
A big thank you to Joaquin Bejar and the contributors for their extensive work in refining the codebase, adding benchmarking features, and ensuring robust error handling.
Links
Release v0.3.0: Refactor Strategies, Improved Precision, and Enhanced Error Handling
Description
This release introduces significant improvements to the library, including enhanced precision in financial calculations through the use of rust_decimal
, improved error handling, and updates to the Strategies
trait methods to return Result
. The changes also encompass extensive refactoring, improved test coverage, and updates to documentation and examples.
Key Changes
General Updates
- Bumped version to v0.3.0 in
Cargo.toml
,README
, and library documentation. - Upgraded dependencies for better compatibility and stability.
Precision Improvements
- Transitioned from
f64
torust_decimal::Decimal
for financial calculations in:- Strategies such as
BullPutSpread
,CallButterfly
,BearCallSpread
, and more. - Utility functions like
net_premium_received
andfees
.
- Strategies such as
- Adjusted related tests to reflect precision enhancements.
Error Handling
- Introduced structured error types (
StrategyError
,ProbabilityError
,ChainError
, etc.) for more expressive and maintainable error reporting. - Updated methods in
Strategies
to returnResult
for improved validation and error propagation.
Refactorings
- Standardized
use crate
imports and improved code style consistency across files. - Reorganized
PositiveF64
into a more genericPositive
struct for broader usability. - Simplified and standardized the use of
.to_f64()
instead of.value()
.
Testing Enhancements
- Added comprehensive unit tests covering edge cases and exotic option scenarios (e.g., Asian, Barrier, Rainbow options).
- Refactored existing tests to improve precision, readability, and robustness.
- Introduced
#[ignore]
to selectively disable certain tests during standard runs.
Documentation
- Updated examples and module-level documentation to align with the latest changes.
- Enhanced clarity in error module documentation with usage examples.
Testing
Automated Tests
- Unit Tests: Updated and added tests to validate new functionality, including:
- Break-even calculations.
- Error handling scenarios.
- Financial calculations with
Decimal
.
- Monte Carlo Tests: Adjusted parameters for improved simulation accuracy.
Manual Testing
- Verified the correctness of major financial strategy outputs.
- Validated error handling behavior for edge cases.
References
- Relates to the following issues and features:
Checklist
- Code reviewed and refactored for maintainability.
- Unit and integration tests updated.
- Documentation updated for all major changes.
- All tests passing.
Version 0.2.5 - Advanced Strategy Optimization and Integration
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
replacingprintln!
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.
- Introduced
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
v0.2.4
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 andlabel_offset
logic. - Strategy modules and the new
Greeks
andDeltaNeutrality
traits.
- The
- 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.
v0.2.3
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 (#16):
- Complete implementation with profit/loss calculations and visualizations.
- Integrated optimization for profit ratio and validation checks.
-
Bull Call Spread Strategy (#17):
- Added optimization and validation features.
- Includes calculations for maximum profit, loss, and break-even points.
- Comprehensive testing ensures accuracy and robustness.
-
Bull Put Spread Strategy (#42):
- Implemented with validation logic for valid strikes and expiration dates.
- Includes calculations for profit/loss and break-even points.
- Comprehensive tests for various scenarios.
-
Bear Call Spread Strategy (#41):
- Introduced visualization features for profit/loss scenarios.
- Added error handling for robust calculations and strategy setup.
-
Probability Analysis for Strangle Strategies (#36):
- Enhanced
ShortStrangle
andLongStrangle
with expected value, profit/loss ranges, and extreme probability calculations. - Includes default probability handling and new test cases.
- Enhanced
2. Enhancements and Fixes
-
Error Handling:
- Refactored
max_profit
andmax_loss
methods across multiple strategies to returnResult
types. - Improved robustness by handling potential
None
values with defaults.
- Refactored
-
Performance Improvements:
- Updated the
statrs
crate to v0.18.0 for better compatibility and performance.
- Updated the
-
Code Cleanups:
- Removed trailing whitespace and redundant inline comments across the codebase.
- Refactored validation logic for clarity and reduced duplication.
3. Tooling and Utility Scripts
- Added a script to detect and process Spanish comments in the codebase, aiding in translation management.
4. General Improvements
- Reorganized imports and modules for better clarity and maintainability.
- Updated project structure by introducing workspaces for improved modularity.
Documentation and Versioning
- Version Bump:
- Updated
Cargo.toml
andREADME.md
to reflect the new version0.2.3
.
- Updated
Testing
- Comprehensive test coverage for all new strategies and features.
- Validated edge cases for large, small, or invalid input values.
- Verified profit/loss calculations and visualizations under various conditions.
Labels
release
, enhancement
, new strategies
, testing
, code cleanup
Additional Notes
This release prepares the library for broader use cases and ensures alignment with project standards for maintainable and reusable code.
v0.2.2
Release Summary for Version 0.2.2
Major Updates
-
Implementation of Strategies:
- Added the Poor Man's Covered Call (PMCC) strategy, including utility methods for optimizing profit area and profit ratio. Introduced unit tests to ensure robustness and reliability.
- Refactored the Call Butterfly Strategy with enhanced validation, updated max profit and loss calculations, and improved strategy logic for better reliability and accuracy.
-
Enhancements in Code and Type Safety:
- Updated
total_cost
andmax_loss
methods to returnPositiveF64
, improving type safety and clarity. - Implemented the
Sum
trait forPositiveF64
, simplifying accumulation operations in various strategy calculations. - Added
PartialEq
to financial option enums,Position
,ExoticParams
, andOptionData
structs to facilitate comparisons and improve testing capabilities.
- Updated
-
Optimization of Custom Strategies:
- Introduced
best_area
andbest_ratio
methods for custom strategy optimization, enabling better evaluation of profitability metrics. - Refactored break-even calculations and range evaluations for improved accuracy and code clarity.
- Introduced
Fixes and Adjustments
-
Testing and Coverage:
- Expanded test coverage for strategy validation, profit/loss calculations, and position handling, including tests for
best_area
, random positions, and break-even scenarios. - Updated workflow settings for test coverage with a threshold of 75%, ensuring higher reliability and quality control.
- Expanded test coverage for strategy validation, profit/loss calculations, and position handling, including tests for
-
Code Refinements:
- Reorganized imports across modules to enhance readability and maintain consistency.
- Improved logging for strategies and validation processes, switching critical invalid option logs to
error
level for better traceability. - Refactored the handling of redundant methods and attributes, ensuring cleaner and more maintainable code.
-
Dependency Updates:
- Upgraded multiple dependencies, including
serde
,num-traits
, andasync-std
, ensuring compatibility with the latest versions and improved library performance.
- Upgraded multiple dependencies, including
New Features
-
Visualization Enhancements:
- Added new profit/loss charts for strategies such as strangles and custom strategies, providing better insights into profit areas and ratios.
-
Utility Improvements:
- Introduced methods like
update_from_option_data
andfilter_option_data
for streamlined option chain management. - Enhanced the random walk simulation functionality with updates to combination processing and new parameters for flexible strategy evaluation.
- Introduced methods like
This release focuses on expanding strategy functionality, improving type safety, and enhancing code maintainability, with substantial updates to testing and visualization tools.