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
/******************************************************************************
Author: Joaquín Béjar García
Email: jb@taunais.com
Date: 24/12/25
******************************************************************************/
//! # Liquidity Metrics Module
//!
//! Provides comprehensive liquidity metrics for options analysis, helping assess
//! market depth, trading activity, and positioning across different strikes.
//!
//! ## Core Features
//!
//! ### Bid-Ask Spread
//!
//! Measures the difference between bid and ask prices, indicating:
//! - Market liquidity at each strike
//! - Transaction costs for entering/exiting positions
//! - Market maker activity and competition
//!
//! - **Curve representation by strike**: Shows spread across all strikes
//!
//! ### Volume Profile
//!
//! Tracks trading activity across strikes and time:
//! - Identifies active trading zones
//! - Reveals market interest at specific price levels
//! - Helps identify support/resistance levels
//!
//! - **Curve representation by strike**: Current volume distribution
//! - **Surface representation (price vs time)**: Volume evolution over time
//!
//! ### Open Interest Distribution
//!
//! Shows outstanding contracts at each strike:
//! - Indicates where positions are concentrated
//! - Helps identify potential "max pain" levels
//! - Reveals market positioning and sentiment
//!
//! - **Curve representation by strike**: OI distribution across strikes
//!
//! ## Usage Examples
//!
//! ### Bid-Ask Spread Curve
//!
//! ```rust
//! use std::collections::BTreeSet;
//! use rust_decimal::Decimal;
//! use optionstratlib::curves::Curve;
//! use optionstratlib::error::CurveError;
//! use optionstratlib::metrics::BidAskSpreadCurve;
//!
//! struct MyBidAskSpread;
//!
//! impl BidAskSpreadCurve for MyBidAskSpread {
//! fn bid_ask_spread_curve(&self) -> Result<Curve, CurveError> {
//! // Custom logic to compute bid-ask spread by strike
//! Ok(Curve { points: BTreeSet::new(), x_range: (Decimal::ZERO, Decimal::ZERO) })
//! }
//! }
//! ```
//!
//! ### Volume Profile
//!
//! ```rust
//! use std::collections::BTreeSet;
//! use rust_decimal::Decimal;
//! use optionstratlib::curves::Curve;
//! use optionstratlib::error::{CurveError, SurfaceError};
//! use optionstratlib::surfaces::Surface;
//! use optionstratlib::metrics::{VolumeProfileCurve, VolumeProfileSurface};
//! use positive::Positive;
//!
//! struct MyVolumeProfile;
//!
//! impl VolumeProfileCurve for MyVolumeProfile {
//! fn volume_profile_curve(&self) -> Result<Curve, CurveError> {
//! // Custom logic to compute volume distribution by strike
//! Ok(Curve { points: BTreeSet::new(), x_range: (Decimal::ZERO, Decimal::ZERO) })
//! }
//! }
//!
//! impl VolumeProfileSurface for MyVolumeProfile {
//! fn volume_profile_surface(&self, _days: Vec<Positive>) -> Result<Surface, SurfaceError> {
//! // Custom logic to compute volume surface over time
//! Ok(Surface::new(BTreeSet::new()))
//! }
//! }
//! ```
//!
//! ### Open Interest Distribution
//!
//! ```rust
//! use std::collections::BTreeSet;
//! use rust_decimal::Decimal;
//! use optionstratlib::curves::Curve;
//! use optionstratlib::error::CurveError;
//! use optionstratlib::metrics::OpenInterestCurve;
//!
//! struct MyOpenInterest;
//!
//! impl OpenInterestCurve for MyOpenInterest {
//! fn open_interest_curve(&self) -> Result<Curve, CurveError> {
//! // Custom logic to compute open interest distribution by strike
//! Ok(Curve { points: BTreeSet::new(), x_range: (Decimal::ZERO, Decimal::ZERO) })
//! }
//! }
//! ```
pub use BidAskSpreadCurve;
pub use OpenInterestCurve;
pub use ;