optionstratlib-core
The core domain model of OptionStratLib: the types every other OptionStratLib crate builds on, with no pricing model, market data, strategy or presentation code.
| Module | Contents |
|---|---|
model |
Options, Position, Leg and its spot, future and perpetual legs, Trade, payoff contracts, checked Decimal helpers |
error |
DecimalError, OptionsError, PositionError, TradeError, OperationErrorKind |
utils |
TimeFrame and date helpers, deterministic RNG, numeric helpers, Len |
constants |
Library-wide numeric constants, market conventions and time units |
Monetary values are rust_decimal::Decimal or positive::Positive, and
arithmetic on them is checked.
Positive, ExpirationDate, Side, OptionStyle, OptionType and the
other foundational types come from the standalone positive,
expiration_date, financial_types and option_type crates. Core
re-exports them unchanged (the crate docs list every path), so a value from
any of those paths is the original type and needs no conversion.
Place in the workspace
- Depends on no other OptionStratLib crate; the foundational
positive,expiration_date,financial_typesandoption_type, which it re-exports. - Must not depend on every other OptionStratLib crate (it is the bottom
layer);
make check-graphenforces the layering (ADR-0001 D9). - In the facade: always present:
optionstratlib::{model, utils, constants}, the core errors inoptionstratlib::error, the root typesOptions,ExpirationDate,OptionStyle,OptionType,RainbowType,Sideand the root macros. The facade paths are the same types as the paths here; the ownership map lists every one with its feature.
Moving from 0.21? The 0.22 architecture and adoption guide maps each redesign to its replacement workflow; 0.22 keeps no compatibility with 0.21.
Minimal example
use OptionsError;
use ;
use pos_or_panic;
use dec;
Runnable example
A runnable program that depends on this crate directly, with the smallest
dependency set and no facade, is osl-example-direct-pricing; make tree-example-direct-pricing
asserts its resolved graph. Core is in every example's graph; this is the smallest program that uses it.
Features
| Feature | Default | Effect |
|---|---|---|
schema |
no | Derives utoipa::ToSchema on core types and enables it on positive, expiration_date, financial_types and option_type |
Most users depend on the optionstratlib facade, which re-exports this crate.
Depend on optionstratlib-core directly when you need only the domain types.
License
MIT