autoapi_src.all_call

Functions

european_option(simulation_num, time, initial_price, ...)

Prices a European option using Monte Carlo simulation.

asian_average_price_option(simulation_num, time, ...)

Prices an Asian option with an average price payoff.

asian_average_strike_option(simulation_num, time, ...)

Prices an Asian option with an average strike payoff.

barrier_option(simulation_num, time, initial_price, ...)

Prices a barrier option.

basket_option(simulation_num, time, initial_price, ...)

Prices a basket option on multiple underlying assets.

digital_option(simulation_num, time, initial_price, ...)

Prices a digital (or binary) option.

forward_start_option(simulation_num, time_start, time, ...)

Prices a forward start option.

lookback_fixed_option(simulation_num, time, ...[, ...])

Prices a lookback option with a fixed strike price.

lookback_float_option(simulation_num, time, ...[, ...])

Prices a lookback option with a floating strike price.

ratchet_option(simulation_num, time, initial_price, ...)

Prices a ratchet (or cliquet) option.

snowball_option(simulation_num, time, initial_price, ...)

Prices a snowball structured product.

Module Contents

autoapi_src.all_call.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_numint

The number of Monte Carlo simulation paths.

timeint

Time to expiration, in days.

initial_pricefloat

The initial price of the underlying asset.

strike_pricefloat

The strike price of the option.

ratefloat

The risk-free interest rate.

volfloat

The volatility of the underlying asset.

callbool

Specifies the option type. True for a call option, False for a put option.

discountingbool, 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.

autoapi_src.all_call.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_numint

The number of Monte Carlo simulation paths.

timeint

Time to expiration, in days.

initial_pricefloat

The initial price of the underlying asset.

strike_pricefloat

The fixed strike price of the option.

ratefloat

The risk-free interest rate.

volfloat

The volatility of the underlying asset.

callbool

Specifies the option type. True for a call option, False for a put option.

stepsint

The number of time steps to use in the simulation path.

discountingbool, 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.

autoapi_src.all_call.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_numint

The number of Monte Carlo simulation paths.

timeint

Time to expiration, in days.

initial_pricefloat

The initial price of the underlying asset.

ratefloat

The risk-free interest rate.

volfloat

The volatility of the underlying asset.

callbool

Specifies the option type. True for a call option, False for a put option.

stepsint

The number of time steps to use in the simulation path.

discountingbool, 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.

autoapi_src.all_call.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_numint

The number of Monte Carlo simulation paths.

timeint

Time to expiration, in days.

initial_pricefloat

The initial price of the underlying asset.

strike_pricefloat

The strike price of the option.

ratefloat

The risk-free interest rate.

volfloat

The volatility of the underlying asset.

barrierfloat

The price level of the barrier.

callbool

Specifies the option type. True for a call option, False for a put option.

stepsint

The number of time steps to use in the simulation path.

knock_inbool

True for a knock-in option, False for a knock-out option.

knock_upbool

True for an “up” barrier, False for a “down” barrier.

discountingbool, 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.

autoapi_src.all_call.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_numint

The number of Monte Carlo simulation paths.

timeint

Time to expiration, in days.

initial_pricelist of float

A list of initial prices for each asset in the basket.

strike_pricefloat

The strike price of the option.

ratefloat

The risk-free interest rate.

vollist of float

A list of volatilities for each asset.

weightlist of float

The weight of each asset in the basket.

cor_matrixarray_like

The correlation matrix for the assets in the basket.

stepsint

The number of time steps to use in the simulation path.

callbool

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.

autoapi_src.all_call.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_numint

The number of Monte Carlo simulation paths.

timeint

Time to expiration, in days.

initial_pricefloat

The initial price of the underlying asset.

strike_pricefloat

The strike price of the option.

ratefloat

The risk-free interest rate.

volfloat

The volatility of the underlying asset.

cashfloat

The fixed cash amount to be paid if the option finishes in-the-money.

callbool

Specifies the option type. True for a call option, False for a put option.

discountingbool, 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.

autoapi_src.all_call.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_numint

The number of Monte Carlo simulation paths.

time_startint

The future time at which the option starts, in days.

timeint

The final expiration time of the option, in days.

initial_pricefloat

The initial price of the underlying asset at time 0.

ratefloat

The risk-free interest rate.

volfloat

The volatility of the underlying asset.

callbool

Specifies the option type. True for a call option, False for a put option.

discountingbool, 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.

autoapi_src.all_call.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_numint

The number of Monte Carlo simulation paths.

timeint

Time to expiration, in days.

initial_pricefloat

The initial price of the underlying asset.

strike_pricefloat

The fixed strike price of the option.

ratefloat

The risk-free interest rate.

volfloat

The volatility of the underlying asset.

stepsint

The number of time steps to use in the simulation path.

callbool

Specifies the option type. True for a call option, False for a put option.

discountingbool, 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.

autoapi_src.all_call.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_numint

The number of Monte Carlo simulation paths.

timeint

Time to expiration, in days.

initial_pricefloat

The initial price of the underlying asset.

ratefloat

The risk-free interest rate.

volfloat

The volatility of the underlying asset.

stepsint

The number of time steps to use in the simulation path.

callbool

Specifies the option type. True for a call option, False for a put option.

discountingbool, 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.

autoapi_src.all_call.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_numint

The number of Monte Carlo simulation paths.

timeint

Time to expiration, in days.

initial_pricefloat

The initial price of the underlying asset.

ratefloat

The risk-free interest rate.

volfloat

The volatility of the underlying asset.

stepsint

The number of time steps (ratchet periods) to use.

callbool

Specifies the option type. True for a call option, False for a put option.

discountingbool, 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.

autoapi_src.all_call.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_numint

The number of Monte Carlo simulation paths.

timeint

Time to expiration, in days.

initial_pricefloat

The initial price of the underlying asset.

ratefloat

The risk-free interest rate used for discounting.

iratefloat

The coupon rate paid by the structure.

volfloat

The volatility of the underlying asset.

barrier_infloat

The knock-in barrier price.

barrier_outfloat

The knock-out barrier price.

stepsint

The number of time steps (observation dates) to use.

discountingbool, 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.