qdpmc.structures.autocalls.StandardSnowball¶
- class qdpmc.structures.autocalls.StandardSnowball(spot, barrier_out, barrier_in, ob_days_in, ob_days_out, ko_coupon, full_coupon)[source]¶
Bases:
qdpmc.structures.base.StructureMC
A standard snowball structure.
A standard snowball structure gives its holder a large payoff if the price of the underlying asset stays between a certain range. If the price of the underlying asset exceeds the knock-out barrier on any observation day, the contract ends immediately and coupon is paid to the holder with the amount depending on the day of knock-out. Major reason for large loss to the holder could be a plummet in the price of the underlying asset.
- Parameters
spot (scalar) – The spot (i.e. on the valuation day) of the price of the underlying asset.
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.
barrier_in (scalar or array_like) – The knock-in barrier level. Similar to barrier-out.
ob_days_in (array_like) – The observation day for knock-in. Must be an array of integers with each of its elements indicating the number of days that an observation day is away from the valuation day.
ob_days_out (array_like) – The observation day for knock-out. Similar to ob_days_in.
ko_coupon (array_like) – Coupon paid to the holder in a knock-out event. Must match the length of ob_days_out. Note that this should be specified in absolute amounts, not in percentages.
full_coupon (scalar) – Coupon paid to the holder if the contract survives to maturity day without knock-out or knock-in. Note that this should be specified in absolute amounts, not in percentages.
Examples
In [1]: option = qm.StandardSnowball( ...: spot=100, ...: barrier_out=105, ...: barrier_in=80, ...: ob_days_in=np.linspace(1, 252, 252), ...: ob_days_out=np.linspace(1, 252, 12), ...: ko_coupon=np.linspace(1, 15, 12), ...: full_coupon=15 ...: ) ...: In [2]: mc = qm.MonteCarlo(125, 800) In [3]: bs = qm.BlackScholes(0.03, 0, 0.25, 252) In [4]: option.calc_value(mc, bs, request_greeks=True) Out[4]: {'PV': -1.0192294216139468, 'Delta': 0.42279338844788406, 'Gamma': -0.05096704937256796, 'Rho': 37.40840169073009, 'Vega': -43.42512256762201, 'Theta': 0.00014635198684496346}
Methods
__init__
(spot, barrier_out, barrier_in, …)A standard snowball structure.
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.