qdpmc.structures.autocalls.UpOutDownIn¶
- class qdpmc.structures.autocalls.UpOutDownIn(spot, upper_barrier_out, ob_days_out, rebate_out, lower_barrier_in, ob_days_in, payoff_in, payoff_nk)[source]¶
Bases:
qdpmc.structures.base.StructureMC
A structured products with a high barrier and a low barrier. The high barrier dominates the lower one in the sense that, when both a “knock-out” and a “knock-in” occur during the life of the product, the status is determined as “knock-out”.
- Parameters
spot (scalar) – The spot (i.e. on the valuation day) of the price of the underlying asset.
upper_barrier_out (scalar or array_like) – The knock-out barrier level. Can be either a scalar or an array. If a scalar is passed, it will be treated as the time- invariant level of barrier. If an array is passed, it must match the length of ob_days_out.
ob_days_out (array_like) – A 1-D array of integers specifying observation days. Each of its elements represents the number of days that an observation day is from the valuation day.
rebate_out (scalar or array_like) – The rebate of the option. If a constant is passed, then it will be treated as the time-invariant rebate paid to the option holder. If an array is passed, then it must match the length of ob_days.
lower_barrier_in (scalar or array_like) – Similar to upper_barrier_out.
ob_days_in (array_like) – Similar to ob_days_out.
payoff_in (
qdpmc.tools.payoffs.Payoff
) – Applies when there is a “knock-in” but no “knock-out”.payoff_nk (
qdpmc.tools.payoffs.Payoff
) – Applies when there is neither “knock-in” nor “knock-out”.
Methods
__init__
(spot, upper_barrier_out, …)A structured products with a high barrier and a low barrier.
calc_value
(engine, process, *args, **kwargs)Calculates the present value and Greeks of the option.
pv_log_paths
(log_paths, df)Calculate the present value given a set of paths and an array of discount factor.
Attributes
The array of days that the price of the underlying asset must be simulated to calculate the present value of the option.
The spot price of the underlying asset.
- calc_value(engine, process, *args, **kwargs)¶
Calculates the present value and Greeks of the option.
- Parameters
engine (
qdpmc.engine.monte_carlo.MonteCarlo
) – An instance of Engine which determines the number of iterations and the batch size.process (
qdpmc.model.market_process.Heston
orqdpmc.model.market_process.BlackScholes
) – Market process.args – Forwarded to
qdpmc.engine.monte_carlo.MonteCarlo.calc()
kwargs – Forwarded to
qdpmc.engine.monte_carlo.MonteCarlo.calc()
- pv_log_paths(log_paths, df)[source]¶
Calculate the present value given a set of paths and an array of discount factor.
- Parameters
log_paths (array_like) – A 2-D array containing the set of projections of the price of the underlying asset.
df (array_like) – A 1-D array specifying the discount factors.
- Returns
scalar – The present value of the option.
- property sim_t_array¶
The array of days that the price of the underlying asset must be simulated to calculate the present value of the option.
- property spot¶
The spot price of the underlying asset.