Barrier Option
This module contains examples of barrier options.
OptionKO
dataclass
Bases: EventsMixin
In a Dn/Out Option the contract is cancelled if the underlying asset price falls below the barrier level on any of the barrier observation dates. In an Up/Out Option the contract is cancelled if the underlying asset price rises above the barrier level on any of the observation dates.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ccy |
str
|
the currency of the option. |
required |
asset_name |
str
|
the name of the underlying asset. |
required |
strike |
float
|
the option strike. |
required |
maturity |
datetime
|
the maturity of the option in years. |
required |
is_call |
bool
|
true if the option is a call. |
required |
barrier |
float
|
the barrier level. |
required |
barrier_type |
str
|
the type of barrier option, e.g "Dn/Out" or "Up/Out". |
required |
barrier_dates |
List[datetime]
|
the barrier observation points. |
required |
rebate |
float
|
the rebate amount paid at cancellation. |
0
|
track |
str
|
an optional identifier for the contract. |
''
|
Examples:
>>> start = datetime(2024, 3, 31)
>>> maturity = datetime(2024, 9, 30)
>>> barrier_dates = pd.date_range(start, maturity, freq="2ME")
>>> OptionKO("USD", "EQ", 100, maturity, True, 102, "Up/Out", barrier_dates).print_events()
time op quantity unit track
03/31/2024 ko 0.0 USD
05/31/2024 ko 0.0 USD
07/31/2024 ko 0.0 USD
09/30/2024 ko 0.0 USD
09/30/2024 > 0.0 USD
09/30/2024 + -100.0 USD
09/30/2024 + 1.0 EQ
Source code in qablet_contracts\eq\barrier.py
expressions()
Define the knockout expression (ko).