1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
/******************************************************************************
Author: Joaquín Béjar García
Email: jb@taunais.com
Date: 18/12/25
******************************************************************************/
//! # Metrics Module
//!
//! This module provides comprehensive performance metrics tools for financial applications:
//! - Price Metrics (Volatility Skew, Put/Call Ratio, Strike Concentration)
//! - Risk Metrics (Implied Volatility, Risk Reversal, Dollar Gamma)
//!
//! ## Core Features
//!
//! ### Price Metrics
//!
//! - Volatility Skew: indicates variations in moneyness across options, revealing
//! insights into market sentiment and expectations. Skew patterns serve as valuable tools
//! for developing effective trading strategies. Volatility skew reflects differences in
//! moneyness among options with the same expiration but different strike prices, highlighting
//! market sentiment and expectations.
//! - Put Call Ratio: indicates if the investors are placing more bets on prices falling or rising.
//! It has been conceived to be a measure of market sentiment.
//! - Strike Concentration: identifies specific strike prices with unusually high open
//! interest or trading volume. It looks for clusters of activity where a large number of
//! contracts are concentrated.
//!
//! ### Risk Metrics
//!
//! - **Implied Volatility**: IV curves by strike and surfaces (strike vs time)
//! - **Risk Reversal**: Difference between call and put IV at same strike
//! - **Dollar Gamma**: Gamma exposure in dollar terms (Gamma × Spot² × 0.01)
//!
//! ## Usage Examples
//!
//! ### Volatility Skew
//!
//! ```rust
//! use std::collections::BTreeSet;
//! use rust_decimal::Decimal;
//! use optionstratlib::curves::Curve;
//! use optionstratlib::error::CurveError;
//! use optionstratlib::metrics::VolatilitySkewCurve;
//!
//! struct MySkew;
//!
//! impl VolatilitySkewCurve for MySkew {
//! fn volatility_skew(&self) -> Result<Curve, CurveError> {
//! // Custom logic to build and return a Curve representing the skew
//! let curve = Curve { points: BTreeSet::new(), x_range: (Decimal::ZERO, Decimal::ZERO) };
//! Ok(curve)
//! }
//! }
//! ```
//!
//! ### Put Call Ratio
//!
//! ```rust
//! use std::collections::BTreeSet;
//! use rust_decimal::Decimal;
//! use optionstratlib::curves::Curve;
//! use optionstratlib::error::CurveError;
//! use optionstratlib::metrics::PutCallRatioCurve;
//!
//! struct MyPcr;
//!
//! impl PutCallRatioCurve for MyPcr {
//! fn premium_weighted_pcr(&self) -> Result<Curve, CurveError> {
//! // Custom logic to build and return a Curve representing the premium
//! // weighted put/call ratio
//! let curve = Curve { points: BTreeSet::new(), x_range: (Decimal::ZERO, Decimal::ZERO) };
//! Ok(curve)
//! }
//! }
//! ```
//!
//! ### Strike Concentration
//!
//! ```rust
//! use std::collections::BTreeSet;
//! use rust_decimal::Decimal;
//! use optionstratlib::curves::Curve;
//! use optionstratlib::error::CurveError;
//! use optionstratlib::metrics::StrikeConcentrationCurve;
//!
//! struct MyStrikeConcentration;
//!
//! impl StrikeConcentrationCurve for MyStrikeConcentration {
//! fn premium_concentration(&self) -> Result<Curve, CurveError> {
//! // Custom logic to build and return a Curve representing the premium
//! // weighted strike concentration
//! let curve = Curve { points: BTreeSet::new(), x_range: (Decimal::ZERO, Decimal::ZERO) };
//! Ok(curve)
//! }
//! }
//! ```
//! ### Implied Volatility Curve
//!
//! ```rust
//! use std::collections::BTreeSet;
//! use rust_decimal::Decimal;
//! use optionstratlib::curves::Curve;
//! use optionstratlib::error::CurveError;
//! use optionstratlib::metrics::ImpliedVolatilityCurve;
//!
//! struct MyIVCurve;
//!
//! impl ImpliedVolatilityCurve for MyIVCurve {
//! fn iv_curve(&self) -> Result<Curve, CurveError> {
//! // Custom logic to build and return a Curve representing IV by strike
//! Ok(Curve { points: BTreeSet::new(), x_range: (Decimal::ZERO, Decimal::ZERO) })
//! }
//! }
//! ```
//!
//! ### Risk Reversal Curve
//!
//! ```rust
//! use std::collections::BTreeSet;
//! use rust_decimal::Decimal;
//! use optionstratlib::curves::Curve;
//! use optionstratlib::error::CurveError;
//! use optionstratlib::metrics::RiskReversalCurve;
//!
//! struct MyRRCurve;
//!
//! impl RiskReversalCurve for MyRRCurve {
//! fn risk_reversal_curve(&self) -> Result<Curve, CurveError> {
//! // Custom logic to build and return a Curve representing risk reversal
//! Ok(Curve { points: BTreeSet::new(), x_range: (Decimal::ZERO, Decimal::ZERO) })
//! }
//! }
//! ```
//!
//! ### Dollar Gamma Curve
//!
//! ```rust
//! use std::collections::BTreeSet;
//! use rust_decimal::Decimal;
//! use optionstratlib::curves::Curve;
//! use optionstratlib::error::CurveError;
//! use optionstratlib::metrics::DollarGammaCurve;
//! use optionstratlib::model::OptionStyle;
//!
//! struct MyDGCurve;
//!
//! impl DollarGammaCurve for MyDGCurve {
//! fn dollar_gamma_curve(&self, _option_style: &OptionStyle) -> Result<Curve, CurveError> {
//! // Custom logic to build and return a Curve representing dollar gamma
//! Ok(Curve { points: BTreeSet::new(), x_range: (Decimal::ZERO, Decimal::ZERO) })
//! }
//! }
//! ```
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;