qdpmc.products.products.SnowballProd

class qdpmc.products.products.SnowballProd(start_date, initial_price, ko_barriers, ko_ob_dates, ki_barriers, ki_ob_dates, ki_payoff, ko_coupon_rate, maturity_coupon_rate, calendar: Optional[qdpmc.dateutil.date.Calendar] = None)[source]

Bases: object

A snowball structure is an autocallable structured product with snowballing coupon payments.

Parameters
  • start_date (datetime.date) – A datetime.date object indicating the starting day of the structured product. It must be a trading as determined by calendar

  • initial_price (scalar) – The price of the underlying asset on start_date.

  • ko_barriers (scalar or array_like) – The knock-out level of the structure. It can either be a scalar or be an array of numbers. If a scalar is passed in, it will be treated as the time-invariant barrier level. If an array is passed in, it must match the length of ko_ob_dates.

  • ko_ob_dates (array_like) – The observation dates for knock-out. It must be an array of datetime.date objects. All of these dates must be trading dates as determined by calendar.

  • ki_barriers (scalar or array_like) – Similar to ko_barriers. It controls the level of knock-in barrier.

  • ki_ob_dates (array_like or "daily") – similar to ko_ob_dates. “daily” indicates daily observation for the knock-in event.

  • ki_payoff (qdpmc.tools.payoffs.Payoff) – Controls payoff which applies when, during the life of the contract, a knock-in event occurs while a knock-out does not.

  • ko_coupon_rate (scalar) – the coupon rate that applies in the event of a knock-out.

  • maturity_coupon_rate (scalar) – this rate applies when there is neither knock-out nor knock-in during the entire life of the contract.

  • calendar (qdpmc.dateutil.date.Calendar) – Calendar object. If None a default calendar will be used.

Note

The day count convention for coupon payment is ACT/365. The maturity is ko_ob_dates[-1]. Notional principal is equal to initial_price.

Examples

In [1]: import datetime

# instantiate a Calendar object so we can use it to generate periodic
# datetime.date array
In [2]: calendar = qm.Calendar()

# this should be a trading day
In [3]: start = datetime.date(2019, 1, 31)

In [4]: assert calendar.is_trading(start)

# monthly trading dates excluding the start
In [5]: monthly_dates = calendar.periodic(start, "1m", 13)[1:]

# a short put
In [6]: short_put = - qm.Payoff(qm.plain_vanilla, option_type="put",
   ...:                         strike=100)
   ...: 

# instantiate the structured product
In [7]: option = qm.SnowballProd(
   ...:     start_date=start, initial_price=100, ko_barriers=105,
   ...:     ko_ob_dates=monthly_dates, ki_barriers=80, ki_ob_dates="daily",
   ...:     ki_payoff=short_put, ko_coupon_rate=0.15,
   ...:     maturity_coupon_rate=0.15
   ...: )
   ...: 

In [8]: mc = qm.MonteCarlo(100, 1000)

In [9]: bs = qm.BlackScholes(0.03, 0, 0.25, 252)

# value the contract given day and spot price
In [10]: option.value(datetime.date(2019, 5, 7), 102, False, mc, bs)
Out[10]: 2.9503798980163807

Methods

__init__(start_date, initial_price, …[, …])

find_coup_rate(engine, process, target_pv[, …])

Give a target PV, find the coupon rate.

to_structure(valuation_date, spot, ki_flag)

Return the structure used to value the product.

value(valuation_date, spot, ki_flag, *args, …)

Value the product given a date and a spot price.

find_coup_rate(engine, process, target_pv, entropy=None, caller=None)[source]

Give a target PV, find the coupon rate.

entropy and caller are forwarded to qdpmc.engine.monte_carlo.MonteCarlo.calc()

to_structure(valuation_date, spot, ki_flag)[source]

Return the structure used to value the product.

value(valuation_date, spot, ki_flag, *args, **kwargs)[source]

Value the product given a date and a spot price. args and kwargs are positional and keyword arguments forwarded to qdpmc.engine.monte_carlo.MonteCarlo.calc()

Parameters
  • valuation_date (datetime.date) – the valuate date. It must be a trading day.

  • spot (scalar) – the spot price.

  • ki_flag (bool) – whether to mark the product as knock-in. If True, the structure is an up-and-out option.