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
/******************************************************************************
Author: Joaquín Béjar García
Email: jb@taunais.com
Date: 1/8/24
******************************************************************************/
//! # Model Module
//!
//! This module provides core data structures and implementations for financial options modeling.
//! It includes fundamental components for option pricing, position management, and type definitions.
//!
//! ## Core Components
//!
//! * `option` - Implementation of the core Options structure and related functionality
//! * `position` - Management of financial positions and their properties
//! * `types` - Essential type definitions and enums
//! * `utils` - Utility functions for model operations and calculations
//! * `format` - Display and Debug implementations for model types
//! * `profit_range` - Calculations for profit/loss ranges
//!
//! ## Key Features
//!
//! ### Options
//!
//! Comprehensive implementation of financial options including:
//!
//! * Multiple option types (European, American, Asian, etc.)
//! * Greeks calculation (Delta, Gamma, Theta, etc.)
//! * Option pricing using various models
//! * Position management and profit/loss calculations
//!
//! ### Position Management
//!
//! Tools for managing financial positions:
//!
//! * Position tracking
//! * Cost basis calculations
//! * Profit/Loss analysis
//! * Break-even calculations
//! * Fee management
//!
//! ### Type System
//!
//! Robust type definitions ensuring type safety:
//!
//! * `Positive` for non-negative numbers
//! * `ExpirationDate` handling
//! * Option styles and types
//! * Side (Long/Short) definitions
//!
//! ### Formatting
//!
//! Comprehensive formatting support:
//!
//! * Display trait implementations for readable output
//! * Debug trait implementations for detailed inspection
//! * Consistent formatting across all types
//! * Custom format implementations for complex types
//!
//! ### Profit/Loss Analysis
//!
//! Tools for analyzing potential outcomes:
//!
//! * Profit range calculations
//! * Break-even point determination
//! * Probability calculations for price ranges
//! * Risk/reward analysis
//!
//! ## Example Usage
//!
//! ```rust
//! use rust_decimal_macros::dec;
//! use tracing::info;
//! use optionstratlib::{ExpirationDate, Options};
//! use optionstratlib::model::types::{ OptionStyle, OptionType, Side};
//! use positive::pos_or_panic;
//! use positive::Positive;
//!
//! let option = Options::new(
//! OptionType::European,
//! Side::Long,
//! "AAPL".to_string(),
//! Positive::HUNDRED,
//! ExpirationDate::Days(pos_or_panic!(30.0)),
//! pos_or_panic!(0.2),
//! Positive::ONE,
//! pos_or_panic!(105.0),
//! dec!(0.05),
//! OptionStyle::Call,
//! pos_or_panic!(0.01),
//! None,
//! );
//!
//! info!("Option Details: {}", option);
//! info!("Debug View: {:?}", option);
//! ```
/// Core utilities for handling decimal numbers in financial calculations.
/// Formatting utilities for displaying financial data and calculations.
/// Components for options contract modeling and analysis, including Greeks and pricing models.
/// Definitions and utilities for managing trading positions, including risk metrics and exposure tracking.
/// Tools for analyzing and visualizing profit ranges across different market scenarios.
/// Common type definitions used throughout the options strategy library.
/// Utility functions supporting various operations across the library.
/// Components for defining and working with chart axes in strategy visualizations.
/// Components for defining and working with expiration dates.
/// Components for different types of trading legs (spot, futures, perpetuals).
pub use BasicAxisTypes;
pub use *;
pub use ExpirationDate;
pub use ExpirationDateError;
pub use Options;
pub use Position;
pub use ProfitLossRange;
pub use ;
pub use ;