Releases: joaquinbejar/OptionStratLib
v0.6.1
Release Notes: Version 0.6.1 – Strategy Enhancements, Refactoring, and Visualization Improvements
Summary
This beta release introduces a new Custom Strategy type, improved profit/loss chart visualizations, and expanded simulator configuration capabilities.
Significant refactoring enhances code clarity, consistency, and maintainability, while reliability improvements target chart export stability under concurrency.
Documentation, dependency updates, and test coverage expansions round out the release.
What's New
- Custom Strategy Type: Fully integrated into the execution flow and module structure, enabling user-defined strategies without core modifications.
- Visual Enhancements:
- New Short Strangle profit/loss chart for clearer trade performance visualization.
- Updated Iron Condor chart image for improved readability.
- Simulator Enhancements:
- Increased simulation size and steps.
- Adjusted initial price and volatility parameters for more realistic backtests.
Enhancements
-
Refactoring:
- Streamlined
OptionBasicType
handling with explicit lifetimes and cleaner conditional logic. - Simplified and standardized logic in
profit_range.rs
,plotly.rs
,csv.rs
,core.rs
, andfile.rs
. - Unified parent directory creation logic in
file.rs
. - Standardized strategy descriptions and added inline documentation.
- Applied
test_strategy_traits
macros broadly to ensure trait coverage across strategies. - Implemented
Default
trait for all strategies with meaningful default values. - Exposed public constants and fields in multiple strategy structs for easier external access.
- Replaced
todo!()
withunimplemented!()
and removed obsolete comments.
- Streamlined
-
Testing & Reliability:
- Added retry logic for PNG/SVG chart exports to handle concurrency issues.
- Enhanced test logging for easier debugging.
Bug Fixes
- Corrected package name typo in
Cargo.toml
forexamples_strategies_best
. - Fixed redundant scripts and improved HTML structure in
bull_call_spread_profit_loss_chart.html
. - Removed unused
.gitignore
files, outdated documentation, and deprecated trace bindings. - Eliminated unnecessary whitespace in README for formatting consistency.
Documentation Updates
- Updated README and docs to reflect new feature sets and strategy capabilities.
- Added examples for the new
Custom
strategy and updated visual references. - Removed outdated docs and redundant files.
- Updated Codecov configuration: patch coverage target and threshold set to 0%.
Migration Notes
- Compatibility: Existing strategies remain fully compatible.
- New Strategy Integration: Developers can now create custom strategies without altering core modules.
- Recommended Update: Upgrade to benefit from enhanced simulation parameters and visualization features.
Release Links
v0.6.0
Release Notes: Version 0.6.0 - Full Strategy Trait Integration and Testing Overhaul
Summary
This beta release marks a major advancement in the strategy module with comprehensive trait implementation across all core strategies, improved unit test infrastructure, and significant refactors for formatting, simulation configuration, and code maintainability. It sets the foundation for a more robust, extensible, and well-tested codebase.
⸻
What’s New
• Complete Trait Coverage: All major strategies (e.g., LongCall, ShortPut, IronCondor) now fully implement critical traits including StrategyConstructor, Optimizable, ProbabilityAnalysis, Greeks, PnLCalculator, and Strategable.
• Testing Macro: Introduced test_strategy_traits macro to streamline and expand trait compliance checks across strategy implementations.
• Payoff Utility: Added get_point_at_price method to the Payoff struct for improved PnL visualization.
⸻
Enhancements
• Implemented Default trait for all strategy types with meaningful default field values.
• Made key strategy struct fields and constants public to support greater configurability.
• Improved simulation configuration readability by refactoring random_walk_chain parameters.
• Enhanced formatting consistency using get_x_days_formatted across strategy outputs.
• Standardised format! usage across the codebase using shorthand syntax.
• Refined strategy descriptions and added documentation comments.
⸻
Bug Fixes
• Fixed misleading error messages in implied volatility validation to enhance the user experience.
• Corrected edge case handling for zero DTE options in implied volatility and Greeks calculations.
⸻
Breaking Changes
• None reported in this beta. All changes aim for backwards compatibility.
⸻
Documentation Updates
• Removed deprecated .gitignore files and outdated documentation assets.
• Updated public field annotations and strategy comments for better inline clarity.
⸻
Migration Notes
• No migration steps required for existing users.
• Recommend updating to this beta to benefit from improved trait support and testing reliability.
⸻
Release Links
• Full Changelog
• Updated Documentation
v0.5.8
Release Notes: Version 0.5.8 – Format Refactors, Extended Position Metadata, and Zero-DTE Support
Summary
This beta release focuses on improving code readability through widespread refactoring, enriching the core data model with new metadata fields, and bolstering test coverage for zero-days-to-expiration (DTE) options. Key highlights include shorthand format!
syntax, a new Makefile target for scoped lint fixes, and the introduction of epic
and extra_fields
on various structs to support richer risk and strategy metadata.
What’s New
- Extended Position Metadata
Added two optional fields—epic
(an instrument identifier) andextra_fields
(a catch-all metadata map)—to the following types:Position
(including constructors, serialization, and tests)OptionData
SPANMargin
RandomPositionsParams
- Zero-DTE Option Tests
Introduced new test cases that exercise implied volatility and Greeks calculations for options with zero days to expiration, ensuring correct handling of edge-case pricing scenarios.
Enhancements
- Shorthand
format!
Syntax
Refactored allformat!
invocations to the new{…}
shorthand placeholder syntax for improved readability and consistency. - Makefile Improvements
Added alint-fix-plotly
target that applies Clippy fixes scoped to the vendor/plotly code, streamlining maintenance of the embedded Plotly Rust library. - Documentation & Build Tweaks
- Removed unused offline JavaScript inclusion methods from examples.
- Updated
.gitignore
to exclude/coverage/tarpaulin-report.html
. - Bumped version to
0.5.8
inCargo.toml
and updated the library documentation header accordingly.
- Merge Conflict Resolutions
Synchronised and resolved conflicts in Plotly vendor files (plot.rs
,field_setter.rs
) to stay aligned with upstream changes.
Bug Fixes
- Redundant Initialization
Fixed a redundantNone
initialization inlegs.rs
to prevent unnecessary allocations and eliminate a minor logic inconsistency.
Breaking Changes
- New Optional Fields
The introduction ofepic
andextra_fields
extends several core types. These fields default toNone
or empty values, but downstream code performing strict struct pattern matching or manual deserialization should be updated to handle the extended types gracefully.
Documentation Updates
- README.md
Updated to reflect the version bump and to include basic examples demonstrating how to supplyepic
andextra_fields
. - Library Docs
Header and metadata updated to0.5.8
throughout the crate’s documentation.
Migration Notes
- No manual migration steps are required for most users—new fields are optional and use sensible defaults.
- If you perform custom (de)serialization or pattern matching on
Position
,OptionData
,SPANMargin
, orRandomPositionsParams
, please update your code to accommodate the two new optional fields.
Release Links
v0.5.7
Release Notes: Version v0.5.7 – Market Metadata on Positions and Related Structures
Summary
This beta release extends core data structures with market metadata support. We’ve introduced two new fields—epic
(market identifier) and extra_fields
(generic metadata map)—across the Position
, OptionData
, SPANMargin
, and RandomPositionsParams
structs. In addition, redundant initializations have been cleaned up for a leaner codebase. All constructors, serialization logic, and tests have been updated to ensure backward compatibility.
What’s New
- Market Identifier (
epic
)
Added anepic: String
field to:Position
structOptionData
structSPANMargin
default initializerRandomPositionsParams
constructor
- Metadata Map (
extra_fields
)
Introducedextra_fields: HashMap<String, Value>
onPosition
andSPANMargin
for extensible, user-defined metadata.
Enhancements
- Propagated
epic
andextra_fields
into all modules that construct or consume positions:- Risk scenarios
- Chain generation
- Strategies, benchmarks, and example scripts
- Cleaned up code by removing redundant
None
initializations in:legs.rs
others.rs
Bug Fixes
- N/A: No functional bugs were introduced; redundant code removed to improve maintainability.
Breaking Changes
- None. Both new fields include sensible defaults (
""
forepic
, empty map forextra_fields
), so existing public APIs remain compatible.
Documentation Updates
- Pending: User-facing docs and CLI help text will be updated in a follow-up PR to reflect the new metadata capabilities.
Migration Notes
- No action required for existing code.
- If you serialize/deserialise custom Position data, you can now include the
epic
andextra_fields
keys; older data without these fields will continue to deserialize correctly thanks to default values.
Release Links
v0.5.6
Release Notes: Version 0.5.6 - Improved Strategy Access and Utilities
Summary
This beta release focuses on improving code clarity and maintainability by adjusting visibility modifiers, introducing utility methods for easier data handling, and refining documentation. It also includes a temporary adjustment to code coverage thresholds.
⸻
What’s New
• Utility Methods: Added new helper functions to efficiently retrieve unique positions and options, streamlining data access and manipulation.
⸻
Enhancements
• Visibility Modifiers Update: Revised visibility in the short_strangle module to better encapsulate functionality and support safer usage.
• Documentation Revision: Improved and updated inline documentation to reflect recent changes and support developer understanding.
⸻
Bug Fixes
• No explicit bug fixes are included in this release.
⸻
Breaking Changes
• None.
⸻
Documentation Updates
• Updated internal documentation in affected modules, particularly around short_strangle and the new utility methods.
⸻
Migration Notes
• No changes required for migration. Projects depending on prior versions can upgrade without modification.
• Note: Code coverage target has been temporarily lowered to 45% to accommodate recent changes and ongoing refactoring.
⸻
Release Links
• Full Changelog
v0.5.5
Merge pull request #175 from joaquinbejar/release/v0.5.5-beta.1 Release/v0.5.5
v0.5.4
Release Notes: Version 0.5.4 - Enhanced Delta Neutrality Validation
Summary
This release focuses on refining the delta neutrality logic for strategy validation, improving internal utilities, and ensuring cleaner project structure. Key improvements target more accurate strike selection for neutral strategies like ShortStrangle
.
What's New
- Version Bump: Upgraded project version to
0.5.4
, with updates toCargo.toml
, documentation, and README.
Enhancements
- Improved delta neutrality logic in the
utils
module:- Enhanced validation checks for non-zero and opposite-sign deltas.
- Enforced stricter criteria to ensure better neutrality in strategy setup.
- Improved error messages for better debugging and understanding of delta constraints.
- Refined the
short_strangle
strategy logic to match strictear neutrality definitions. - Removed trailing whitespace across files to improve code cleanliness and consistency.
Bug Fixes
- Fixed delta validation logic in the
ShortStrangle
implementation:- Ensures correct strike selection by validating that the put delta is negative and below the negative target, while the call delta is positive and above the positive target.
- Prevents use of zero delta values which can cause non-neutral configurations.
Documentation Updates
- Updated the README and internal documentation to reflect changes in version
0.5.4
and improvements in delta neutrality enforcement.
Migration Notes
- No breaking changes introduced. Existing users can update to this version safely.
- Recommended for users relying on precise delta-neutral strategies to ensure better positioning.
v0.5.3
Release Notes: Version 0.5.3 - Delta Neutrality Fixes for Short Strangle
Summary
This emergency patch addresses critical issues in delta neutrality calculations for the short_strangle
strategy. It also brings improvements in validation logic, code structure, and test coverage to ensure more reliable and accurate execution.
What's New
generate_delta_adjustments
Function: Newly implemented method for calculating delta adjustments with improved precision and robust error handling.
Enhancements
- Fully refactored delta adjustment logic: simplified contract calculations, removed redundant code, and improved error handling.
- Separated call and put implied volatility handling in the
short_strangle
strategy for more accurate modeling. - Enhanced delta neutrality validation by checking total size and improving error messages.
- Updated visualizations with enriched Plotly features.
- General code cleanup: removed unused imports, redundant spacing, and standardized numeric formatting.
Bug Fixes
- Fixed incorrect delta adjustment logic that produced inaccurate results in certain configurations.
- Improved error handling for failed delta adjustment generation to prevent silent failures.
- Refined delta neutrality validation logic for greater accuracy and robustness.
Documentation Updates
- Updated in-code comments to clarify delta adjustment logic.
- Enhanced test suite structure and readability.
Migration Notes
- No breaking changes introduced. Users are strongly encouraged to update to benefit from the critical fixes and enhancements.
v0.5.2
Release v0.5.2: Plotly Visualization, Code Cleanup, and Macro Improvements
Description
This pull request delivers the beta version v0.5.2-beta.1
, introducing substantial improvements across plotting, macro utilities, testing, and internal structure. A major enhancement includes integrating plotly.rs
for visualizing strategy payoffs, particularly for the short strangle strategy. Furthermore, the codebase has undergone systematic cleanup, documentation enrichment, macro expansion, and dependency management refinement—enhancing maintainability, clarity, and usability.
Changes Made
-
Visualization Enhancements:
- Integrated
plotly.rs
to visualize profit/loss charts. - Added new short strangle P/L visualization with segment coloring and zero lines.
- Enabled Plotly features (
kaleido
) in the library. - Improved HTML output and formatting of embedded plots.
- Integrated
-
Macro and Trait Refactoring:
- Added
impl_json_display_pretty
,impl_json_debug_pretty
for structured JSON output. - Refactored usage of
pos!
and standardized withspos!
for signed positive numbers. - Improved macro coverage with unit tests.
- Added
-
Library and Code Cleanup:
- Removed deprecated
CustomStrategy
implementation. - Eliminated unused functions and variables in pricing utilities.
- Migrated to workspace-based dependency configuration.
- Cleaned up stray whitespaces, improved module declarations, and test formatting.
- Removed old
plotly.rs
files and re-vendored with updates.
- Removed deprecated
-
Testing Improvements:
- Enhanced test coverage for
OptionData
,OptionChain
, and macro utilities. - Improved error handling and assertions for numerical stability in implied volatility calculations.
- Updated option semantics in tests for consistency (
SP500
→AAPL
).
- Enhanced test coverage for
-
Documentation and Usability:
- Added inline documentation for key traits, macros, and methods.
- Introduced structured example outputs and adjusted builder parameter defaults.
Testing
-
Unit Tests:
- Verified new macros and visual components.
- Tested
calculate_iv
utility across edge cases like zero DTE. - Validated
OptionData
andOptionChain
behavior with updated parameters.
-
Manual Testing:
- Manually confirmed correctness of generated plots.
- Verified P/L visualization against known strategies.
-
Refactoring Validation:
- Ensured compilation and execution across updated binaries and examples.
- Confirmed logging consistency via
setup_logger
across example bins.
Screenshots/Examples
- Embedded plotly charts for short strangle and short straddle.
- Updated HTML files showing visual enhancements.
Additional Notes
- This release significantly improves maintainability by standardizing formatting, macros, and plot generation logic.
- Follow-up work includes further extending visualization support for other strategies and refining macro ergonomics.
References
- Supersedes earlier
plotly.rs
visual patches and macro improvements.
Checklist
- Code changes reviewed and linted.
- Documentation updated with inline and example-based explanations.
- All unit and integration tests pass.
- Plotly visualization manually verified.
- Redundant code and dependencies removed.
v0.5.1
Release v0.5.1: Improved Implied Volatility Calculation, Refactors, and Documentation Enhancements
Description
This pull request finalizes the v0.5.1
beta release, which introduces major improvements to implied volatility (IV) calculations, enhanced macro and type handling, refactors for consistency, and expanded documentation. The release also includes updated test cases, parameter handling improvements, and utility enhancements aimed at improving code clarity, maintainability, and performance, particularly for edge cases in options pricing.
Changes Made
-
Implied Volatility Enhancements:
- Introduced
calculate_iv
utility. - Replaced Newton-Raphson with parallelized brute-force search for better performance and accuracy.
- Improved clamping, error handling, and test coverage, especially for zero DTE scenarios.
- Introduced
-
Macro and Type Refactors:
- Standardized
pos!
tospos!
usage for consistency in signed positive values. - Updated
Positive
type withsub_or_zero
,sub_or_none
methods. - Improved
Display
/Debug
trait macros with pretty JSON formatting.
- Standardized
-
Documentation and Usability:
- Added inline documentation to key methods, macros, and types like
OptionData
. - Refined parameter naming and removed unused variables in simulation and test files.
- Added inline documentation to key methods, macros, and types like
-
Parameter and Utility Updates:
- Updated
OptionDataPriceParams
,OptionChainBuildParams
to useSome(...)
consistently. - Enhanced
OptionData
to support optionalextra_fields
.
- Updated
-
Test Refactors and Additions:
- Adjusted expectations, reduced error margins, and improved test clarity.
- Removed deprecated test data, unused variables, and renamed parameters for clarity.
Testing
- Unit Tests: Extensive coverage for all new utilities, especially
calculate_iv
. - Edge Cases: Special focus on zero volatility, zero DTE options, and non-convergent scenarios.
- Manual Testing: Verified changes in simulation output and test harness consistency.
Screenshots/Examples
Not applicable for this update.
Additional Notes
- This release significantly improves robustness for volatility calculation in high-frequency trading or short-dated options.
- Prepares the codebase for future integrations with visualization libraries like Plotly via the
plotly
andkaleido
features now enabled.
References
- Resolves multiple internal improvements aligned with issue themes on documentation clarity, IV computation, and macro usage consistency.
Checklist
- Code refactored for consistency and clarity.
- New utility methods and macros documented.
- All tests updated and passing.
- Version bumped to v0.5.1.
- README and Cargo.toml updated accordingly.