autoapi_src.all_call ==================== .. py:module:: autoapi_src.all_call Functions --------- .. autoapisummary:: autoapi_src.all_call.european_option autoapi_src.all_call.asian_average_price_option autoapi_src.all_call.asian_average_strike_option autoapi_src.all_call.barrier_option autoapi_src.all_call.basket_option autoapi_src.all_call.digital_option autoapi_src.all_call.forward_start_option autoapi_src.all_call.lookback_fixed_option autoapi_src.all_call.lookback_float_option autoapi_src.all_call.ratchet_option autoapi_src.all_call.snowball_option Module Contents --------------- .. py:function:: european_option(simulation_num, time, initial_price, strike_price, rate, vol, call, discounting=True, mode='Q') Prices a European option using Monte Carlo simulation. This function calculates the price of a European call or put option using either a classical or a quantum-inspired Monte Carlo method. Parameters ---------- simulation_num : int The number of Monte Carlo simulation paths. time : int Time to expiration, in days. initial_price : float The initial price of the underlying asset. strike_price : float The strike price of the option. rate : float The risk-free interest rate. vol : float The volatility of the underlying asset. call : bool Specifies the option type. True for a call option, False for a put option. discounting : bool, optional Whether to apply discounting to the final payoff. Defaults to True. mode : {'Q', 'C'}, optional The calculation mode. 'Q' for Quantum-inspired Monte Carlo, 'C' for classical Monte Carlo. Defaults to 'Q'. Returns ------- float The calculated price of the European option. Raises ------ ValueError If an unsupported mode is provided. .. py:function:: asian_average_price_option(simulation_num, time, initial_price, strike_price, rate, vol, call, steps, discounting=True, mode='Q') Prices an Asian option with an average price payoff. The payoff is determined by the difference between the average asset price over the period and a fixed strike price. Parameters ---------- simulation_num : int The number of Monte Carlo simulation paths. time : int Time to expiration, in days. initial_price : float The initial price of the underlying asset. strike_price : float The fixed strike price of the option. rate : float The risk-free interest rate. vol : float The volatility of the underlying asset. call : bool Specifies the option type. True for a call option, False for a put option. steps : int The number of time steps to use in the simulation path. discounting : bool, optional Whether to apply discounting to the final payoff. Defaults to True. mode : {'Q', 'C'}, optional The calculation mode. 'Q' for Quantum-inspired, 'C' for classical. Defaults to 'Q'. Returns ------- float The calculated price of the Asian average price option. Raises ------ ValueError If an unsupported mode is provided. .. py:function:: asian_average_strike_option(simulation_num, time, initial_price, rate, vol, call, steps, discounting=True, mode='Q') Prices an Asian option with an average strike payoff. The payoff is determined by the difference between the final asset price and the average asset price over the period (which serves as the strike). Parameters ---------- simulation_num : int The number of Monte Carlo simulation paths. time : int Time to expiration, in days. initial_price : float The initial price of the underlying asset. rate : float The risk-free interest rate. vol : float The volatility of the underlying asset. call : bool Specifies the option type. True for a call option, False for a put option. steps : int The number of time steps to use in the simulation path. discounting : bool, optional Whether to apply discounting to the final payoff. Defaults to True. mode : {'Q', 'C'}, optional The calculation mode. 'Q' for Quantum-inspired, 'C' for classical. Defaults to 'Q'. Returns ------- float The calculated price of the Asian average strike option. Raises ------ ValueError If an unsupported mode is provided. .. py:function:: barrier_option(simulation_num, time, initial_price, strike_price, rate, vol, barrier, call, steps, knock_in, knock_up, discounting=True, mode='Q') Prices a barrier option. Calculates the price for various types of barrier options, including knock-in, knock-out, up-and-in, up-and-out, down-and-in, and down-and-out. Parameters ---------- simulation_num : int The number of Monte Carlo simulation paths. time : int Time to expiration, in days. initial_price : float The initial price of the underlying asset. strike_price : float The strike price of the option. rate : float The risk-free interest rate. vol : float The volatility of the underlying asset. barrier : float The price level of the barrier. call : bool Specifies the option type. True for a call option, False for a put option. steps : int The number of time steps to use in the simulation path. knock_in : bool True for a knock-in option, False for a knock-out option. knock_up : bool True for an "up" barrier, False for a "down" barrier. discounting : bool, optional Whether to apply discounting to the final payoff. Defaults to True. mode : {'Q', 'C'}, optional The calculation mode. 'Q' for Quantum-inspired, 'C' for classical. Defaults to 'Q'. Returns ------- float The calculated price of the barrier option. Raises ------ ValueError If an unsupported mode is provided. .. py:function:: basket_option(simulation_num, time, initial_price, strike_price, rate, vol, weight, cor_matrix, steps, call, mode='Q') Prices a basket option on multiple underlying assets. Parameters ---------- simulation_num : int The number of Monte Carlo simulation paths. time : int Time to expiration, in days. initial_price : list of float A list of initial prices for each asset in the basket. strike_price : float The strike price of the option. rate : float The risk-free interest rate. vol : list of float A list of volatilities for each asset. weight : list of float The weight of each asset in the basket. cor_matrix : array_like The correlation matrix for the assets in the basket. steps : int The number of time steps to use in the simulation path. call : bool Specifies the option type. True for a call option, False for a put option. mode : {'Q', 'C'}, optional The calculation mode. 'Q' for Quantum-inspired, 'C' for classical. Defaults to 'Q'. Returns ------- float The calculated price of the basket option. Raises ------ ValueError If an unsupported mode is provided. .. py:function:: digital_option(simulation_num, time, initial_price, strike_price, rate, vol, cash, call, discounting=True, mode='Q') Prices a digital (or binary) option. This option pays a fixed amount of cash if the underlying asset is above (for a call) or below (for a put) the strike price at expiration. Parameters ---------- simulation_num : int The number of Monte Carlo simulation paths. time : int Time to expiration, in days. initial_price : float The initial price of the underlying asset. strike_price : float The strike price of the option. rate : float The risk-free interest rate. vol : float The volatility of the underlying asset. cash : float The fixed cash amount to be paid if the option finishes in-the-money. call : bool Specifies the option type. True for a call option, False for a put option. discounting : bool, optional Whether to apply discounting to the final payoff. Defaults to True. mode : {'Q', 'C'}, optional The calculation mode. 'Q' for Quantum-inspired, 'C' for classical. Defaults to 'Q'. Returns ------- float The calculated price of the digital option. Raises ------ ValueError If an unsupported mode is provided. .. py:function:: forward_start_option(simulation_num, time_start, time, initial_price, rate, vol, call, discounting=True, mode='Q') Prices a forward start option. This is an option that becomes active at a future date, with its strike price determined by the asset price at that future date. Parameters ---------- simulation_num : int The number of Monte Carlo simulation paths. time_start : int The future time at which the option starts, in days. time : int The final expiration time of the option, in days. initial_price : float The initial price of the underlying asset at time 0. rate : float The risk-free interest rate. vol : float The volatility of the underlying asset. call : bool Specifies the option type. True for a call option, False for a put option. discounting : bool, optional Whether to apply discounting to the final payoff. Defaults to True. mode : {'Q', 'C'}, optional The calculation mode. 'Q' for Quantum-inspired, 'C' for classical. Defaults to 'Q'. Returns ------- float The calculated price of the forward start option. Raises ------ ValueError If an unsupported mode is provided. .. py:function:: lookback_fixed_option(simulation_num, time, initial_price, strike_price, rate, vol, steps, call, discounting=True, mode='Q') Prices a lookback option with a fixed strike price. The payoff is based on the difference between the optimal (max or min) price of the asset during its life and a fixed strike price. Parameters ---------- simulation_num : int The number of Monte Carlo simulation paths. time : int Time to expiration, in days. initial_price : float The initial price of the underlying asset. strike_price : float The fixed strike price of the option. rate : float The risk-free interest rate. vol : float The volatility of the underlying asset. steps : int The number of time steps to use in the simulation path. call : bool Specifies the option type. True for a call option, False for a put option. discounting : bool, optional Whether to apply discounting to the final payoff. Defaults to True. mode : {'Q', 'C'}, optional The calculation mode. 'Q' for Quantum-inspired, 'C' for classical. Defaults to 'Q'. Returns ------- float The calculated price of the lookback option with a fixed strike. Raises ------ ValueError If an unsupported mode is provided. .. py:function:: lookback_float_option(simulation_num, time, initial_price, rate, vol, steps, call, discounting=True, mode='Q') Prices a lookback option with a floating strike price. The strike price is set at the optimal (min or max) asset price observed during the life of the option. Parameters ---------- simulation_num : int The number of Monte Carlo simulation paths. time : int Time to expiration, in days. initial_price : float The initial price of the underlying asset. rate : float The risk-free interest rate. vol : float The volatility of the underlying asset. steps : int The number of time steps to use in the simulation path. call : bool Specifies the option type. True for a call option, False for a put option. discounting : bool, optional Whether to apply discounting to the final payoff. Defaults to True. mode : {'Q', 'C'}, optional The calculation mode. 'Q' for Quantum-inspired, 'C' for classical. Defaults to 'Q'. Returns ------- float The calculated price of the lookback option with a floating strike. Raises ------ ValueError If an unsupported mode is provided. .. py:function:: ratchet_option(simulation_num, time, initial_price, rate, vol, steps, call, discounting=True, mode='Q') Prices a ratchet (or cliquet) option. A ratchet option is a series of forward-start options where the gains are locked in at specified dates. Parameters ---------- simulation_num : int The number of Monte Carlo simulation paths. time : int Time to expiration, in days. initial_price : float The initial price of the underlying asset. rate : float The risk-free interest rate. vol : float The volatility of the underlying asset. steps : int The number of time steps (ratchet periods) to use. call : bool Specifies the option type. True for a call option, False for a put option. discounting : bool, optional Whether to apply discounting to the final payoff. Defaults to True. mode : {'Q', 'C'}, optional The calculation mode. 'Q' for Quantum-inspired, 'C' for classical. Defaults to 'Q'. Returns ------- float The calculated price of the ratchet option. Raises ------ ValueError If an unsupported mode is provided. .. py:function:: snowball_option(simulation_num, time, initial_price, rate, irate, vol, barrier_in, barrier_out, steps, discounting=True, mode='Q') Prices a snowball structured product. A snowball is a complex exotic option with knock-in and knock-out features, typically paying a coupon. Parameters ---------- simulation_num : int The number of Monte Carlo simulation paths. time : int Time to expiration, in days. initial_price : float The initial price of the underlying asset. rate : float The risk-free interest rate used for discounting. irate : float The coupon rate paid by the structure. vol : float The volatility of the underlying asset. barrier_in : float The knock-in barrier price. barrier_out : float The knock-out barrier price. steps : int The number of time steps (observation dates) to use. discounting : bool, optional Whether to apply discounting to the final payoff. Defaults to True. mode : {'Q', 'C'}, optional The calculation mode. 'Q' for Quantum-inspired, 'C' for classical. Defaults to 'Q'. Returns ------- float The calculated price of the snowball product. Raises ------ ValueError If an unsupported mode is provided.