Expand description
§Option Type
Option contract type definitions including standard and exotic options.
This crate provides the OptionType enum which classifies options contracts
by their exercise characteristics and payoff structures:
- Standard: European, American
- Path-dependent: Asian, Barrier, Lookback, Cliquet
- Multi-asset: Rainbow, Spread, Exchange
- Structural: Compound, Chooser, Binary, Bermuda
- Modified payoff: Power, Quanto
It also provides sub-type enums used within exotic option variants:
AsianAveragingType— Arithmetic or Geometric averagingBarrierType— Up/Down and In/Out barrier conditionsBinaryType— Cash-or-nothing, Asset-or-nothing, GapLookbackType— Fixed or Floating strikeRainbowType— Best-of or Worst-of multi-asset
And the lightweight OptionBasicType struct for referencing core option properties.
All leaf enums use #[repr(u8)] for compact memory layout.
Pure helper methods are annotated with #[must_use] and #[inline].
§Features
- Full
serdeserialization/deserialization support - Optional
utoipasupport for OpenAPI schema generation (enable theutoipafeature) - Depends on
financial_typesforOptionStyleandSide - Depends on
positiveforPositivetype-safe values - Depends on
expiration_dateforExpirationDate
§Usage
use option_type::{OptionType, AsianAveragingType, BarrierType};
let european = OptionType::European;
let asian = OptionType::Asian {
averaging_type: AsianAveragingType::Arithmetic,
};
let barrier = OptionType::Barrier {
barrier_type: BarrierType::UpAndIn,
barrier_level: 120.0,
rebate: None,
};
assert_eq!(format!("{european}"), "European Option");
assert!(european.is_european());
assert!(asian.is_exotic());Modules§
- prelude
- Prelude module for convenient imports.
Structs§
- Option
Basic Type - A structure representing the basic properties of an option in financial terms.
Enums§
- Asian
Averaging Type - Describes how the average price is calculated for Asian options.
- Barrier
Type - Describes the type of barrier for Barrier options.
- Binary
Type - Represents different types of binary options, which are financial instruments that provide a fixed payout based on whether certain conditions are met.
- Lookback
Type - Describes the type of lookback option.
- Option
Type - Represents the type of option in a financial context.
- Rainbow
Type - Describes the type of rainbow option based on how multiple assets are combined.