Class OptionExpiration
Defined in File option_expiration.hpp
Inheritance Relationships
Base Type
public std::enable_shared_from_this< OptionExpiration >
Class Documentation
-
class OptionExpiration : public std::enable_shared_from_this<OptionExpiration>
Represents a collection of all options for an option expiration.
Public Functions
Constructs an OptionExpiration object.
- Parameters:
expiration – The expiration time.
underlying_dataset – The underlying dataset.
-
void setup()
Initializes the option expiration.
-
std::shared_ptr<OptionStrike> atm_option_strike() const
Retrieves the at-the-money option strike.
- Returns:
A shared pointer to the at-the-money option strike.
-
std::shared_ptr<OptionStrike> tightest_option_strike() const
Retrieves the option strike with the smallest bid ask spread.
- Returns:
A shared pointer to the option strike with the smallest bid ask spread.
-
std::vector<std::shared_ptr<OptionStrike>> get_option_strikes(const ObjectGetter<bool, OptionStrike> &filter =
[](std::shared_ptr< OptionStrike >) { return true;}) const Retrieves a list of option strikes that satisfy the given filter criteria.
- Parameters:
filter – A callable object that takes a
std::shared_ptr<OptionStrike>as input and returns a boolean indicating whether the strike should be included in the result. Defaults to including all strikes.- Returns:
A vector of shared pointers to
OptionStrikeobjects that satisfy the filter criteria.
-
std::shared_ptr<Option> create_option(double strike, OptionType type)
Creates a new option that belongs to this expiration with the specified strike price and option type.
- Parameters:
strike – The strike price of the option.
type – The type of the option (e.g., call or put).
- Returns:
A shared pointer to the newly created
Optionobject.
-
template<typename T>
inline std::vector<T> get_strike_values(const ObjectGetter<T, OptionStrike> &value_getter, const ObjectGetter<bool, OptionStrike> &filter =[](std::shared_ptr< OptionStrike >) { return true;}) const Retrieves a list of option strike values satisfying a given filter on option strikes.
- Template Parameters:
T – The return type.
- Parameters:
value_getter – Function to extract values from OptionStrike objects.
filter – Function to filter OptionStrike objects.
- Returns:
A vector of extracted values.
-
inline bool not_expired() const
Checks if the option expiration has not expired.
- Returns:
True if not expired, false otherwise.
-
inline bool expired() const
Checks if the option expiration has expired.
- Returns:
True if expired, false otherwise.
-
inline boost::posix_time::ptime get_expiration() const
Gets the expiration time.
- Returns:
The expiration time.
-
inline void set_expiration(boost::posix_time::ptime expiration)
Sets the expiration time.
- Parameters:
expiration – The new expiration time.
-
inline Estimate get_forward() const
Gets the estimated forward price.
- Returns:
The forward price estimate.
-
inline double get_forward_value() const
Gets the forward price value.
- Returns:
The forward price value.
-
inline double get_forward_uncertainty() const
Gets the forward price uncertainty.
- Returns:
The forward price uncertainty.
-
inline Estimate get_interest_rate() const
Retrieves the interest rate estimate.
- Returns:
The interest rate as an
Estimateobject.
-
inline double get_interest_rate_value() const
Retrieves the numerical value of the interest rate.
- Returns:
The interest rate value as a double.
-
inline double get_interest_rate_uncertainty() const
Retrieves the uncertainty of the interest rate estimate.
- Returns:
The uncertainty in the interest rate as a double.
-
inline Estimate get_borrow_rate() const
Retrieves the borrow rate estimate.
- Returns:
The borrow rate as an
Estimateobject.
-
inline double get_borrow_rate_value() const
Retrieves the numerical value of the borrow rate.
- Returns:
The borrow rate value as a double.
-
inline double get_borrow_rate_uncertainty() const
Retrieves the uncertainty of the borrow rate estimate.
- Returns:
The uncertainty in the borrow rate as a double.
-
inline StrikeMap get_strikes() const
Retrieves the all the option strikes with this expiration.
- Returns:
A map with strike value times strike multiplier as the key and option strike shared pointer as value.
-
inline unsigned int get_n_strikes() const
Retrieves the number of option strikes.
- Returns:
The number of option strikes as an unsigned integer.
-
inline double get_event_tenor() const
Retrieves the event tenor.
- Returns:
The event tenor as a double.
-
inline double get_variance_tenor() const
Retrieves the variance tenor.
- Returns:
The variance tenor as a double.
-
inline double get_hedge_tenor() const
Retrieves the hedge tenor.
- Returns:
The hedge tenor as a double.
-
inline double get_carry_tenor() const
Retrieves the carry tenor.
- Returns:
The carry tenor as a double.
Retrieves the all the options with this expiration.
- Parameters:
options – [out] A vector to store the retrieved options.
-
inline double get_vix_style_volatility() const
Retrieves the VIX-style volatility.
- Returns:
The VIX-style volatility as a double.
-
inline const Estimate &get_implied_forward() const
Retrieves the implied forward estimate.
- Returns:
A constant reference to the implied forward estimate.
-
inline double get_implied_forward_value() const
Retrieves the numerical value of the implied forward.
- Returns:
The implied forward value as a double.
-
inline double get_implied_forward_uncertainty() const
Retrieves the uncertainty of the implied forward estimate.
- Returns:
The uncertainty in the implied forward as a double.
-
inline double get_accumulated_fixed_dividend() const
Retrieves the accumulated fixed dividend upto this expiration.
- Returns:
The accumulated fixed dividend as a double.
-
inline double get_accumulated_proportional_dividend() const
Retrieves the accumulated proportional dividend upto this expiration.
- Returns:
The accumulated proportional dividend as a double.
-
inline Dividend get_accumulated_dividend() const
Retrieves the accumulated dividend upto this expiration.
- Returns:
The accumulated dividend as a
Dividendobject.
-
inline Estimate get_atm_volatility() const
Retrieves the at-the-money (ATM) volatility estimate.
- Returns:
The ATM volatility as an
Estimateobject.
-
Estimate get_atm_variance() const
Retrieves the at-the-money (ATM) variance estimate.
- Returns:
The ATM variance as an
Estimateobject.
-
double get_atm_volatility_value() const
Retrieves the numerical value of the ATM volatility.
- Returns:
The ATM volatility value as a double.
-
double get_fair_atm_volatility() const
Retrieves the fair at-the-money (ATM) volatility.
- Returns:
The fair ATM volatility as a double.
-
double get_stochastic_process_atm_volatility() const
Retrieves the stochastic process ATM volatility.
- Returns:
The stochastic process ATM volatility as a double.
For a given stochastic process, calculate forward ATM volatility.
- Returns:
Forward ATM volatility
For a given stochastic process, calculate variance.
- Returns:
variance
-
double get_fair_1_stdev_call_volatility() const
Retrieves the fair volatility at 1-standard deviation call strike.
- Returns:
The fair 1-standard deviation call volatility as a double.
-
double get_fair_1_stdev_put_volatility() const
Retrieves the fair volatility at 1-standard deviation put strike.
- Returns:
The fair 1-standard deviation put volatility as a double.
-
double get_fair_volatility_skew() const
Retrieves the fair volatility skew.
- Returns:
The fair volatility skew as a double.
-
double get_fair_volatility_model_reduced_chi2() const
Retrieves the fair volatility model fitting chi2.
- Returns:
The fair volatility model fitting chi2 as a double.
Computes the stochastic process ATM volatility.
- Parameters:
process – [in] A shared pointer to the stochastic process.
- Returns:
The stochastic process ATM volatility as a double.
Computes the stochastic process volatility at 1-standard deviation call strike.
- Parameters:
process – [in] A shared pointer to the stochastic process.
- Returns:
The stochastic process 1-standard deviation call volatility as a double.
Computes the stochastic process volatility at 1-standard deviation put strike.
- Parameters:
process – [in] A shared pointer to the stochastic process.
- Returns:
The stochastic process 1-standard deviation put volatility as a double.
-
double get_variance_term_structure_model_value() const
Retrieves the variance term structure model value.
- Returns:
The variance term structure model value as a double.
-
double get_variance_term_structure_core_model_value() const
Retrieves the variance term structure core model value.
- Returns:
The variance term structure core model value as a double.
-
double get_atm_volatility_uncertainty() const
Retrieves the uncertainty of the at-the-money (ATM) volatility.
- Returns:
The ATM volatility uncertainty as a double.
-
inline auto get_fair_volatility_model() const
Retrieves the calibrated fair volatility model.
- Returns:
A shared pointer to the calibrated fair volatility model.
-
inline auto get_poker_volatility_model() const
Retrieves the calibrated Poker volatility model.
- Returns:
The calibrated Poker volatility model.
-
inline auto get_smile_volatility_model() const
Retrieves the calibrated Smile volatility model.
- Returns:
The calibrated Smile volatility model.
-
inline auto get_grin_volatility_model() const
Retrieves the calibrated Grin volatility model.
- Returns:
The calibrated Grin volatility model.
-
inline auto get_smirk_volatility_model() const
Retrieves the calibrated Smirk volatility model.
- Returns:
The calibrated Smirk volatility model.
-
inline auto get_sneer_volatility_model() const
Retrieves the calibrated Sneer volatility model.
- Returns:
The calibrated Sneer volatility model.
-
inline auto get_chuckle_volatility_model() const
Retrieves the calibrated Chuckle volatility model.
- Returns:
The calibrated Chuckle volatility model.
-
inline auto get_giggle_volatility_model() const
Retrieves the calibrated Giggle volatility model.
- Returns:
The calibrated Giggle volatility model.
-
inline auto get_cubic_spline_volatility_model() const
Retrieves the calibrated cubic spline volatility model.
- Returns:
The calibrated cubic spline volatility model.
-
inline std::shared_ptr<StochasticProcess> get_stochastic_process() const
Retrieves the calibrated stochastic process used in the model.
- Returns:
A shared pointer to the calibrated stochastic process.
-
std::shared_ptr<OptionStrike> lowest_strike_with_bid_ask_volatility() const
Retrieves the lowest option strike with valid bid-ask volatility.
- Returns:
A shared pointer to the lowest strike with bid-ask volatility.
-
std::shared_ptr<OptionStrike> highest_strike_with_bid_ask_volatility() const
Retrieves the highest option strike with valid bid-ask volatility.
- Returns:
A shared pointer to the highest strike with bid-ask volatility.
-
std::shared_ptr<OptionStrike> lowest_strike_with_put_bid_ask_volatility() const
Retrieves the lowest option strike with valid put bid-ask volatility.
- Returns:
A shared pointer to the lowest strike with put bid-ask volatility.
-
std::shared_ptr<OptionStrike> highest_strike_with_call_bid_ask_volatility() const
Retrieves the highest option strike with valid call bid-ask volatility.
- Returns:
A shared pointer to the highest strike with call bid-ask volatility.
-
std::tuple<std::vector<double>, std::vector<std::string>, std::vector<std::vector<double>>> get_option_strike_dataframe() const
Retrieves a structured representation of option strike data.
- Returns:
A tuple containing vectors of option strike values, labels, and additional data.
Computes the implied borrow rate given a dividend schedule and an interest rate.
- Parameters:
dividend_schedule – [in] A shared pointer to the dividend schedule.
interest_rate – [in] The interest rate used for calculation.
borrow_tolerance – [in] Tolerance for the borrow rate estimation.
relative_forward_tolerance – [in] Tolerance for the relative forward price.
- Returns:
The estimated implied borrow rate.
Computes the implied interest rate given a dividend schedule and a borrow rate.
- Parameters:
dividend_schedule – [in] A shared pointer to the dividend schedule.
borrow_rate – [in] The borrow rate used for calculation.
rate_tolerance – [in] Tolerance for the interest rate estimation.
relative_forward_tolerance – [in] Tolerance for the relative forward price.
- Returns:
The estimated implied interest rate.
-
inline std::tuple<Estimate, Estimate, Estimate> get_jointly_implied_interest_borrow_forward() const
Retrieves the jointly implied interest, borrow and forward estimates.
- Returns:
A tuple containing the jointly implied interest, borrow rate and forward price estimates.
-
inline double get_jointly_implied_interest_value() const
Retrieves the numerical value of the interest part of the jointly implied interest and borrow.
- Returns:
The jointly implied interest rate value as a double.
-
inline double get_jointly_implied_borrow_value() const
Retrieves the numerical value of the borrow part of the jointly implied interest and borrow.
- Returns:
The jointly implied borrow rate value as a double.
-
inline double get_jointly_implied_forward_value() const
Retrieves the numerical value the early exercise premium (using jointly implied interest and borrow) adjusted put-call parity implied forward.
- Returns:
The value in the forward price as a double.
-
inline double get_jointly_implied_interest_uncertainty() const
Retrieves the numerical uncertainty of the interest part of the jointly implied interest and borrow.
- Returns:
The uncertainty in the implied interest rate as a double.
-
inline double get_jointly_implied_borrow_uncertainty() const
Retrieves the numerical uncertainty of the borrow part of the jointly implied interest and borrow.
- Returns:
The uncertainty in the implied borrow rate as a double.
-
inline double get_jointly_implied_forward_uncertainty() const
Retrieves the numerical uncertainty of the early exercise premium (using jointly implied interest and borrow) adjusted put-call parity implied forward.
- Returns:
The uncertainty in the forward price as a double.
-
void reset()
Resets the internal state of the object.
-
inline bool effective_european() const
-
inline std::shared_ptr<OptionCalculator<SPOT_VOLATILITY>> get_option_calculator()
Retrieves the option calculator for Greeks calculation.
- Returns:
A shared pointer to the option calculator.
Public Static Functions
-
static inline std::map<std::string, ObjectGetter<double, OptionExpiration>> _get_option_expiration_value_functions()
Friends
-
friend std::ostream &operator<<(std::ostream&, const OptionExpiration&)