from enum import IntEnum
from derivitec.static_data import FxTypes
from derivitec.core.dict_builder_abstract import DictBuilderAbstract
[docs]
class TradablesType(DictBuilderAbstract):
_dotnet_namespace = ""
[docs]
class Contract(TradablesType):
[docs]
def __init__(self,
identifier=None):
"""
:param identifier: The security identifier
"""
self.identifier = identifier
def json_params(self):
params = [
'identifier',
]
return params
[docs]
class FullySpecified(Contract):
[docs]
def __init__(self,
currency=None,
expiration_date=None,
identifier=None):
"""
:param currency: The currency
:param expiration_date: The expiration date
:param identifier: The security identifier
"""
self.currency = currency
self.expiration_date = expiration_date
super(FullySpecified, self).__init__(
identifier=identifier)
def json_params(self):
params = [
'currency',
'expiration_date',
]
params += super(FullySpecified, self).json_params()
return params
[docs]
class TradableData(TradablesType):
[docs]
def __init__(self,
as_of_date=None,
contract=None,
tradable_id=None,
display_name=None):
"""
:param as_of_date: The as of date
:param contract: The contract
:param tradable_id: The tradable id
:param display_name: The contract display name
"""
self.as_of_date = as_of_date
self.contract = contract
self.tradable_id = tradable_id
self.display_name = display_name
def json_params(self):
params = [
'as_of_date',
'contract',
'tradable_id',
'display_name',
]
return params
[docs]
class DateCouponMap(TradablesType):
[docs]
def __init__(self,
date=None,
coupon=None):
"""
:param date: The date
:param coupon: The coupon
"""
self.date = date
self.coupon = coupon
def json_params(self):
params = [
'coupon',
'date',
]
return params
[docs]
class FxForward(FullySpecified):
[docs]
def __init__(self,
expiration_date=None,
fx_pair=None,
identifier=None,
is_spot_contract=None,
settlement_date=None,
settlement_type=None,
strike=None,
currency=None,
**kwargs):
"""
:param expiration_date: The expiration date
:param fx_pair: The fx pair
:param identifier: The security identifier
:param is_spot_contract: The is spot contract
:param settlement_date: The settlement date
:param settlement_type: The settlement type
:param strike: The strike
"""
self.fx_pair = fx_pair
self.is_spot_contract = is_spot_contract
self.settlement_date = settlement_date
self.settlement_type = settlement_type
self.strike = strike
super(FxForward, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'fx_pair',
'is_spot_contract',
'settlement_date',
'settlement_type',
'strike',
]
params += super(FxForward, self).json_params()
return params
[docs]
class FxFuture(FullySpecified):
[docs]
def __init__(self,
expiration_date=None,
fx_pair=None,
settlement_type=FxTypes.SettlementType.Cash,
currency=None,
identifier=None,
traded_price=None,
**kwargs):
"""
:param expiration_date: The expiration date
:param fx_pair: The fx pair
:param identifier: The security identifier
:param settlement_type: The settlement type
:param traded_price: The traded price
"""
self.fx_pair = fx_pair
self.settlement_type = settlement_type
self.traded_price = traded_price
super(FxFuture, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'fx_pair',
'settlement_type',
'traded_price'
]
params += super(FxFuture, self).json_params()
return params
[docs]
class Ascot(Contract):
[docs]
def __init__(self,
asset_swap_spread=None,
bond_identifier=None,
business_day_convention=None,
calendar_name=None,
coupon_rate=None,
day_count_convention=None,
end_stub=None,
end_to_end=None,
expiration_date=None,
identifier=None,
payment_lag=None,
period_str=None,
rate_asset_name=None,
roll_date=None,
start_date=None,
start_stub=None,
**kwargs):
"""
:param asset_swap_spread: The asset swap spread
:param bond_identifier: The bond identifier
:param business_day_convention: The business day convention
:param calendar_name: The calendar name
:param coupon_rate: The coupon rate
:param day_count_convention: The day count convention
:param end_stub: The end stub
:param end_to_end: The end to end
:param expiration_date: The expiration date
:param identifier: The security identifier
:param payment_lag: The payment lag
:param period_str: The period str
:param rate_asset_name: The rate asset name
:param roll_date: The roll date
:param start_date: The start date
:param start_stub: The start stub
"""
self.asset_swap_spread = asset_swap_spread
self.bond_identifier = bond_identifier
self.business_day_convention = business_day_convention
self.calendar_name = calendar_name
self.coupon_rate = coupon_rate
self.day_count_convention = day_count_convention
self.end_stub = end_stub
self.end_to_end = end_to_end
self.expiration_date = expiration_date
self.payment_lag = payment_lag
self.period_str = period_str
self.rate_asset_name = rate_asset_name
self.roll_date = roll_date
self.start_date = start_date
self.start_stub = start_stub
super(Ascot, self).__init__(
identifier=identifier)
def json_params(self):
params = [
'asset_swap_spread',
'bond_identifier',
'business_day_convention',
'calendar_name',
'coupon_rate',
'day_count_convention',
'end_stub',
'end_to_end',
'expiration_date',
'payment_lag',
'period_str',
'rate_asset_name',
'roll_date',
'start_date',
'start_stub',
]
params += super(Ascot, self).json_params()
return params
[docs]
class CodeSpecified(Contract):
[docs]
def __init__(self,
code=None,
identifier=None):
"""
:param code: The code
:param identifier: The security identifier
"""
self.code = code
super(CodeSpecified, self).__init__(identifier=identifier)
def json_params(self):
params = [
'code',
]
params += super(CodeSpecified, self).json_params()
return params
[docs]
class IBond(Contract):
[docs]
def __init__(self,
identifier=None):
"""
:param identifier: The security identifier
"""
super(IBond, self).__init__(identifier=identifier)
def json_params(self):
params = super(IBond, self).json_params()
return params
[docs]
class PositionEffect(TradablesType):
[docs]
def __init__(self,
contract=None,
quantity=None):
"""
:param contract: The contract
:param quantity: The quantity
"""
self.contract = contract
self.quantity = quantity
def json_params(self):
params = [
'contract',
'quantity',
]
return params
[docs]
class IEqContract(Contract):
[docs]
def __init__(self,
identifier=None):
"""
:param identifier: The security identifier
"""
super(IEqContract, self).__init__(identifier=identifier)
def json_params(self):
params = super(IEqContract, self).json_params()
return params
[docs]
class IRLeg(FullySpecified):
class AveragingMethods(IntEnum):
Null = 0
Weighted = 1
Unweighted = 2
OisCompounding = 3
class PaymentFrequencies(IntEnum):
Monthly = 4
Annual = 1
SemiAnnual = 2
Quarterly = 3
NotSet = -1
Weekly = 5
Term = 6
Every28Days = 7 # used by Mexican IRS
[docs]
def __init__(self,
averaging_method=None,
averaging_methods=None,
business_day_convention=None,
currency=None,
day_count_convention=None,
effective_date=None,
end_stub=None,
end_to_end=None,
expiration_date=None,
fixed_rates=None,
identifier=None,
next_cash_flow_index=None,
ois_compounding_frequency=None,
pay_notional_at_start=None,
payment_calendar=None,
payment_frequencies=None,
payment_frequency=None,
payment_lag=None,
period_end_dates_stored=None,
rate_asset_name=None,
receive_notional_at_end=None,
reset_calendar=None,
roll_date=None,
spreads=None,
start_stub=None,
use_imm_dates=None,
**kwargs):
"""
:param averaging_method: The averaging method
:param averaging_methods: The averaging methods
:param business_day_convention: The business day convention
:param currency: The currency
:param day_count_convention: The day count convention
:param effective_date: The effective date
:param end_stub: The end stub
:param end_to_end: The end to end
:param expiration_date: The expiration date
:param fixed_rates: The fixed rates
:param identifier: The security identifier
:param next_cash_flow_index: The next cash flow index
:param ois_compounding_frequency
:param pay_notional_at_start: The pay notional at start
:param payment_calendar: The payment calendar
:param payment_frequencies: The payment frequencies
:param payment_frequency: The payment frequency
:param payment_lag: The payment lag
:param period_end_dates_stored: The period end dates stored
:param rate_asset_name: The rate asset name
:param receive_notional_at_end: The receive notional at end
:param reset_calendar: The reset calendar
:param roll_date: The roll date
:param spreads: The spreads
:param start_stub: The start stub
:param use_imm_dates: The use IMM dates flag
"""
self.averaging_method = averaging_method
self.averaging_methods = averaging_methods
self.business_day_convention = business_day_convention
self.day_count_convention = day_count_convention
self.effective_date = effective_date
self.end_stub = end_stub
self.end_to_end = end_to_end
self.fixed_rates = fixed_rates
self.next_cash_flow_index = next_cash_flow_index
self.ois_compounding_frequency = ois_compounding_frequency
self.pay_notional_at_start = pay_notional_at_start
self.payment_calendar = payment_calendar
self.payment_frequencies = payment_frequencies
self.payment_frequency = payment_frequency
self.payment_lag = payment_lag
self.period_end_dates_stored = period_end_dates_stored
self.rate_asset_name = rate_asset_name
self.receive_notional_at_end = receive_notional_at_end
self.reset_calendar = reset_calendar
self.roll_date = roll_date
self.spreads = spreads
self.start_stub = start_stub
self.use_imm_dates = use_imm_dates
super(IRLeg, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'averaging_method',
'averaging_methods',
'business_day_convention',
'day_count_convention',
'effective_date',
'end_stub',
'end_to_end',
'fixed_rates',
'next_cash_flow_index',
'ois_compounding_frequency',
'pay_notional_at_start',
'payment_calendar',
'payment_frequencies',
'payment_frequency',
'payment_lag',
'period_end_dates_stored',
'rate_asset_name',
'receive_notional_at_end',
'reset_calendar',
'roll_date',
'spreads',
'start_stub',
'use_imm_dates',
]
params += super(IRLeg, self).json_params()
return params
[docs]
class BondFutureByCode(CodeSpecified):
[docs]
def __init__(self,
code=None,
identifier=None,
traded_price=None,
**kwargs):
"""
:param code: The code
:param identifier: The security identifier
:param traded_price: The traded price
"""
self.traded_price = traded_price
super(BondFutureByCode, self).__init__(
code=code,
identifier=identifier)
def json_params(self):
params = ['traded_price']
params += super(BondFutureByCode, self).json_params()
return params
[docs]
class FxKnockin(FullySpecified):
class BarrierType(IntEnum):
DownAndIn = 1
UpAndIn = 0
[docs]
def __init__(self,
barrier=None,
barrier_end_date=None,
barrier_start_date=None,
barrier_type=None,
claim_type=None,
currency=None,
cutoff=None,
expiration_date=None,
fx_pair=None,
identifier=None,
option_barrier_type=None,
premium_currency=None,
settlement_date=None,
settlement_type=None,
strike=None,
**kwargs):
"""
:param barrier: The barrier
:param barrier_end_date: The barrier end date
:param barrier_start_date: The barrier start date
:param barrier_type: The barrier type
:param claim_type: The claim type
:param currency: The currency
:param cutoff: The cutoff
:param expiration_date: The expiration date
:param identifier: The security identifier
:param fx_pair: The fx pair
:param option_barrier_type: The option barrier type
:param premium_currency: The premium currency
:param settlement_date: The settlement date
:param settlement_type: The settlement type
:param strike: The strike
"""
self.barrier = barrier
self.barrier_end_date = barrier_end_date
self.barrier_start_date = barrier_start_date
self.barrier_type = barrier_type
self.claim_type = claim_type
self.cutoff = cutoff
self.fx_pair = fx_pair
self.option_barrier_type = option_barrier_type
self.premium_currency = premium_currency
self.settlement_date = settlement_date
self.settlement_type = settlement_type
self.strike = strike
super(FxKnockin, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'barrier',
'barrier_end_date',
'barrier_start_date',
'barrier_type',
'claim_type',
'cutoff',
'fx_pair',
'option_barrier_type',
'premium_currency',
'settlement_date',
'settlement_type',
'strike',
]
params += super(FxKnockin, self).json_params()
return params
[docs]
class FxDoubleKnockin(FullySpecified):
[docs]
def __init__(self,
barrier_end_date=None,
barrier_start_date=None,
claim_type=None,
currency=None,
cutoff=None,
expiration_date=None,
fx_pair=None,
identifier=None,
lower_barrier=None,
premium_currency=None,
settlement_date=None,
settlement_type=None,
strike=None,
upper_barrier=None,
**kwargs):
"""
:param barrier_end_date: The barrier end date
:param barrier_start_date: The barrier start date
:param claim_type: The claim type
:param currency: The currency
:param cutoff: The cutoff
:param expiration_date: The expiration date
:param fx_pair: The fx pair
:param identifier: The security identifier
:param lower_barrier: The lower barrier
:param premium_currency: The premium currency
:param settlement_date: The settlement date
:param settlement_type: The settlement type
:param strike: The strike
:param upper_barrier: The upper barrier
"""
self.barrier_end_date = barrier_end_date
self.barrier_start_date = barrier_start_date
self.claim_type = claim_type
self.cutoff = cutoff
self.fx_pair = fx_pair
self.lower_barrier = lower_barrier
self.premium_currency = premium_currency
self.settlement_date = settlement_date
self.settlement_type = settlement_type
self.strike = strike
self.upper_barrier = upper_barrier
super(FxDoubleKnockin, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'barrier_end_date',
'barrier_start_date',
'claim_type',
'cutoff',
'fx_pair',
'lower_barrier',
'premium_currency',
'settlement_date',
'settlement_type',
'strike',
'upper_barrier',
]
params += super(FxDoubleKnockin, self).json_params()
return params
[docs]
class ConvertibleBondByCode(CodeSpecified):
[docs]
def __init__(self,
code=None,
identifier=None,
**kwargs):
"""
:param code: The code
"""
super(ConvertibleBondByCode, self).__init__(
code=code,
identifier=identifier)
def json_params(self):
params = []
params += super(ConvertibleBondByCode, self).json_params()
return params
[docs]
class EqVolIndexFutureByCode(CodeSpecified):
[docs]
def __init__(self,
code=None,
identifier=None,
**kwargs):
"""
:param code: The code
"""
super(EqVolIndexFutureByCode, self).__init__(
code=code,
identifier=identifier)
def json_params(self):
params = []
params += super(EqVolIndexFutureByCode, self).json_params()
return params
[docs]
class IRLegFixed(FullySpecified):
[docs]
def __init__(self,
business_day_convention=None,
calendar=None,
currency=None,
day_count_convention=None,
effective_date=None,
end_stub=None,
end_to_end=None,
expiration_date=None,
identifier=None,
interest_rate=None,
pay_notional_at_start=None,
receive_notional_at_end=None,
roll_date=None,
start_stub=None,
tenor=None,
**kwargs):
"""
:param business_day_convention: The business day convention
:param calendar: The calendar
:param currency: The currency
:param day_count_convention: The day count convention
:param effective_date: The effective date
:param end_stub: The end stub
:param end_to_end: The end to end
:param expiration_date: The expiration date
:param identifier: The security identifier
:param interest_rate: The interest rate
:param pay_notional_at_start: The pay notional at start
:param receive_notional_at_end: The receive notional at end
:param roll_date: The roll date
:param start_stub: The start stub
:param tenor: The tenor
"""
self.business_day_convention = business_day_convention
self.calendar = calendar
self.day_count_convention = day_count_convention
self.effective_date = effective_date
self.end_stub = end_stub
self.end_to_end = end_to_end
self.interest_rate = interest_rate
self.pay_notional_at_start = pay_notional_at_start
self.receive_notional_at_end = receive_notional_at_end
self.roll_date = roll_date
self.start_stub = start_stub
self.tenor = tenor
super(IRLegFixed, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'business_day_convention',
'calendar',
'day_count_convention',
'effective_date',
'end_stub',
'end_to_end',
'interest_rate',
'pay_notional_at_start',
'receive_notional_at_end',
'roll_date',
'start_stub',
'tenor',
]
params += super(IRLegFixed, self).json_params()
return params
[docs]
class EqOption(FullySpecified):
class ClaimType(IntEnum):
Put = 1
Call = 0,
Forward = 2,
DigitalCall = 3,
DigitalPut = 4,
Straddle = 5,
class SettlementType(IntEnum):
Cash = 1
Physical = 0
[docs]
def __init__(self,
calendar=None,
option_claim_type=None,
currency=None,
compo_currency=None,
expiration_date=None,
identifier=None,
is_quanto=None,
is_listed=None,
settlement_lag=None,
option_settlement_type=None,
strike=None,
underlyer=None,
premium_paid_up_front=None,
**kwargs):
"""
:param calendar: The calendar
:param option_claim_type: The claim type
:param currency: The currency
:param compo_currency: The composite currency
:param expiration_date: The expiration date
:param identifier: The security identifier
:param is_quanto: The is quanto flag
:param is_listed: The is listed flag
:param settlement_lag: The settlement lag
:param option_settlement_type: The settlement type
:param strike: The strike
:param underlyer: The underlyer
:param premium_paid_up_front: The premium paid up front
"""
self.compo_currency = compo_currency
self.calendar = calendar
self.option_claim_type = option_claim_type
self.is_quanto = is_quanto
self.is_listed = is_listed
self.settlement_lag = settlement_lag
self.option_settlement_type = option_settlement_type
self.strike = strike
self.underlyer = underlyer
self.premium_paid_up_front = premium_paid_up_front
super(EqOption, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'compo_currency',
'calendar',
'option_claim_type',
'is_quanto',
'is_listed',
'settlement_lag',
'option_settlement_type',
'strike',
'underlyer',
'premium_paid_up_front',
]
params += super(EqOption, self).json_params()
return params
[docs]
class IRSwaption(FullySpecified):
class ClaimTypes(IntEnum):
Payer = 0
Receiver = 1
class SettlementTypes(IntEnum):
Cash = 1
Physical = 0
[docs]
def __init__(self,
claim_type=None,
currency=None,
expiration_date=None,
fixed_leg=None,
identifier=None,
floating_leg=None,
settlement_type=None,
**kwargs):
"""
:param claim_type: The claim type
:param currency: The currency
:param expiration_date: The expiration date
:param fixed_leg: The fixed leg
:param floating_leg: The floating leg
:param identifier: The security identifier
:param settlement_type: The settlement type
"""
self.claim_type = claim_type
self.fixed_leg = fixed_leg
self.floating_leg = floating_leg
self.settlement_type = settlement_type
super(IRSwaption, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'claim_type',
'fixed_leg',
'floating_leg',
'settlement_type',
]
params += super(IRSwaption, self).json_params()
return params
[docs]
class IRLegFloating(FullySpecified):
[docs]
def __init__(self,
currency=None,
effective_date=None,
end_stub=None,
expiration_date=None,
identifier=None,
pay_notional_at_start=None,
rate_asset=None,
receive_notional_at_end=None,
roll_date=None,
spread=None,
start_stub=None,
**kwargs):
"""
:param currency: The currency
:param effective_date: The effective date
:param end_stub: The end stub
:param expiration_date: The expiration date
:param identifier: The security identifier
:param pay_notional_at_start: The pay notional at start
:param rate_asset: The rate asset
:param receive_notional_at_end: The receive notional at end
:param roll_date: The roll date
:param spread: The spread
:param start_stub: The start stub
"""
self.effective_date = effective_date
self.end_stub = end_stub
self.pay_notional_at_start = pay_notional_at_start
self.rate_asset = rate_asset
self.receive_notional_at_end = receive_notional_at_end
self.roll_date = roll_date
self.spread = spread
self.start_stub = start_stub
super(IRLegFloating, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'effective_date',
'end_stub',
'pay_notional_at_start',
'rate_asset',
'receive_notional_at_end',
'roll_date',
'spread',
'start_stub',
]
params += super(IRLegFloating, self).json_params()
return params
[docs]
class CreditIndexByCode(CodeSpecified):
[docs]
def __init__(self,
code=None,
credit_index_maturity_date=None,
identifier=None,
**kwargs):
"""
:param code: The code
:param credit_index_maturity_date: The credit index maturity date
:param identifier: The security identifier
"""
self.credit_index_maturity_date = credit_index_maturity_date
super(CreditIndexByCode, self).__init__(
code=code,
identifier=identifier)
def json_params(self):
params = ['credit_index_maturity_date']
params += super(CreditIndexByCode, self).json_params()
return params
[docs]
class Margin(FullySpecified):
[docs]
def __init__(self,
currency=None,
expiration_date=None,
identifier=None,
**kwargs):
"""
:param currency: The currency
:param expiration_date: The expiration date
:param identifier: The security identifier
"""
super(Margin, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = []
params += super(Margin, self).json_params()
return params
[docs]
class EqVolIndexFuture(FullySpecified):
[docs]
def __init__(self,
currency=None,
eq_vol_index_identifier=None,
expiration_date=None,
identifier=None,
**kwargs):
"""
:param currency: The currency
:param eq_vol_index_identifier: The eq vol index identifier
:param expiration_date: The expiration date
:param identifier: The security identifier
"""
self.eq_vol_index_identifier = eq_vol_index_identifier
super(EqVolIndexFuture, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'eq_vol_index_identifier',
]
params += super(EqVolIndexFuture, self).json_params()
return params
[docs]
class EqOptionAmerican(FullySpecified):
class ClaimType(IntEnum):
Put = 1
Call = 0
class SettlementType(IntEnum):
Cash = 1
Physical = 0
[docs]
def __init__(self,
calendar=None,
option_claim_type=None,
currency=None,
expiration_date=None,
identifier=None,
is_quanto=None,
is_listed=None,
settlement_lag=None,
option_settlement_type=None,
strike=None,
underlyer=None,
**kwargs):
"""
:param calendar: The calendar
:param option_claim_type: The claim type
:param currency: The currency
:param expiration_date: The expiration date
:param identifier: The security identifier
:param is_quanto: The is quanto flag
:param is_listed: The is listed flag
:param settlement_lag: The settlement lag
:param option_settlement_type: The settlement type
:param strike: The strike
:param underlyer: The underlyer
"""
self.calendar = calendar
self.option_claim_type = option_claim_type
self.is_quanto = is_quanto
self.is_listed = is_listed
self.settlement_lag = settlement_lag
self.settlement_type = option_settlement_type
self.strike = strike
self.underlyer = underlyer
super(EqOptionAmerican, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'calendar',
'option_claim_type',
'is_quanto',
'is_listed',
'settlement_lag',
'settlement_type',
'strike',
'underlyer',
]
params += super(EqOptionAmerican, self).json_params()
return params
[docs]
class FxKnockout(FullySpecified):
class BarrierType(IntEnum):
UpAndOut = 0
DownAndOut = 1
[docs]
def __init__(self,
barrier=None,
barrier_end_date=None,
barrier_start_date=None,
barrier_type=None,
claim_type=None,
currency=None,
cutoff=None,
expiration_date=None,
fx_pair=None,
identifier=None,
option_barrier_type=None,
premium_currency=None,
settlement_date=None,
settlement_type=None,
strike=None,
option_rebate_type=None,
rebate=None,
**kwargs):
"""
:param barrier: The barrier
:param barrier_end_date: The barrier end date
:param barrier_start_date: The barrier start date
:param barrier_type: The barrier type
:param claim_type: The claim type
:param currency: The currency
:param cutoff: The cutoff
:param expiration_date: The expiration date
:param fx_pair: The fx pair
:param identifier: The security identifier
:param option_barrier_type: The option barrier type
:param premium_currency: The premium currency
:param settlement_date: The settlement date
:param settlement_type: The settlement type
:param strike: The strike
:param rebate: The rebate
:param option_rebate_type : The rebate type
"""
self.barrier = barrier
self.barrier_end_date = barrier_end_date
self.barrier_start_date = barrier_start_date
self.barrier_type = barrier_type
self.claim_type = claim_type
self.cutoff = cutoff
self.fx_pair = fx_pair
self.option_barrier_type = option_barrier_type
self.premium_currency = premium_currency
self.settlement_date = settlement_date
self.settlement_type = settlement_type
self.strike = strike
self.rebate = rebate
self.option_rebate_type = option_rebate_type
super(FxKnockout, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'barrier',
'barrier_end_date',
'barrier_start_date',
'barrier_type',
'claim_type',
'cutoff',
'fx_pair',
'option_barrier_type',
'premium_currency',
'settlement_date',
'settlement_type',
'strike',
'rebate',
'option_rebate_type'
]
params += super(FxKnockout, self).json_params()
return params
[docs]
class IRCapFloorBase(FullySpecified):
class ClaimType(IntEnum):
Cap = 0
Floor = 1
[docs]
def __init__(self,
ir_claim_type=None,
currency=None,
effective_date=None,
end_stub=None,
expiration_date=None,
fixing_dates=None,
identifier=None,
reset_dates=None,
roll_date=None,
start_stub=None,
strike=None,
**kwargs):
"""
:param ir_claim_type: The claim type
:param currency: The currency
:param effective_date: The effective date
:param end_stub: The end stub
:param expiration_date: The expiration date
:param fixing_dates: The fixing dates
:param identifier: The security identifier
:param reset_dates: The reset dates
:param roll_date: The roll date
:param start_stub: The start stub
:param strike: The strike
"""
self.ir_claim_type = ir_claim_type
self.effective_date = effective_date
self.end_stub = end_stub
self.fixing_dates = fixing_dates
self.reset_dates = reset_dates
self.roll_date = roll_date
self.start_stub = start_stub
self.strike = strike
super(IRCapFloorBase, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'ir_claim_type',
'effective_date',
'end_stub',
'fixing_dates',
'reset_dates',
'roll_date',
'start_stub',
'strike',
]
params += super(IRCapFloorBase, self).json_params()
return params
[docs]
class IRCapFloor(IRCapFloorBase):
class ResetFrequencies(IntEnum):
NotSet = -1,
Annual = 1,
SemiAnnual = 2,
Quarterly = 3,
Monthly = 4,
Weekly = 5,
[docs]
def __init__(self,
ir_claim_type=None,
currency=None,
effective_date=None,
end_stub=None,
expiration_date=None,
fixing_dates=None,
identifier=None,
rate_asset_name=None,
reset_dates=None,
roll_date=None,
start_stub=None,
strike=None,
reset_frequency=None,
**kwargs):
"""
:param ir_claim_type: The claim type
:param currency: The currency
:param effective_date: The effective date
:param end_stub: The end stub
:param expiration_date: The expiration date
:param fixing_dates: The fixing dates
:param identifier: The security identifier
:param rate_asset_name: The rate asset name
:param reset_dates: The reset dates
:param roll_date: The roll date
:param start_stub: The start stub
:param strike: The strike
:param reset_frequency: The reset frequency
"""
self.rate_asset_name = rate_asset_name
self.reset_frequency = reset_frequency
super(IRCapFloor, self).__init__(
ir_claim_type=ir_claim_type,
currency=currency,
effective_date=effective_date,
end_stub=end_stub,
expiration_date=expiration_date,
fixing_dates=fixing_dates,
identifier=identifier,
reset_dates=reset_dates,
roll_date=roll_date,
start_stub=start_stub,
strike=strike,
reset_frequency=reset_frequency)
def json_params(self):
params = [
'rate_asset_name',
'reset_frequency'
]
params += super(IRCapFloor, self).json_params()
return params
[docs]
class IRCapFloorCMS(IRCapFloorBase):
[docs]
def __init__(self,
ir_claim_type=None,
ir_swap_fixing_instrument=None,
currency=None,
effective_date=None,
end_stub=None,
expiration_date=None,
fixing_dates=None,
identifier=None,
payment_frequency=None,
reset_dates=None,
roll_date=None,
start_stub=None,
strike=None,
**kwargs):
"""
:param ir_claim_type: The claim type
:param ir_swap_fixing_instrument: The ir swap fixing instrument identifier
:param currency: The currency
:param effective_date: The effective date
:param end_stub: The end stub
:param expiration_date: The expiration date
:param fixing_dates: The fixing dates
:param identifier: The security identifier
:param payment_frequency: Payment frequency
:param rate_asset_name: The rate asset name
:param reset_dates: The reset dates
:param roll_date: The roll date
:param start_stub: The start stub
:param strike: The strike
"""
self.ir_swap_fixing_instrument = ir_swap_fixing_instrument
self.payment_frequency = payment_frequency
super(IRCapFloorCMS, self).__init__(
ir_claim_type=ir_claim_type,
currency=currency,
effective_date=effective_date,
end_stub=end_stub,
expiration_date=expiration_date,
fixing_dates=fixing_dates,
identifier=identifier,
reset_dates=reset_dates,
roll_date=roll_date,
start_stub=start_stub,
strike=strike)
def json_params(self):
params = [
'ir_swap_fixing_instrument',
'payment_frequency',
]
params += super(IRCapFloorCMS, self).json_params()
return params
[docs]
class EqSwap(FullySpecified):
class ReturnType(IntEnum):
PriceReturn = 0
TotalReturn = 1
class ValuationType(IntEnum):
NPV = 1
Accrual = 0
class ResetType(IntEnum):
FixedShares = 0
FixedNotional = 1
class DivPayment(IntEnum):
PassThru = 3
OnNextReset = 2
OnExpiry = 0
OnExpiryReinvested = 1
[docs]
def __init__(self,
applied_tax_rate=None,
business_day_convention=None,
currency=None,
compo_currency=None,
div_payment=None,
div_payment_style=None,
end_stub=None,
end_to_end=None,
eq_swap_valuation_type=None,
equity_asset=None,
expiration_date=None,
identifier=None,
initial_fixing_date=None,
is_perpetual=None,
is_quanto=None,
is_compo=None,
payment_calendar_name=None,
payment_lag=None,
rate_asset_name=None,
reset_type=None,
return_type=None,
roll_date=None,
spread=None,
start_stub=None,
swap_reset_type=None,
swap_return_type=None,
tenor=None,
valuation_type=None,
**kwargs):
"""
:param applied_tax_rate: The applied tax rate
:param business_day_convention: The business day convention
:param currency: The currency
:param compo_currency: The compo currency
:param div_payment: The div payment
:param div_payment_style: The div payment style
:param end_stub: The end stub
:param end_to_end: The end to end
:param eq_swap_valuation_type: The eq swap valuation type
:param equity_asset: The equity asset
:param expiration_date: The expiration date
:param identifier: The security identifier
:param initial_fixing_date: The initial fixing date
:param is_perpetual: The is perpetual
:param is_quanto: The is quanto flag
:param is_compo: The is compo flag
:param payment_calendar_name: The payment calendar name
:param payment_lag: The payment lag
:param rate_asset_name: The rate asset name
:param reset_type: The reset type
:param return_type: The return type
:param roll_date: The roll date
:param spread: The spread
:param start_stub: The start stub
:param swap_reset_type: The swap reset type
:param swap_return_type: The swap return type
:param tenor: The tenor
:param valuation_type: The valuation type
"""
self.applied_tax_rate = applied_tax_rate
self.business_day_convention = business_day_convention
self.compo_currency = compo_currency
self.div_payment = div_payment
self.div_payment_style = div_payment_style
self.end_stub = end_stub
self.end_to_end = end_to_end
self.eq_swap_valuation_type = eq_swap_valuation_type
self.equity_asset = equity_asset
self.initial_fixing_date = initial_fixing_date
self.is_perpetual = is_perpetual
self.is_quanto = is_quanto
self.is_compo = is_compo
self.payment_calendar_name = payment_calendar_name
self.payment_lag = payment_lag
self.rate_asset_name = rate_asset_name
self.reset_type = reset_type
self.return_type = return_type
self.roll_date = roll_date
self.spread = spread
self.start_stub = start_stub
self.swap_reset_type = swap_reset_type
self.swap_return_type = swap_return_type
self.tenor = tenor
self.valuation_type = valuation_type
super(EqSwap, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'applied_tax_rate',
'business_day_convention',
'div_payment',
'div_payment_style',
'end_stub',
'end_to_end',
'eq_swap_valuation_type',
'equity_asset',
'initial_fixing_date',
'is_perpetual',
'is_quanto',
'is_compo',
'payment_calendar_name',
'payment_lag',
'rate_asset_name',
'reset_type',
'return_type',
'roll_date',
'spread',
'start_stub',
'swap_reset_type',
'swap_return_type',
'tenor',
'valuation_type',
]
params += super(EqSwap, self).json_params()
return params
[docs]
class EqVolatilitySwapBase(FullySpecified):
class BarrierType(IntEnum):
NULL = 0,
Up = 1,
Down = 2,
DoubleBarriers = 3
class KnockinObservationType(IntEnum):
AtInitialDate = 0,
AtExpiry = 1,
AnyFixingDates = 2
class KnockinPayoffType(IntEnum):
ContingentPayoff = 0, # KIIndicator * (Variance - Strike^2)
ContingentStrike = 1 # Variance - (KIIndicator * Strike)^2
[docs]
def __init__(self,
annualisation_factor=None,
calendar_name=None,
currency=None,
expiration_date=None,
identifier=None,
include_dividend_jumps=None,
initial_date=None,
return_lag=1,
settlement_delay=None,
tenor=None,
underlyer=None,
vol_strike=None,
**kwargs):
"""
:param annualisation_factor: The annualisation factor
:param calendar_name: The calendar name
:param currency: The currency
:param expiration_date: The expiration date
:param identifier: The security identifier
:param include_dividend_jumps: The include dividend jumps
:param initial_date: The initial date
:param return_lag: The return lag
:param settlement_delay: The settlement delay
:param tenor: The tenor
:param underlyer: The underlyer
:param vol_strike: The vol strike
"""
self.annualisation_factor = annualisation_factor
self.calendar_name = calendar_name
self.include_dividend_jumps = include_dividend_jumps
self.initial_date = initial_date
self.return_lag = return_lag
self.settlement_delay = settlement_delay
self.tenor = tenor
self.underlyer = underlyer
self.vol_strike = vol_strike
super(EqVolatilitySwapBase, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'annualisation_factor',
'calendar_name',
'include_dividend_jumps',
'initial_date',
'return_lag',
'settlement_delay',
'tenor',
'underlyer',
'vol_strike',
]
params += super(EqVolatilitySwapBase, self).json_params()
return params
[docs]
class EqVolatilitySwap(EqVolatilitySwapBase):
[docs]
def __init__(self,
annualisation_factor=None,
calendar_name=None,
currency=None,
expiration_date=None,
identifier=None,
include_dividend_jumps=None,
initial_date=None,
return_lag=1,
settlement_delay=None,
tenor=None,
underlyer=None,
vol_strike=None,
cap_level=None,
**kwargs):
"""
:param annualisation_factor: The annualisation factor
:param calendar_name: The calendar name
:param currency: The currency
:param expiration_date: The expiration date
:param identifier: The security identifier
:param include_dividend_jumps: The include dividend jumps
:param initial_date: The initial date
:param return_lag: The return lag
:param settlement_delay: The settlement delay
:param tenor: The tenor
:param underlyer: The underlyer
:param vol_strike: The vol strike
:param cap_level: The cap level
"""
self.cap_level = cap_level
super(EqVolatilitySwap, self).__init__(
annualisation_factor=annualisation_factor,
calendar_name=calendar_name,
currency=currency,
expiration_date=expiration_date,
identifier=identifier,
include_dividend_jumps=include_dividend_jumps,
initial_date=initial_date,
return_lag=return_lag,
settlement_delay=settlement_delay,
tenor=tenor,
underlyer=underlyer,
vol_strike=vol_strike)
def json_params(self):
params = [
'cap_level'
]
params += super(EqVolatilitySwap, self).json_params()
return params
[docs]
class EqVarianceSwap(EqVolatilitySwapBase):
[docs]
def __init__(self,
annualisation_factor=None,
calendar_name=None,
currency=None,
expiration_date=None,
identifier=None,
include_dividend_jumps=None,
initial_date=None,
return_lag=1,
settlement_delay=None,
tenor=None,
underlyer=None,
vol_strike=None,
cap_level=None,
knockin_barrier_type=EqVolatilitySwapBase.BarrierType.NULL,
knockin_observation_type=None,
knockin_barrier=None,
knockin_upper_barrier=None,
knockin_payoff_type=None,
is_normalised=True,
knockout_barrier=None,
knockout_barrier_type=EqVolatilitySwapBase.BarrierType.NULL,
**kwargs):
"""
:param annualisation_factor: The annualisation factor
:param calendar_name: The calendar name
:param currency: The currency
:param expiration_date: The expiration date
:param identifier: The security identifier
:param include_dividend_jumps: The include dividend jumps
:param initial_date: The initial date
:param return_lag: The return lag
:param settlement_delay: The settlement delay
:param tenor: The tenor
:param underlyer: The underlyer
:param vol_strike: The vol strike
:param knockin_barrier_type: The knockin_barrier_type
:param knockin_observation_type: The knockin_observation_type
:param knockin_barrier: The knockin_barrier
:param knockin_upper_barrier: The knockin_upper_barrier
:param knockin_payoff_type: The knockin_payoff_type
:param is_normalised: The is_normalised
:param knockout_barrier: The knockout_barrier
:param knockout_barrier_type: The knockout_barrier_type
"""
self.cap_level = cap_level
self.knockin_barrier_type = knockin_barrier_type
self.knockin_observation_type = knockin_observation_type
self.knockin_barrier = knockin_barrier
self.knockin_upper_barrier = knockin_upper_barrier
self.knockin_payoff_type = knockin_payoff_type
self.is_normalised = is_normalised
self.knockout_barrier = knockout_barrier
self.knockout_barrier_type = knockout_barrier_type
super(EqVarianceSwap, self).__init__(
annualisation_factor=annualisation_factor,
calendar_name=calendar_name,
currency=currency,
expiration_date=expiration_date,
identifier=identifier,
include_dividend_jumps=include_dividend_jumps,
initial_date=initial_date,
return_lag=return_lag,
settlement_delay=settlement_delay,
tenor=tenor,
underlyer=underlyer,
vol_strike=vol_strike,
knockin_barrier_type=knockin_barrier_type,
knockin_observation_type=knockin_observation_type,
knockin_barrier=knockin_barrier,
knockin_upper_barrier=knockin_upper_barrier,
knockin_payoff_type=knockin_payoff_type,
is_normalised=is_normalised,
knockout_barrier=knockout_barrier,
knockout_barrier_type=knockout_barrier_type)
def json_params(self):
params = [
'cap_level',
'knockin_barrier_type',
'knockin_observation_type',
'knockin_barrier',
'knockin_upper_barrier',
'knockin_payoff_type',
'is_normalised',
'knockout_barrier',
'knockout_barrier_type'
]
params += super(EqVarianceSwap, self).json_params()
return params
[docs]
class FxFutureByCode(CodeSpecified):
[docs]
def __init__(self,
code=None,
identifier=None,
traded_price=None,
**kwargs):
"""
:param code: The code
:param traded_price: The traded price
"""
self.traded_price = traded_price
super(FxFutureByCode, self).__init__(
code=code,
identifier=identifier)
def json_params(self):
params = ['traded_price']
params += super(FxFutureByCode, self).json_params()
return params
[docs]
class EqStock(CodeSpecified):
[docs]
def __init__(self,
code=None,
identifier=None,
**kwargs):
"""
:param code: The code
"""
super(EqStock, self).__init__(
code=code,
identifier=identifier)
def json_params(self):
params = []
params += super(EqStock, self).json_params()
return params
[docs]
class BondFuture(FullySpecified):
[docs]
def __init__(self,
bond_issuer=None,
conversion_factors=None,
currency=None,
eligible_bonds=None,
expiration_date=None,
future_quotation_style="ByPrice",
future_settlement_type="Physical",
identifier=None,
notional_bond=None,
traded_price=None,
**kwargs):
"""
:param bond_issuer: The bond issuer
:param conversion_factors: The conversion factors
:param currency: The currency
:param eligible_bonds: The eligible bonds
:param expiration_date: The expiration date
:param future_quotation_style: ByPrice or ByYield
:param future_settlement_type: Physical or Cash
:param identifier: The security identifier
:param notional_bond: The notional bond (only required for cash-settled bond futures)
:param traded_price: The traded price
"""
self.bond_issuer = bond_issuer
self.conversion_factors = conversion_factors
self.eligible_bonds = eligible_bonds
self.future_quotation_style = future_quotation_style
self.future_settlement_type = future_settlement_type
self.notional_bond = notional_bond
self.traded_price = traded_price
super(BondFuture, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'bond_issuer',
'conversion_factors',
'eligible_bonds',
'future_quotation_style',
'future_settlement_type',
'notional_bond',
'traded_price'
]
params += super(BondFuture, self).json_params()
return params
[docs]
class Cash(FullySpecified):
[docs]
def __init__(self,
currency=None,
expiration_date=None,
identifier=None,
settlement_date=None,
settlement_date_is_set=False,
**kwargs):
"""
:param currency: The currency
:param expiration_date: The expiration date
:param identifier: The security identifier
:param settlement_date: The settlement date
"""
self.settlement_date = settlement_date
self.settlement_date_is_set = settlement_date_is_set
super(Cash, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'settlement_date',
'settlement_date_is_set'
]
params += super(Cash, self).json_params()
return params
[docs]
class CmdtyOption(FullySpecified):
class ClaimType(IntEnum):
Put = 0
Call = 1
[docs]
def __init__(self,
option_claim_type=None,
currency=None,
expiration_date=None,
futures_expiration_date=None,
identifier=None,
premium_paid_up_front=None,
strike=None,
underlyer=None,
**kwargs):
"""
:param option_claim_type: The claim type
:param currency: The currency
:param expiration_date: The expiration date
:param futures_expiration_date: The futures expiration date
:param identifier: The security identifier
:param premium_paid_up_front: The premium paid up front
:param strike: The strike
:param underlyer: The underlyer
"""
self.option_claim_type = option_claim_type
self.futures_expiration_date = futures_expiration_date
self.premium_paid_up_front = premium_paid_up_front
self.strike = strike
self.underlyer = underlyer
super(CmdtyOption, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'option_claim_type',
'futures_expiration_date',
'premium_paid_up_front',
'strike',
'underlyer',
]
params += super(CmdtyOption, self).json_params()
return params
[docs]
class CmdtyFutureByCode(CodeSpecified):
[docs]
def __init__(self,
code=None,
identifier=None,
traded_price=None,
**kwargs):
"""
:param code: The code
:param identifier: The security identifier
:param traded_price: The traded price
"""
self.traded_price = traded_price
super(CmdtyFutureByCode, self).__init__(
code=code,
identifier=identifier)
def json_params(self):
params = ['traded_price']
params += super(CmdtyFutureByCode, self).json_params()
return params
[docs]
class FxOption(FullySpecified):
class ClaimType(IntEnum):
Call = 0
Put = 1
Forward = 2
DigitalCall = 3
DigitalPut = 4
Straddle = 5
class SettlementType(IntEnum):
Cash = 1
Physical = 0
[docs]
def __init__(self,
option_claim_type=None,
currency=None,
expiration_date=None,
fx_pair=None,
identifier=None,
premium_currency=None,
settlement_date=None,
option_settlement_type=None,
strike=None,
cutoff=None,
is_listed=None,
**kwargs):
"""
:param option_claim_type: The claim type
:param currency: The currency
:param expiration_date: The expiration date
:param fx_pair: The fx pair
:param identifier: The security identifier
:param premium_currency: The premium currency
:param settlement_date: The settlement date
:param option_settlement_type: The settlement type
:param strike: The strike
:param cutoff: The cutoff
:param is_listed: The is listed flag
"""
self.option_claim_type = option_claim_type
self.fx_pair = fx_pair
self.premium_currency = premium_currency
self.settlement_date = settlement_date
self.option_settlement_type = option_settlement_type
self.strike = strike
self.cutoff = cutoff
self.is_listed = is_listed
super(FxOption, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'option_claim_type',
'fx_pair',
'premium_currency',
'settlement_date',
'option_settlement_type',
'strike',
'cutoff',
'is_listed',
]
params += super(FxOption, self).json_params()
return params
[docs]
class IRFuture(FullySpecified):
[docs]
def __init__(self,
currency=None,
day_count_fraction=None,
expiration_date=None,
identifier=None,
rate_asset_name=None,
traded_price=None,
compounding_rule=None,
compounding_start_date=None,
**kwargs):
"""
:param currency: The currency
:param day_count_fraction: The day count fraction
:param expiration_date: The expiration date
:param identifier: The security identifier
:param rate_asset_name: The rate asset name
:param traded_price: The traded price
"""
self.day_count_fraction = day_count_fraction
self.rate_asset_name = rate_asset_name
self.traded_price = traded_price
self.compounding_rule = compounding_rule
self.compounding_start_date = compounding_start_date
super(IRFuture, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'day_count_fraction',
'rate_asset_name',
'traded_price',
'compounding_rule',
'compounding_start_date'
]
params += super(IRFuture, self).json_params()
return params
[docs]
class Bond(FullySpecified):
class DayCountConvention(IntEnum):
Actual360 = 2
ActualActualIsda = 3
Actual365 = 1
ActualActualAfb = 4
NL365 = 8
Thirty360 = 5
ThirtyE360Isda = 7
NotSet = -1
ThirtyE360 = 6
ActualActualIcma = 0
class CouponFrequency(IntEnum):
Monthly = 4
Annual = 1
SemiAnnual = 2
ZeroCoupon = 0
Quarterly = 3
NotSet = -1,
AtMaturity = 5,
Every182Days = 6
class CouponType(IntEnum):
Fixed = 0
NotSet = -1
[docs]
def __init__(self,
bond_identifier=None,
par_value=None,
bond_coupon_frequency=None,
bond_coupon_type=None,
bond_day_count_convention=None,
business_day_convention=None,
calendar=None,
coupon_frequency=None,
coupon_rate=None,
coupon_type=None,
currency=None,
dated_date=None,
day_count_convention=None,
end_to_end=None,
expiration_date=None,
first_coupon_date=None,
identifier=None,
issuer=None,
maturity_date=None,
penultimate_coupon_date=None,
roll_date=None,
settlement_lag=None,
redemption_rate=None,
bond_call_provision=None,
bond_put_provision=None,
debt_type=None,
issuer_id=None,
**kwargs):
"""
:param bond_coupon_frequency: The bond coupon frequency
:param bond_coupon_type: The bond coupon type
:param bond_day_count_convention: The bond day count convention
:param business_day_convention: The business day convention
:param calendar: The calendar
:param coupon_frequency: The coupon frequency
:param coupon_rate: The coupon rate
:param coupon_type: The coupon type
:param currency: The currency
:param dated_date: The dated date
:param day_count_convention: The day count convention
:param end_to_end: The end to end
:param expiration_date: The expiration date
:param first_coupon_date: The first coupon date
:param identifier: The security identifier
:param issuer: The issuer
:param maturity_date: The maturity date
:param penultimate_coupon_date: The penultimate coupon date
:param roll_date: The roll date
:param settlement_lag: The settlement lag
:param redemption_rate: The redemption rate
:param bond_coupons: The bond coupons
:param debt_type: The debt type (seniority)
"""
self.bond_identifier = bond_identifier
self.par_value = par_value
self.bond_coupon_frequency = bond_coupon_frequency
self.bond_coupon_type = bond_coupon_type
self.bond_day_count_convention = bond_day_count_convention
self.business_day_convention = business_day_convention
self.calendar = calendar
self.coupon_frequency = coupon_frequency
self.coupon_rate = coupon_rate
self.coupon_type = coupon_type
self.dated_date = dated_date
self.day_count_convention = day_count_convention
self.end_to_end = end_to_end
self.first_coupon_date = first_coupon_date
self.issuer = issuer
self.issuer_id = issuer_id
self.maturity_date = maturity_date
self.penultimate_coupon_date = penultimate_coupon_date
self.roll_date = roll_date
self.settlement_lag = settlement_lag
self.redemption_rate = redemption_rate
self.bond_call_provision = bond_call_provision
self.bond_put_provision = bond_put_provision
self.debt_type = debt_type
self.next_coupon_index = kwargs.get('next_coupon_index', None)
self.bond_coupons = kwargs.get('bond_coupons', None)
super(Bond, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'bond_identifier',
'par_value',
'bond_coupon_frequency',
'bond_coupon_type',
'bond_day_count_convention',
'business_day_convention',
'calendar',
'coupon_frequency',
'coupon_rate',
'coupon_type',
'dated_date',
'day_count_convention',
'end_to_end',
'first_coupon_date',
'issuer',
'maturity_date',
'penultimate_coupon_date',
'roll_date',
'settlement_lag',
'redemption_rate',
'next_coupon_index',
'bond_coupons',
'bond_call_provision',
'bond_put_provision',
'debt_type',
'issuer_id',
]
params += super(Bond, self).json_params()
return params
[docs]
class EqFutureByCode(CodeSpecified):
[docs]
def __init__(self,
code=None,
identifier=None,
traded_price=None,
**kwargs):
"""
:param code: The code
:param identifier: The security identifier
:param traded_price: The traded price
"""
self.traded_price = traded_price
super(EqFutureByCode, self).__init__(
code=code,
identifier=identifier)
def json_params(self):
params = ['traded_price']
params += super(EqFutureByCode, self).json_params()
return params
[docs]
class FxOptionAmerican(FullySpecified):
class ClaimType(IntEnum):
Put = 1
Forward = 2
Call = 0
class SettlementType(IntEnum):
Cash = 1
Physical = 0
[docs]
def __init__(self,
claim_type=None,
currency=None,
expiration_date=None,
fx_pair=None,
identifier=None,
premium_currency=None,
settlement_date=None,
settlement_type=None,
strike=None,
cutoff=None,
is_listed=None,
**kwargs):
"""
:param claim_type: The claim type
:param currency: The currency
:param expiration_date: The expiration date
:param fx_pair: The fx pair
:param identifier: The security identifier
:param premium_currency: The premium currency
:param settlement_date: The settlement date
:param settlement_type: The settlement type
:param strike: The strike
:param cutoff: The cutoff
:param is_listed: The is listed flag
"""
self.claim_type = claim_type
self.fx_pair = fx_pair
self.premium_currency = premium_currency
self.settlement_date = settlement_date
self.settlement_type = settlement_type
self.strike = strike
self.cutoff = cutoff
self.is_listed = is_listed
super(FxOptionAmerican, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'claim_type',
'fx_pair',
'premium_currency',
'settlement_date',
'settlement_type',
'strike',
'cutoff',
'is_listed',
]
params += super(FxOptionAmerican, self).json_params()
return params
[docs]
class FxTarn(FullySpecified):
[docs]
def __init__(self,
business_day_convention=None,
calendar_id=None,
call_barrier_levels=None,
call_barrier_type=None,
call_notionals=None,
call_strikes=None,
currency=None,
cutoff=None,
end_stub=None,
end_to_end=None,
expiration_date=None,
first_fixing_date=None,
fixing_dates_stored=None,
fx_pair=None,
identifier=None,
lower_knockout_levels=None,
notional_currency=None,
period_str=None,
pivot_strikes=None,
put_barrier_levels=None,
put_barrier_type=None,
put_notionals=None,
put_strikes=None,
schedule_end_date=None,
schedule_roll_date=None,
schedule_start_date=None,
settlement_lag=None,
settlement_type=None,
start_stub=None,
target_level=None,
termination_condition=None,
upper_call_barrier_levels=None,
upper_call_barrier_type=None,
upper_call_notionals=None,
upper_call_strikes=None,
upper_knockout_levels=None,
upper_put_barrier_levels=None,
upper_put_barrier_type=None,
upper_put_notionals=None,
upper_put_strikes=None,
is_folding_expiry=[],
**kwargs):
"""
:param business_day_convention: The business day convention
:param calendar_id: The calendar id
:param call_barrier_levels: The call barrier levels
:param call_barrier_type: The call barrier type
:param call_notionals: The call notionals
:param call_strikes: The call strikes
:param currency: The currency
:param cutoff: The cutoff
:param end_stub: The end stub
:param end_to_end: The end to end
:param expiration_date: The expiration date
:param first_fixing_date: The first fixing date
:param fixing_dates_stored: The fixing dates stored
:param fx_pair: The fx pair
:param identifier: The security identifier
:param lower_knockout_levels: The lower knockout levels
:param notional_currency: The notional currency
:param period_str: The period str
:param pivot strikes: The pivot strikes
:param put_barrier_levels: The put barrier levels
:param put_barrier_type: The put barrier type
:param put_notionals: The put notionals
:param put_strikes: The put strikes
:param schedule_end_date: The schedule end date
:param schedule_roll_date: The schedule roll date
:param schedule_start_date: The schedule start date
:param settlement_lag: The settlement lag
:param settlement_type: The settlement type
:param start_stub: The start stub
:param target_level: The target level
:param termination_condition: The termination condition
:param upper_call_barrier_levels: The upper call barrier levels
:param upper_call_barrier_type: The upper call barrier type
:param upper_call_notionals: The upper call notionals
:param upper_call_strikes: The upper call strikes
:param upper_knockout_levels: The upper knockout levels
:param upper_put_barrier_levels: The upper put barrier levels
:param upper_put_barrier_type: The upper put barrier type
:param upper_put_notionals: The upper put notionals
:param upper_put_strikes: The upper put strikes
"""
self.business_day_convention = business_day_convention
self.calendar_id = calendar_id
self.call_barrier_levels = call_barrier_levels
self.call_barrier_type = call_barrier_type
self.call_notionals = call_notionals
self.call_strikes = call_strikes
self.cutoff = cutoff
self.end_stub = end_stub
self.end_to_end = end_to_end
self.first_fixing_date = first_fixing_date
self.fixing_dates_stored = fixing_dates_stored
self.fx_pair = fx_pair
self.lower_knockout_levels = lower_knockout_levels
self.notional_currency = notional_currency
self.period_str = period_str
self.pivot_strikes = pivot_strikes
self.put_barrier_levels = put_barrier_levels
self.put_barrier_type = put_barrier_type
self.put_notionals = put_notionals
self.put_strikes = put_strikes
self.schedule_end_date = schedule_end_date
self.schedule_roll_date = schedule_roll_date
self.schedule_start_date = schedule_start_date
self.settlement_lag = settlement_lag
self.settlement_type = settlement_type
self.start_stub = start_stub
self.target_level = target_level
self.termination_condition = termination_condition
self.upper_knockout_levels = upper_knockout_levels
self.upper_call_barrier_levels = upper_call_barrier_levels
self.upper_call_barrier_type = upper_call_barrier_type
self.upper_call_notionals = upper_call_notionals
self.upper_call_strikes = upper_call_strikes
self.upper_knockout_levels = upper_knockout_levels
self.upper_put_barrier_levels = upper_put_barrier_levels
self.upper_put_barrier_type = upper_put_barrier_type
self.upper_put_notionals = upper_put_notionals
self.upper_put_strikes = upper_put_strikes
self.is_folding_expiry = is_folding_expiry
super(FxTarn, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'business_day_convention',
'calendar_id',
'call_barrier_levels',
'call_barrier_type',
'call_notionals',
'call_strikes',
'cutoff',
'end_stub',
'end_to_end',
'first_fixing_date',
'fixing_dates_stored',
'fx_pair',
'notional_currency',
'period_str',
'pivot_strikes',
'put_barrier_levels',
'put_barrier_type',
'put_notionals',
'put_strikes',
'schedule_end_date',
'schedule_roll_date',
'schedule_start_date',
'settlement_lag',
'settlement_type',
'start_stub',
'target_level',
'termination_condition',
'lower_knockout_levels',
'upper_call_barrier_levels',
'upper_call_barrier_type',
'upper_call_notionals',
'upper_call_strikes',
'upper_knockout_levels',
'upper_put_barrier_levels',
'upper_put_barrier_type',
'upper_put_notionals',
'upper_put_strikes',
'is_folding_expiry'
]
params += super(FxTarn, self).json_params()
return params
[docs]
class EqFuture(FullySpecified):
class SettlementType(IntEnum):
Cash = 1
Physical = 0
[docs]
def __init__(self,
currency=None,
expiration_date=None,
future_settlement_type=SettlementType.Cash,
identifier=None,
underlyer=None,
traded_price=None,
**kwargs):
"""
:param currency: The currency
:param expiration_date: The expiration date
:param future_settlement_type: The settlement type
:param identifier: The security identifier
:param underlyer: The underlyer
:param traded_price: The traded price
"""
self.future_settlement_type = future_settlement_type
self.underlyer = underlyer
self.traded_price = traded_price
super(EqFuture, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'future_settlement_type',
'underlyer',
'traded_price'
]
params += super(EqFuture, self).json_params()
return params
[docs]
class BondByCode(CodeSpecified):
[docs]
def __init__(self,
code=None,
identifier=None,
**kwargs):
"""
:param code: The code
:param identifier: The security identifier
"""
super(BondByCode, self).__init__(
code=code,
identifier=identifier)
def json_params(self):
params = []
params += super(BondByCode, self).json_params()
return params
[docs]
class IRFutureByCode(CodeSpecified):
[docs]
def __init__(self,
code=None,
identifier=None,
traded_price=None,
**kwargs):
"""
:param code: The code
:param identifier: The security identifier
:param code: The traded price
"""
self.traded_price = traded_price
super(IRFutureByCode, self).__init__(
code=code,
identifier=identifier)
def json_params(self):
params = ['traded_price']
params += super(IRFutureByCode, self).json_params()
return params
[docs]
class IBondByCode(IBond):
[docs]
def __init__(self,
identifier=None):
"""
:param identifier: The security identifier
"""
super(IBondByCode, self).__init__(
identifier=identifier)
def json_params(self):
params = []
params += super(IBondByCode, self).json_params()
return params
[docs]
class IRSwap(FullySpecified):
[docs]
def __init__(self,
currency=None,
expiration_date=None,
identifier=None,
payer_leg=None,
receiver_leg=None,
payer_leg_notional=None,
receiver_leg_notional=None,
**kwargs):
"""
:param currency: The currency
:param expiration_date: The expiration date
:param identifier: The security identifier
:param payer_leg: The payer leg
:param receiver_leg: The receiver leg
:param payer_leg_notional: The payer leg notional
:param receiver_leg_notional: The receiver leg notional
"""
self.payer_leg = payer_leg
self.receiver_leg = receiver_leg
self.payer_leg_notional = payer_leg_notional
self.receiver_leg_notional = receiver_leg_notional
super(IRSwap, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'payer_leg',
'receiver_leg',
'payer_leg_notional',
'receiver_leg_notional'
]
params += super(IRSwap, self).json_params()
return params
[docs]
class FxDoubleKnockout(FullySpecified):
[docs]
def __init__(self,
barrier_end_date=None,
barrier_start_date=None,
claim_type=None,
currency=None,
cutoff=None,
expiration_date=None,
fx_pair=None,
identifier=None,
lower_barrier=None,
premium_currency=None,
settlement_date=None,
settlement_type=None,
strike=None,
upper_barrier=None,
**kwargs):
"""
:param barrier_end_date: The barrier end date
:param barrier_start_date: The barrier start date
:param claim_type: The claim type
:param currency: The currency
:param cutoff: The cutoff
:param expiration_date: The expiration date
:param fx_pair: The fx pair
:param identifier: The security identifier
:param lower_barrier: The lower barrier
:param premium_currency: The premium currency
:param settlement_date: The settlement date
:param settlement_type: The settlement type
:param strike: The strike
:param upper_barrier: The upper barrier
"""
self.barrier_end_date = barrier_end_date
self.barrier_start_date = barrier_start_date
self.claim_type = claim_type
self.cutoff = cutoff
self.fx_pair = fx_pair
self.lower_barrier = lower_barrier
self.premium_currency = premium_currency
self.settlement_date = settlement_date
self.settlement_type = settlement_type
self.strike = strike
self.upper_barrier = upper_barrier
super(FxDoubleKnockout, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'barrier_end_date',
'barrier_start_date',
'claim_type',
'cutoff',
'fx_pair',
'lower_barrier',
'premium_currency',
'settlement_date',
'settlement_type',
'strike',
'upper_barrier',
]
params += super(FxDoubleKnockout, self).json_params()
return params
[docs]
class CDS(FullySpecified):
[docs]
def __init__(self,
business_day_convention=None,
calendar=None,
code=None,
coupon_frequency=None,
coupon_rate=None,
currency=None,
day_count_convention=None,
debt_type=None,
default_type=None,
end_to_end=None,
expiration_date=None,
first_coupon_date=None,
identifier=None,
issuer_lei=None,
markit_ticker=None,
pay_accrual_at_default=None,
penultimate_coupon_date=None,
protection_at_start_of_day=None,
reference_bond_identifier=None,
roll_date=None,
settlement_lag=None,
settlement_type=None,
start_date=None,
use_imm_dates=None,
**kwargs):
"""
:param business_day_convention: The business day convention
:param calendar: The calendar
:param code: The cds RED code
:param coupon_frequency: The coupon frequency
:param coupon_rate: The coupon rate
:param currency: The currency
:param day_count_convention: The day count convention
:param debt_type: The debt type
:param default_type: The default type
:param end_to_end: The end to end
:param expiration_date: The expiration date
:param first_coupon_date: The first coupon date
:param identifier: The security identifier
:param issuer_lei: The issuer LEI
:param markit_ticker: The markit ticker
:param pay_accrual_at_default: The pay accrual at default
:param penultimate_coupon_date: The penultimate coupon date
:param protection_at_start_of_day: The protection at start of day
:param reference_bond_identifier: The reference bond identifier
:param roll_date: The roll date
:param settlement_lag: The settlement lag
:param settlement_type: The settlement type
:param start_date: The start date
:param use_imm_dates: The use IMM dates flag
"""
self.business_day_convention = business_day_convention
self.calendar = calendar
self.code = code
self.coupon_frequency = coupon_frequency
self.coupon_rate = coupon_rate
self.day_count_convention = day_count_convention
self.debt_type = debt_type
self.default_type = default_type
self.end_to_end = end_to_end
self.first_coupon_date = first_coupon_date
self.issuer_lei = issuer_lei
self.markit_ticker = markit_ticker
self.pay_accrual_at_default = pay_accrual_at_default
self.penultimate_coupon_date = penultimate_coupon_date
self.protection_at_start_of_day = protection_at_start_of_day
self.reference_bond_identifier = reference_bond_identifier
self.roll_date = roll_date
self.settlement_lag = settlement_lag
self.settlement_type = settlement_type
self.start_date = start_date
self.use_imm_dates = use_imm_dates
super(CDS, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'business_day_convention',
'calendar',
'code',
'coupon_frequency',
'coupon_rate',
'day_count_convention',
'debt_type',
'default_type',
'end_to_end',
'issuer_lei',
'markit_ticker',
'first_coupon_date',
'pay_accrual_at_default',
'penultimate_coupon_date',
'protection_at_start_of_day',
'reference_bond_identifier',
'roll_date',
'settlement_lag',
'settlement_type',
'start_date',
'use_imm_dates'
]
params += super(CDS, self).json_params()
return params
[docs]
class CmdtyFuture(FullySpecified):
class SettlementType(IntEnum):
Cash = 0
Physical = 1
[docs]
def __init__(self,
currency=None,
exchange=None,
expiration_date=None,
future_settlement_type=None,
identifier=None,
name=None,
traded_price=None,
**kwargs):
"""
:param currency: The currency
:param exchange: The exchange
:param expiration_date: The expiration date
:param identifier: The security identifier
:param name: The name
:param settlement_type: The settlement type
:param traded_price: The traded price
"""
self.exchange = exchange
self.name = name
self.future_settlement_type = future_settlement_type
self.traded_price = traded_price
super(CmdtyFuture, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'exchange',
'name',
'future_settlement_type',
'traded_price'
]
params += super(CmdtyFuture, self).json_params()
return params
[docs]
class ConvertibleBond(Bond):
[docs]
def __init__(self,
asset_currency=None,
asset_identifier=None,
bond_identifier=None,
par_value=None,
bond_coupon_frequency=None,
bond_coupon_type=None,
bond_day_count_convention=None,
business_day_convention=None,
calendar=None,
callable_conversion_condition=None,
conversion_condition=None,
coupon_frequency=None,
coupon_rate=None,
coupon_type=None,
currency=None,
dated_date=None,
day_count_convention=None,
dilution_conversion_condition=None,
dividend_protection_conversion_condition=None,
is_exchangeable=None,
end_to_end=None,
expiration_date=None,
first_coupon_date=None,
identifier=None,
issuer=None,
mandatory_conversion_condition=None,
maturity_date=None,
penultimate_coupon_date=None,
puttable_conversion_condition=None,
roll_date=None,
settlement_lag=None,
redemption_rate=None,
debt_type=None,
issuer_id=None,
**kwargs):
"""
:param asset_currency: The asset currency
:param asset_identifier: The asset identifier
:param bond_coupon_frequency: The bond coupon frequency
:param bond_coupon_type: The bond coupon type
:param bond_day_count_convention: The bond day count convention
:param business_day_convention: The business day convention
:param calendar: The calendar
:param callable_conversion_condition: The callable conversion condition
:param conversion_condition: The conversion condition
:param coupon_frequency: The coupon frequency
:param coupon_rate: The coupon rate
:param coupon_type: The coupon type
:param currency: The currency
:param dated_date: The dated date
:param day_count_convention: The day count convention
:param dilution_conversion_condition: The dilution conversion condition
:param dividend_protection_conversion_condition: The dividend protection conversion condition
:param identifier: The security identifier
:param is_exchangeable : The is exchangeable flag
:param end_to_end: The end to end
:param expiration_date: The expiration date
:param first_coupon_date: The first coupon date
:param issuer: The issuer
:param mandatory_conversion_condition: The mandatory conversion condition
:param maturity_date: The maturity date
:param penultimate_coupon_date: The penultimate coupon date
:param puttable_conversion_condition: The puttable conversion condition
:param roll_date: The roll date
:param settlement_lag: The settlement lag
"""
self.asset_currency = asset_currency
self.asset_identifier = asset_identifier
self.callable_conversion_condition = callable_conversion_condition
self.conversion_condition = conversion_condition
self.dilution_conversion_condition = dilution_conversion_condition
self.dividend_protection_conversion_condition = dividend_protection_conversion_condition
self.is_exchangeable = is_exchangeable
self.mandatory_conversion_condition = mandatory_conversion_condition
self.puttable_conversion_condition = puttable_conversion_condition
super(ConvertibleBond, self).__init__(
bond_identifier=bond_identifier,
par_value=par_value,
bond_coupon_frequency=bond_coupon_frequency,
bond_coupon_type=bond_coupon_type,
bond_day_count_convention=bond_day_count_convention,
business_day_convention=business_day_convention,
calendar=calendar,
coupon_frequency=coupon_frequency,
coupon_rate=coupon_rate,
coupon_type=coupon_type,
currency=currency,
dated_date=dated_date,
day_count_convention=day_count_convention,
end_to_end=end_to_end,
expiration_date=expiration_date,
first_coupon_date=first_coupon_date,
identifier=identifier,
issuer=issuer,
maturity_date=maturity_date,
penultimate_coupon_date=penultimate_coupon_date,
roll_date=roll_date,
settlement_lag=settlement_lag,
redemption_rate=redemption_rate,
debt_type=debt_type,
issuer_id=issuer_id,
**kwargs)
def json_params(self):
params = [
'asset_currency',
'asset_identifier',
'callable_conversion_condition',
'conversion_condition',
'dilution_conversion_condition',
'dividend_protection_conversion_condition',
'is_exchangeable',
'mandatory_conversion_condition',
'puttable_conversion_condition',
]
params += super(ConvertibleBond, self).json_params()
return params
[docs]
class EqDividendFutureByCode(CodeSpecified):
[docs]
def __init__(self,
code=None,
identifier=None,
traded_price=None,
**kwargs):
"""
:param code: The code
:param identifier: The security identifier
:param traded_price: The traded price
"""
self.traded_price = traded_price
super(EqDividendFutureByCode, self).__init__(
code=code,
identifier=identifier)
def json_params(self):
params = ['traded_price']
params += super(EqDividendFutureByCode, self).json_params()
return params
[docs]
class EqDividendFuture(FullySpecified):
[docs]
def __init__(self,
currency=None,
dividend_index_identifier=None,
expiration_date=None,
identifier=None,
traded_price=None,
**kwargs):
"""
:param currency: The currency
:param dividend_index_identifier: The dividend index identifier
:param expiration_date: The expiration date
:param identifier: The security identifier
:param traded_price: The traded price
"""
self.dividend_index_identifier = dividend_index_identifier
self.traded_price = traded_price
super(EqDividendFuture, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'dividend_index_identifier',
'traded_price'
]
params += super(EqDividendFuture, self).json_params()
return params
[docs]
class EqDividendOption(FullySpecified):
class ClaimType(IntEnum):
Call = 0
Put = 1
Forward = 2
DigitalCall = 3
DigitalPut = 4
[docs]
def __init__(self,
currency=None,
expiration_date=None,
identifier=None,
option_claim_type=None,
strike=None,
dividend_future=None,
**kwargs):
"""
:param currency: The currency
:param expiration_date: The expiration date
:param identifier: The security identifier
:param option_claim_type: The claim type
:param strike: The strike
:param dividend_future: The underlyer
"""
self.option_claim_type = option_claim_type
self.strike = strike
self.dividend_future = dividend_future
super(EqDividendOption, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'option_claim_type',
'strike',
'dividend_future',
]
params += super(EqDividendOption, self).json_params()
return params
[docs]
class EqDivDualDigitalOption(EqDividendOption):
"""Dividend option conditional on a separate equity's level at expiry.
Uses EqDividendOption.ClaimType values (DigitalCall=3, DigitalPut=4).
"""
[docs]
def __init__(self, currency=None, expiration_date=None, identifier=None,
option_claim_type=None, strike=None, dividend_future=None,
equity_asset=None, lower_barrier=None, upper_barrier=None, **kwargs):
"""
:param currency: Contract currency code, e.g. USD.
:param expiration_date: Option expiry as a datetime, serialized in UTC.
:param identifier: Optional caller-supplied contract identifier.
:param option_claim_type: Dividend payoff claim from ClaimType.
:param strike: Dividend strike in the underlying future's quotation units.
:param dividend_future: EqDividendFutureByCode identifying the dividend future.
:param equity_asset: InstrumentIdentifier for the equity barrier underlying.
:param lower_barrier: Lower equity level in spot quotation units; None omits it.
:param upper_barrier: Upper equity level in spot quotation units; None omits it.
"""
super().__init__(currency=currency, expiration_date=expiration_date,
identifier=identifier, option_claim_type=option_claim_type,
strike=strike, dividend_future=dividend_future)
self.equity_asset = equity_asset
self.lower_barrier = lower_barrier
self.upper_barrier = upper_barrier
def json_params(self):
return super().json_params() + ['equity_asset', 'lower_barrier', 'upper_barrier']
[docs]
class EqIRDualDigitalOption(FullySpecified):
"""Equity option conditional on an interest-rate swap fixing at expiry."""
class ClaimType(IntEnum):
Call = 0
Put = 1
DigitalCall = 2
DigitalPut = 3
[docs]
def __init__(self, currency=None, expiration_date=None, identifier=None,
equity_asset=None, ir_swap_fixing_instrument=None, option_claim_type=None,
strike=None, lower_rate_barrier=None, upper_rate_barrier=None,
settlement_lag=None, calendar=None, **kwargs):
"""
:param currency: Contract currency code, e.g. USD.
:param expiration_date: Option expiry as a datetime, serialized in UTC.
:param identifier: Optional caller-supplied contract identifier.
:param equity_asset: InstrumentIdentifier for the equity underlying.
:param ir_swap_fixing_instrument: InstrumentIdentifier for a registered swap fixing.
:param option_claim_type: Equity payoff: Call=0, Put=1, DigitalCall=2, DigitalPut=3.
:param strike: Equity strike in spot quotation units.
:param lower_rate_barrier: Lower swap-rate barrier as a decimal (0.01 is 1%).
:param upper_rate_barrier: Upper swap-rate barrier as a decimal (0.05 is 5%).
:param settlement_lag: Settlement delay in business days after expiry.
:param calendar: Settlement calendar name.
"""
super().__init__(currency=currency, expiration_date=expiration_date, identifier=identifier)
self.equity_asset = equity_asset
self.ir_swap_fixing_instrument = ir_swap_fixing_instrument
self.option_claim_type = option_claim_type
self.strike = strike
self.lower_rate_barrier = lower_rate_barrier
self.upper_rate_barrier = upper_rate_barrier
self.settlement_lag = settlement_lag
self.calendar = calendar
def json_params(self):
return super().json_params() + [
'equity_asset', 'ir_swap_fixing_instrument', 'option_claim_type', 'strike',
'lower_rate_barrier', 'upper_rate_barrier', 'settlement_lag', 'calendar']
[docs]
class EqDividendSwap(FullySpecified):
[docs]
def __init__(self,
currency=None,
expiration_date=None,
identifier=None,
schedule_end_date=None,
schedule_start_date=None,
payment_frequency=None,
strike=None,
settlement_delay=None,
include_special_dividends=None,
underlyer=None,
period_start_dates=None,
period_end_dates=None,
**kwargs):
"""
:param identifier: The security identifier
:param schedule_end_date: The schedule end date
:param schedule_start_date: The schedule start date
:param payment_frequency: The payment frequency
:param strike: The strike
:param settlement_delay: The settlement delay
:param include_special_dividends: The include special dividends
:param underlyer: The underlyer
:param period_start_dates: The period start dates
:param period_end_dates: The period end dates
"""
self.schedule_end_date = schedule_end_date
self.schedule_start_date = schedule_start_date
self.payment_frequency = payment_frequency
self.strike = strike
self.settlement_delay = settlement_delay
self.include_special_dividends = include_special_dividends
self.underlyer = underlyer
self.period_start_dates = period_start_dates
self.period_end_dates = period_end_dates
super(EqDividendSwap, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'schedule_end_date',
'schedule_start_date',
'payment_frequency',
'strike',
'settlement_delay',
'include_special_dividends',
'underlyer',
'period_start_dates',
'period_end_dates'
]
params += super(EqDividendSwap, self).json_params()
return params
[docs]
class EqDividendSwapKnockout(FullySpecified):
class BarrierTypes(IntEnum):
UpAndIn = 0,
UpAndOut = 1,
DownAndIn = 2,
DownAndOut = 3
class RebateTypes(IntEnum):
NULL = 0,
PayAtKnock = 1,
PayAtMaturity = 2
[docs]
def __init__(self,
barrier=None,
barrier_type=None,
barrier_observation_dates=None,
rebate_type=None,
rebate=None,
currency=None,
expiration_date=None,
identifier=None,
schedule_end_date=None,
schedule_start_date=None,
payment_frequency=None,
strike=None,
settlement_delay=None,
include_special_dividends=None,
underlyer=None,
period_start_dates=None,
period_end_dates=None,
**kwargs):
"""
:param identifier: The security identifier
:param schedule_end_date: The schedule end date
:param schedule_start_date: The schedule start date
:param payment_frequency: The payment frequency
:param strike: The strike
:param settlement_delay: The settlement delay
:param include_special_dividends: The include special dividends
:param underlyer: The underlyer
:param period_start_dates: The period start dates
:param period_end_dates: The period end dates
"""
self.barrier = barrier
self.barrier_type = barrier_type
self.barrier_observation_dates = barrier_observation_dates
self.rebate_type = rebate_type
self.rebate = rebate
self.schedule_end_date = schedule_end_date
self.schedule_start_date = schedule_start_date
self.payment_frequency = payment_frequency
self.strike = strike
self.settlement_delay = settlement_delay
self.include_special_dividends = include_special_dividends
self.underlyer = underlyer
self.period_start_dates = period_start_dates
self.period_end_dates = period_end_dates
super(EqDividendSwapKnockout, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'barrier',
'barrier_type',
'barrier_observation_dates',
'rebate_type',
'rebate',
'schedule_end_date',
'schedule_start_date',
'payment_frequency',
'strike',
'settlement_delay',
'include_special_dividends',
'underlyer',
'period_start_dates',
'period_end_dates'
]
params += super(EqDividendSwapKnockout, self).json_params()
return params
[docs]
class Repo(FullySpecified):
[docs]
def __init__(self,
identifier=None,
currency=None,
start_date=None,
expiration_date=None,
day_count_convention=None,
repo_rate=None,
is_settled=None,
collateral_id=None,
**kwargs):
"""
:param identifier: The security identifier
:param currency: The currency
:param start_date: The start date
:param expiration_date: The expiration date
:param day_count_convention: The day count convention
:param repo_rate: The repo rate
:param is_settled: The isSettled flag
:param collateral_id: The collateral bond id
"""
self.start_date = start_date
self.day_count_convention = day_count_convention
self.repo_rate = repo_rate
self.is_settled = is_settled
self.collateral_id = collateral_id
super(Repo, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'start_date',
'day_count_convention',
'repo_rate',
'is_settled',
'collateral_id',
]
params += super(Repo, self).json_params()
return params
[docs]
class Tranche(FullySpecified):
class AmortisationType(IntEnum):
ProRata = 0,
Sequential = 1
[docs]
def __init__(self,
tranche_id=None,
attachment=None,
detachment=None,
payment_dates=None,
next_payment_index=None,
dated_date=None,
currency=None,
rate_asset_name=None,
spread=None,
day_count_convention=None,
amortisation_start_date=None,
tranche_amortisation_type=None,
senior_factor=None,
tranche_factor=None,
junior_factor=None,
identifier=None,
**kwargs):
"""
:param tranche_id: Identifier for the tranche
:param attachment: Attachment point
:param detachment: Detachment point
:param payment_dates: List of scheduled payment dates
:param next_payment_index: Index of the next payment date in payment_dates
:param dated_date: The date on which the tranche becomes effective
:param currency: Currency in which the tranche is denominated
:param rate_asset_name: Name of the benchmark rate or rate asset
:param spread: Spread over the benchmark rate
:param day_count_convention: Day count convention used for interest calculation
:param amortisation_start_date: Start date for amortisation
:param tranche_amortisation_type: Amortisation type (pro rata or sequential)
:param senior_factor: The senior factor
:param tranche_factor: The tranche factor
:param junior_factor: The junior factor
"""
self.tranche_id = tranche_id
self.attachment = attachment
self.detachment = detachment
self.payment_dates = payment_dates
self.next_payment_index = next_payment_index
self.dated_date = dated_date
self.rate_asset_name = rate_asset_name
self.spread = spread
self.day_count_convention = day_count_convention
self.amortisation_start_date = amortisation_start_date
self.tranche_amortisation_type = tranche_amortisation_type
self.senior_factor = senior_factor
self.tranche_factor = tranche_factor
self.junior_factor = junior_factor
super(Tranche, self).__init__(
currency=currency,
identifier=identifier)
def json_params(self):
params = [
'tranche_id',
'attachment',
'detachment',
'payment_dates',
'next_payment_index',
'dated_date',
'currency',
'rate_asset_name',
'spread',
'day_count_convention',
'amortisation_start_date',
'tranche_amortisation_type',
'senior_factor',
'tranche_factor',
'junior_factor'
]
params += super(Tranche, self).json_params()
return params
[docs]
class EqFVA(FullySpecified):
class StrikeType(IntEnum):
Fixed = 0
Floating = 1
DeltaNeutral = 2
[docs]
def __init__(self,
identifier=None,
underlyer=None,
currency=None,
expiration_date=None,
premium_determination_date=None,
benchmark_volatility=None,
calendar=None,
settlement_lag=None,
claim_type=None,
strike_type=None,
strike=None,
benchmark_premium_payment_date=None,
benchmark_rate=None,
benchmark_growth=None,
**kwargs):
"""
:param identifier: The security identifier
:param underlyer: The underlyer
:param currency: The currency
:param expiration_date: The expiration date
:param premium_determination_date: The premium determination date
:param benchmark_volatility: The benchmark volatility
:param calendar: The calendar
:param settlement_lag: The settlement lag
:param claim_type: The claim type
:param strike_type: The strike type
:param strike: The strike
:param benchmark_premium_payment_date: The premium payment date
:param benchmark_rate: The benchmark rate
:param benchmark_growth: The benchmark growth
"""
self.underlyer = underlyer
self.premium_determination_date = premium_determination_date
self.benchmark_volatility = benchmark_volatility
self.calendar = calendar
self.settlement_lag = settlement_lag
self.claim_type = claim_type
self.strike_type = strike_type
self.strike = strike
self.benchmark_premium_payment_date = benchmark_premium_payment_date
self.benchmark_rate = benchmark_rate
self.benchmark_growth = benchmark_growth
super(EqFVA, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'underlyer',
'premium_determination_date',
'benchmark_volatility',
'calendar',
'settlement_lag',
'claim_type',
'strike_type',
'strike',
'benchmark_premium_payment_date',
'benchmark_rate',
'benchmark_growth'
]
params += super(EqFVA, self).json_params()
return params
[docs]
class BondOption(FullySpecified):
class ClaimType(IntEnum):
Put = 0
Call = 1
[docs]
def __init__(self,
identifier=None,
option_claim_type=None,
currency=None,
expiration_date=None,
premium_paid_up_front=None,
strike=None,
bond_future=None,
**kwargs):
"""
:param identifier: The security identifier
:param option_claim_type: The claim type
:param currency: The currency
:param expiration_date: The expiration date
:param premium_paid_up_front: The premium paid up front
:param strike: The strike
:param bond_futuer: The underlyer
"""
self.option_claim_type = option_claim_type
self.premium_paid_up_front = premium_paid_up_front
self.strike = strike
self.bond_future = bond_future
super(BondOption, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'option_claim_type',
'premium_paid_up_front',
'strike',
'bond_future',
]
params += super(BondOption, self).json_params()
return params
[docs]
class CreditIndex(FullySpecified):
[docs]
def __init__(self,
identifier=None,
credit_index_identifier=None,
business_day_convention=None,
calendar=None,
coupon_frequency=None,
coupon_rate=None,
recovery_rate=None,
currency=None,
start_date=None,
day_count_convention=None,
end_to_end=None,
first_coupon_date=None,
expiration_date=None,
penultimate_coupon_date=None,
settlement_type=None,
settlement_lag=None,
pay_accrual_at_default=None,
protection_at_start_of_day=None,
debt_type=None,
default_type=None,
roll_date=None,
**kwargs):
"""
:param identifier: The security identifier
:param credit_index_identifier: The credit index identifier
:param business_day_convention: The business day convention
:param calendar: The calendar
:param coupon_frequency: The coupon frequency
:param coupon_rate: The coupon rate
:param recovery_rate: The recovery rate
:param currency: The currency
:param start_date: The start date
:param day_count_convention: The day count convention
:param end_to_end: The end to end
:param first_coupon_date: The first coupon date
:param expiration_date: The expiration date
:param penultimate_coupon_date: The penultimate coupon date
:param settlement_type: The settlement type
:param settlement_lag: The settlement lag
:param pay_accrual_at_default: The pay accrual at default
:param protection_at_start_of_day: The protection at start of day
:param debt_type: The debt type
:param default_type: The default type
:param roll_date: The roll date
"""
self.credit_index_identifier = credit_index_identifier
self.business_day_convention = business_day_convention
self.calendar = calendar
self.coupon_frequency = coupon_frequency
self.coupon_rate = coupon_rate
self.recovery_rate = recovery_rate
self.start_date = start_date
self.day_count_convention = day_count_convention
self.end_to_end = end_to_end
self.first_coupon_date = first_coupon_date
self.penultimate_coupon_date = penultimate_coupon_date
self.settlement_type = settlement_type
self.settlement_lag = settlement_lag
self.pay_accrual_at_default = pay_accrual_at_default
self.protection_at_start_of_day = protection_at_start_of_day
self.debt_type = debt_type
self.default_type = default_type
self.roll_date = roll_date
super(CreditIndex, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'credit_index_identifier',
'business_day_convention',
'calendar',
'coupon_frequency',
'calendar',
'coupon_frequency',
'coupon_rate',
'recovery_rate',
'start_date',
'day_count_convention',
'end_to_end',
'first_coupon_date',
'penultimate_coupon_date',
'settlement_type',
'settlement_lag',
'pay_accrual_at_default',
'protection_at_start_of_day',
'debt_type',
'default_type',
'roll_date'
]
params += super(CreditIndex, self).json_params()
return params
[docs]
class CreditIndexSwaption(FullySpecified):
class ClaimTypes(IntEnum):
Payer = 0
Receiver = 1
[docs]
def __init__(self,
identifier=None,
credit_index=None,
strike=None,
claim_type=None,
currency=None,
expiration_date=None,
is_price_based_strike=None,
**kwargs):
"""
:param identifier: The security identifier
:param credit_index: The credit index
:param strike: The strike
:param claim_type: The claim type
:param currency: The currency
:param expiration_date: The expiration date
:param is_price_based_strike: The is price based strike flag
"""
self.credit_index = credit_index
self.strike = strike
self.claim_type = claim_type
self.is_price_based_strike = is_price_based_strike
super(CreditIndexSwaption, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'credit_index',
'strike',
'claim_type',
'is_price_based_strike',
]
params += super(CreditIndexSwaption, self).json_params()
return params
[docs]
class EqAccumulator(FullySpecified):
class SettlementType(IntEnum):
Cash = 1
Physical = 0
class BarrierType(IntEnum):
KnockOut = 2
KnockIn = 1
Null = 0
[docs]
def __init__(self,
identifier=None,
schedule_end_date=None,
schedule_start_date=None,
payment_frequency=None,
business_day_convention=None,
strikes=None,
leveraging_factors=None,
knockout_barrier_levels=None,
shares=None,
calendar_name=None,
option_settlement_type=None,
settlement_delay=None,
is_accumulator=None,
num_guaranteed_periods=None,
underlyer=None,
currency=None,
expiration_date=None,
accumulate_shares_on_knockout=None,
fixing_dates=None,
period_end_dates=None,
period_start_dates=None,
call_barrier_type=None,
call_barrier_levels=None,
put_barrier_type=None,
put_barrier_levels=None,
**kwargs):
"""
:param identifier: The security identifier
:param schedule_end_date: The schedule end date
:param schedule_start_date: The schedule start date
:param payment_frequency: The payment frequency
:param business_day_convention: The business day convention
:param strikes: The strikes
:param leveraging_factors: The leveraging factors
:param knockout_barrier_levels: The knockout barrier levels
:param shares: The shares
:param calendar_name: The calendar name
:param option_settlement_type: The option settlement type
:param settlement_delay: The settlement lag
:param is_accumulator: The is accumulator flag
:param num_guaranteed_periods: The guaranteed periods number
:param underlyer: The underlyer
:param currency: The currency
:param expiration_date: The expiration date
:param accumulate_shares_on_knockout: The accumulate shares on knockout flag
:param fixing_dates: The fixing dates
:param period_end_dates: The period end date
:param period_start_dates: The period start date
:param call_barrier_type: The call barrier type
:param call_barrier_levels: The call barrier levels
:param put_barrier_type: The put barrier type
:param put_barrier_levels: The put barrier levels
"""
self.schedule_end_date = schedule_end_date
self.schedule_start_date = schedule_start_date
self.payment_frequency = payment_frequency
self.business_day_convention = business_day_convention
self.strikes = strikes
self.leveraging_factors = leveraging_factors
self.knockout_barrier_levels = knockout_barrier_levels
self.shares = shares
self.calendar_name = calendar_name
self.option_settlement_type = option_settlement_type
self.settlement_delay = settlement_delay
self.is_accumulator = is_accumulator
self.num_guaranteed_periods = num_guaranteed_periods
self.underlyer = underlyer
self.accumulate_shares_on_knockout = accumulate_shares_on_knockout
self.fixing_dates = fixing_dates
self.period_end_dates = period_end_dates
self.period_start_dates = period_start_dates
self.call_barrier_type = call_barrier_type
self.call_barrier_levels = call_barrier_levels
self.put_barrier_type = put_barrier_type
self.put_barrier_levels = put_barrier_levels
super(EqAccumulator, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'schedule_end_date',
'schedule_start_date',
'payment_frequency',
'business_day_convention',
'strikes',
'leveraging_factors',
'knockout_barrier_levels',
'shares',
'calendar_name',
'option_settlement_type',
'settlement_delay',
'is_accumulator',
'num_guaranteed_periods',
'underlyer',
'accumulate_shares_on_knockout',
'fixing_dates',
'period_end_dates',
'period_start_dates',
'call_barrier_type',
'call_barrier_levels',
'put_barrier_type',
'put_barrier_levels',
]
params += super(EqAccumulator, self).json_params()
return params
[docs]
class EqCorridorVarianceSwap(EqVolatilitySwapBase):
class CorridorType(IntEnum):
Prior = 1,
Current = 2,
Both = 3,
[docs]
def __init__(self,
identifier=None,
annualisation_factor=None,
calendar_name=None,
currency=None,
expiration_date=None,
include_dividend_jumps=None,
initial_date=None,
return_lag=1,
settlement_delay=None,
tenor=None,
underlyer=None,
vol_strike=None,
lower_barrier=None,
is_lower_barrier_active=None,
upper_barrier=None,
is_upper_barrier_active=None,
is_normalised=None,
knockout_barrier=None,
knockout_barrier_type=EqVolatilitySwapBase.BarrierType.NULL,
corridor_type=CorridorType.Prior,
knockin_barrier_type=EqVolatilitySwapBase.BarrierType.NULL,
knockin_observation_type=None,
knockin_barrier=None,
knockin_upper_barrier=None,
knockin_payoff_type=None,
**kwargs):
"""
:param identifier: The security identifier
:param annualisation_factor: The annualisation factor
:param calendar_name: The calendar name
:param currency: The currency
:param expiration_date: The expiration date
:param include_dividend_jumps: The include dividend jumps
:param initial_date: The initial date
:param return_lag: The return lag
:param settlement_delay: The settlement delay
:param tenor: The tenor
:param underlyer: The underlyer
:param vol_strike: The vol strike
:param lower_barrier: The lower barrier
:param is_lower_barrier_active: The is lower barrier active flag
:param upper_barrier: The upper barrier
:param is_upper_barrier_active: The is upper barrier active flag
:param is_normalised: The is normalised flag
:param knockout_barrier: The knockout barrier
:param knockout_barrier_type: The knockout barrier type
:param corridor_type: The corridor_type
:param knockin_barrier_type: The knockin_barrier_type
:param knockin_observation_type: The knockin_observation_type
:param knockin_barrier: The knockin_barrier
:param knockin_upper_barrier: The knockin_upper_barrier
:param knockin_payoff_type: The knockin_payoff_type
"""
self.lower_barrier = lower_barrier
self.is_lower_barrier_active = is_lower_barrier_active
self.upper_barrier = upper_barrier
self.is_upper_barrier_active = is_upper_barrier_active
self.is_normalised = is_normalised
self.knockout_barrier = knockout_barrier
self.knockout_barrier_type = knockout_barrier_type
self.knockin_barrier_type = knockin_barrier_type
self.corridor_type = corridor_type
self.knockin_observation_type = knockin_observation_type
self.knockin_barrier = knockin_barrier
self.knockin_upper_barrier = knockin_upper_barrier
self.knockin_payoff_type = knockin_payoff_type
super(EqCorridorVarianceSwap, self).__init__(
annualisation_factor=annualisation_factor,
calendar_name=calendar_name,
currency=currency,
expiration_date=expiration_date,
identifier=identifier,
include_dividend_jumps=include_dividend_jumps,
initial_date=initial_date,
return_lag=return_lag,
settlement_delay=settlement_delay,
tenor=tenor,
underlyer=underlyer,
vol_strike=vol_strike)
def json_params(self):
params = [
'lower_barrier',
'is_lower_barrier_active',
'upper_barrier',
'is_upper_barrier_active',
'is_normalised',
'knockout_barrier',
'knockout_barrier_type',
'knockin_barrier_type',
'corridor_type',
'knockin_observation_type',
'knockin_barrier',
'knockin_upper_barrier',
'knockin_payoff_type'
]
params += super(EqCorridorVarianceSwap, self).json_params()
return params
[docs]
class EqAutocallableWorstOfOption(FullySpecified):
class ClaimType(IntEnum):
Put = 1
Call = 0
class SettlementType(IntEnum):
Physical = 1
Cash = 0
class PerformanceType(IntEnum):
NotSet = -1,
WorstOf = 0,
BestOf = 1,
Weighted = 2
class BarrierType(IntEnum):
NotSet = -1,
UpAndOut = 0,
DownAndOut = 1
[docs]
def __init__(self,
identifier=None,
basket_name=None,
currency=None,
equity_identifiers=None,
initial_fixings=None,
weights=None,
benchmark_asset_index=None,
knockout_performance_type=None,
knockout_barrier_type=None,
strike_performance_type=None,
is_worst_of=None,
is_knock_asset=None,
knockin_level=None,
redemption_rate=None,
strike=None,
option_claim_type=None,
option_settlement_type=None,
payment_lag=None,
settlement_lag=None,
calendar=None,
expiration_date=None,
start_date=None,
period_str=None,
knockout_determination_dates=None,
knockout_barrier_levels=None,
early_redemption_rates=None,
coupon_frequency=None,
coupon_end_dates=None,
coupon_rates=None,
coupon_barrier_levels=None,
minimum_coupon_rates=None,
is_annualised_coupon=None,
coupon_rate=None,
next_coupon_index=None,
knockout_barrier_shifts=None,
coupon_barrier_shifts=None,
knockin_barrier_shift=None,
memory_coupon=None,
**kwargs):
"""
:param identifier: The security identifier
:param basket_name: The basket name
:param currency: The currency
:param equity_identifiers: The equity assets
:param initial_fixings: The initial fixings
:param is_worst_of: The is worst of flag
:param is_knock_asset: The is knock asset flag
:param knockin_level: The knockin level
:param redemption_rate: The redemption rate
:param strike: The strike
:param option_claim_type: The option claim type
:param option_settlement_type: The option settlement type
:param payment_lag: The payment lag
:param settlement_lag: The settlement lag
:param calendar: The calendar
:param expiration_date: The expiration date
:param start_date: The start date
:param period_str: The knockout frequency
:param knockout_determination_dates: The knockout determination dates
:param knockout_barrier_levels: The knockout barrier levels
:param early_redemption_rates: The early redemption rates
:param coupon_frequency: The coupon frequency
:param coupon_end_dates: The coupon end dates
:param coupon_rates: The coupon rates
:param coupon_barrier_levels: The coupon barrier levels
:param is_annualised_coupon: The is annualised coupon flag
:param coupon_rate: The coupon rate
:param next_coupon_index: The next coupon index
:param knockout_barrier_shifts: The knockout barrier shifts
:param coupon_barrier_shifts: The coupon barrier shifts
:param knockin_barrier_shift: The knockin barrier shift
:param memory_coupon: The memory coupon flag
"""
self.basket_name = basket_name
self.equity_identifiers = equity_identifiers
self.initial_fixings = initial_fixings
self.weights = weights
self.benchmark_asset_index = benchmark_asset_index
self.knockout_performance_type = knockout_performance_type
self.knockout_barrier_type = knockout_barrier_type
self.strike_performance_type = strike_performance_type
self.is_worst_of = is_worst_of
self.is_knock_asset = is_knock_asset
self.knockin_level = knockin_level
self.redemption_rate = redemption_rate
self.strike = strike
self.option_claim_type = option_claim_type
self.option_settlement_type = option_settlement_type
self.payment_lag = payment_lag
self.settlement_lag = settlement_lag
self.calendar = calendar
self.start_date = start_date
self.period_str = period_str
self.knockout_determination_dates = knockout_determination_dates
self.knockout_barrier_levels = knockout_barrier_levels
self.early_redemption_rates = early_redemption_rates
self.coupon_frequency = coupon_frequency
self.coupon_end_dates = coupon_end_dates
self.coupon_rates = coupon_rates
self.coupon_barrier_levels = coupon_barrier_levels
self.minimum_coupon_rates = minimum_coupon_rates
self.is_annualised_coupon = is_annualised_coupon
self.coupon_rate = coupon_rate
self.next_coupon_index = next_coupon_index
self.knockout_barrier_shifts = knockout_barrier_shifts
self.coupon_barrier_shifts = coupon_barrier_shifts
self.knockin_barrier_shift = knockin_barrier_shift
self.memory_coupon = memory_coupon
super(EqAutocallableWorstOfOption, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'basket_name',
'equity_identifiers',
'initial_fixings',
'weights',
'benchmark_asset_index',
'knockout_performance_type',
'knockout_barrier_type',
'strike_performance_type',
'is_worst_of',
'is_knock_asset',
'knockin_level',
'redemption_rate',
'strike',
'option_claim_type',
'option_settlement_type',
'payment_lag',
'settlement_lag',
'calendar',
'start_date',
'period_str',
'knockout_determination_dates',
'knockout_barrier_levels',
'early_redemption_rates',
'coupon_frequency',
'coupon_end_dates',
'coupon_rates',
'coupon_barrier_levels',
'minimum_coupon_rates',
'is_annualised_coupon',
'coupon_rate',
'next_coupon_index',
'knockout_barrier_shifts',
'coupon_barrier_shifts',
'knockin_barrier_shift',
'memory_coupon'
]
params += super(EqAutocallableWorstOfOption, self).json_params()
return params
[docs]
class EqBarrierMA(FullySpecified):
class ClaimTypeEq(IntEnum):
DigitalCall = 0
DigitalPut = 1
Call = 2
Put = 3
class KnockTypeEq(IntEnum):
KnockOut = 0
KnockIn = 1
[docs]
def __init__(self,
identifier=None,
calendar_name=None,
currency=None,
expiration_date=None,
barrier_start_date=None,
barrier_end_date=None,
settlement_lag=None,
basket_name=None,
equity_identifiers=None,
upper_barrier_levels=None,
lower_barrier_levels=None,
option_knock_type=None,
strikes=None,
claim_types=None,
fx_pairs=None,
fx_upper_barrier_levels=None,
fx_lower_barrier_levels=None,
fx_strikes=None,
**kwargs):
"""
:param identifier: The security identifier
:param calendar_name: The calendar name
:param currency: The currency
:param expiration_date: The expiration date
:param barrier_start_date: The barrier start date
:param barrier_end_date: The barrier end date
:param settlement_lag: The settlement lag
:param basket_name: The basket name
:param equity_identifiers: The equity identifiers
:param upper_barrier_levels: The upper barriers
:param lower_barrier_levles: The lower barriers
:param option_knock_type: The knock type
:param strikes: The strikes
:param claim_types: The claim types
:param fx_pairs: The fx_pairs
:param fx_upper_barrier_levels: The fx_upper_barrier_levels
:param fx_lower_barrier_levels: The fx_lower_barrier_levels
:param fx_strikes: The fx_strikes
"""
self.calendar_name = calendar_name
self.barrier_start_date = barrier_start_date
self.barrier_end_date = barrier_end_date
self.settlement_lag = settlement_lag
self.basket_name = basket_name
self.equity_identifiers = equity_identifiers
self.upper_barrier_levels = upper_barrier_levels
self.lower_barrier_levels = lower_barrier_levels
self.option_knock_type = option_knock_type
self.strikes = strikes
self.claim_types = claim_types
self.fx_pairs = fx_pairs
self.fx_upper_barrier_levels = fx_upper_barrier_levels
self.fx_lower_barrier_levels = fx_lower_barrier_levels
self.fx_strikes = fx_strikes
super(EqBarrierMA, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'calendar_name',
'barrier_start_date',
'barrier_end_date',
'settlement_lag',
'basket_name',
'equity_identifiers',
'upper_barrier_levels',
'lower_barrier_levels',
'option_knock_type',
'strikes',
'claim_types',
'fx_pairs',
'fx_upper_barrier_levels',
'fx_lower_barrier_levels',
'fx_strikes'
]
params += super(EqBarrierMA, self).json_params()
return params
def to_dict(self):
param_dict = super(EqBarrierMA, self).to_dict()
if 'fx_upper_barrier_levels' in param_dict.keys():
fx_upper_barrier_levels = param_dict['fx_upper_barrier_levels']
if isinstance(fx_upper_barrier_levels, dict):
fx_upper_barrier_levels_list = []
for k, v in fx_upper_barrier_levels.items():
fx_upper_barrier_levels_list.append({'key': k, 'value': v})
param_dict.update({'fx_upper_barrier_levels': fx_upper_barrier_levels_list})
if 'fx_lower_barrier_levels' in param_dict.keys():
fx_lower_barrier_levels = param_dict['fx_lower_barrier_levels']
if isinstance(fx_lower_barrier_levels, dict):
fx_lower_barrier_levels_list = []
for k, v in fx_lower_barrier_levels.items():
fx_lower_barrier_levels_list.append({'key': k, 'value': v})
param_dict.update({'fx_lower_barrier_levels': fx_lower_barrier_levels_list})
if 'fx_strikes' in param_dict.keys():
fx_strikes = param_dict['fx_strikes']
if isinstance(fx_strikes, dict):
fx_strikes_list = []
for k, v in fx_strikes.items():
fx_strikes_list.append({'key': k, 'value': v})
param_dict.update({'fx_strikes': fx_strikes_list})
return param_dict
[docs]
class EqBestOfOption(FullySpecified):
class ClaimType(IntEnum):
Put = 1
Call = 0
[docs]
def __init__(self,
identifier=None,
calendar=None,
claim_type=None,
currency=None,
expiration_date=None,
start_date=None,
settlement_lag=None,
strike=None,
is_best_of=None,
ranking=None,
basket_name=None,
equity_identifiers=None,
initial_fixings=None,
is_quanto=None,
**kwargs):
"""
:param identifier: The security identifier
:param calendar: The calendar
:param currency: The currency
:param expiration_date: The expiration date
:param start_date: The start date
:param settlement_lag: The settlement lag
:param strike: The strike
:param is_best_of: The is best of flag
:param ranking: The ranking
:param basket_name: The basket name
:param equity_identifiers: The equity assets
:param initial_fixings: The initial fixings
:param is_quanto: The is quanto flag
"""
self.calendar = calendar
self.claim_type = claim_type
self.start_date = start_date
self.settlement_lag = settlement_lag
self.strike = strike
self.is_best_of = is_best_of
self.ranking = ranking
self.basket_name = basket_name
self.equity_identifiers = equity_identifiers
self.initial_fixings = initial_fixings
self.is_quanto = is_quanto
super(EqBestOfOption, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'calendar',
'claim_type',
'start_date',
'settlement_lag',
'strike',
'is_best_of',
'ranking',
'basket_name',
'equity_identifiers',
'initial_fixings',
'is_quanto',
]
params += super(EqBestOfOption, self).json_params()
return params
[docs]
class EqCorrelationSwap(FullySpecified):
class CorridorType(IntEnum):
Null = 0
Prior = 1
Current = 2
Both = 3
[docs]
def __init__(self,
identifier=None,
currency=None,
expiration_date=None,
equity_identifiers=None,
fx_pairs=None,
basket_name=None,
strike=None,
vol_strikes=None,
initial_date=None,
fixing_dates=None,
period_str=None,
annualisation_factor=None,
settlement_lag=None,
return_lag=None,
include_mean_adjustment=None,
calendar_name=None,
business_day_convention=None,
cutoff=None,
corridor_asset_idx=None,
lower_barrier=None,
upper_barrier=None,
corridor_type=None,
is_normalised=None,
**kwargs):
"""
:param identifier: The security identifier
:param currency: The currency
:param expiration_date: The expiration date
:param equity_identifiers: The equity assets
:param fx_pairs: The fx pairs
:param basket_name: The basket name
:param strike: The correlation strike
:param vol_strikes: The vol strikes
:param initial_date: The initial fixing date
:param fixing_dates: The fixing dates
:param period_str: The period string
:param annualisation_factor: The annualisation factor
:param settlement_lag: The settlement lag
:param return_lag: The return lag
:param include_mean_adjustment: The include mean adjustment flag
:param calendar_name: The calendar name
:param business_day_convention: The business day convention
:param cutoff: The cutoff
:param corridor_asset_idx: The corridor asset index
:param lower_barrier: The lower barrier
:param upper_barrier: The upper barrier
:param corridor_type: The corridor type
:param is_normalised: The is normalised flag
"""
self.equity_identifiers = equity_identifiers
self.fx_pairs = fx_pairs
self.basket_name = basket_name
self.strike = strike
self.vol_strikes = vol_strikes
self.initial_date = initial_date
self.fixing_dates = fixing_dates
self.period_str = period_str
self.annualisation_factor = annualisation_factor
self.settlement_lag = settlement_lag
self.return_lag = return_lag
self.include_mean_adjustment = include_mean_adjustment
self.calendar_name = calendar_name
self.business_day_convention = business_day_convention
self.cutoff = cutoff
self.corridor_asset_idx = corridor_asset_idx
self.lower_barrier = lower_barrier
self.upper_barrier = upper_barrier
self.corridor_type = corridor_type
self.is_normalised = is_normalised
super(EqCorrelationSwap, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'equity_identifiers',
'fx_pairs',
'basket_name',
'strike',
'vol_strikes',
'initial_date',
'fixing_dates',
'period_str',
'annualisation_factor',
'settlement_lag',
'return_lag',
'include_mean_adjustment',
'calendar_name',
'business_day_convention',
'cutoff',
'corridor_asset_idx',
'lower_barrier',
'upper_barrier',
'corridor_type',
'is_normalised',
]
params += super(EqCorrelationSwap, self).json_params()
return params
[docs]
class EqCorridorVolVarSwapBase(FullySpecified):
class CorridorType(IntEnum):
NULL = 0,
Prior = 1,
Current = 2,
Both = 3,
[docs]
def __init__(self,
identifier=None,
currency=None,
expiration_date=None,
equity_identifiers=None,
variance_asset_index=None,
vol_strike=None,
vol_cap=None,
initial_date=None,
fixing_dates=None,
period_str=None,
annualisation_factor=None,
settlement_lag=None,
calendar_name=None,
include_dividend_jumps=None,
corridor_asset_index=None,
lower_corridor_barrier=None,
upper_corridor_barrier=None,
corridor_type=None,
is_normalised=None,
**kwargs):
"""
:param identifier: The security identifier
:param currency: The currency
:param expiration_date: The expiration date
:param equity_identifiers: The equity assets
:param variance_asset_idx: The variance asset index
:param vol_strike: The vol strike
:param vol_cap: The vol cap
:param initial_date: The initial fixing date
:param fixing_dates: The fixing dates
:param period_str: The period string
:param annualisation_factor: The annualisation factor
:param settlement_lag: The settlement lag
:param calendar_name: The calendar name
:param include_dividend_jumps: The include dividend jumps flag
:param corridor_asset_idx: The corridor asset index
:param lower_corridor_barrier: The lower corridor barrier
:param upper_corridor_barrier: The upper corridor barrier
:param corridor_type: The corridor type
:param is_normalised: The is normalised flag
"""
self.equity_identifiers = equity_identifiers
self.variance_asset_index = variance_asset_index
self.vol_strike = vol_strike
self.vol_cap = vol_cap
self.initial_date = initial_date
self.fixing_dates = fixing_dates
self.period_str = period_str
self.annualisation_factor = annualisation_factor
self.settlement_lag = settlement_lag
self.calendar_name = calendar_name
self.include_dividend_jumps = include_dividend_jumps
self.corridor_asset_index = corridor_asset_index
self.lower_corridor_barrier = lower_corridor_barrier
self.upper_corridor_barrier = upper_corridor_barrier
self.corridor_type = corridor_type
self.is_normalised = is_normalised
super(EqCorridorVolVarSwapBase, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'equity_identifiers',
'variance_asset_index',
'vol_strike',
'vol_cap',
'initial_date',
'fixing_dates',
'period_str',
'annualisation_factor',
'settlement_lag',
'calendar_name',
'include_dividend_jumps',
'corridor_asset_index',
'lower_corridor_barrier',
'upper_corridor_barrier',
'corridor_type',
'is_normalised',
]
params += super(EqCorridorVolVarSwapBase, self).json_params()
return params
[docs]
class EqCorridorVolatilitySwap(EqCorridorVolVarSwapBase):
[docs]
def __init__(self,
identifier=None,
currency=None,
expiration_date=None,
equity_identifiers=None,
variance_asset_index=None,
vol_strike=None,
vol_cap=None,
initial_date=None,
fixing_dates=None,
period_str=None,
annualisation_factor=None,
settlement_lag=None,
calendar_name=None,
include_dividend_jumps=None,
corridor_asset_index=None,
lower_corridor_barrier=None,
upper_corridor_barrier=None,
corridor_type=None,
is_normalised=None,
**kwargs):
"""
:param identifier: The security identifier
:param currency: The currency
:param expiration_date: The expiration date
:param equity_identifiers: The equity assets
:param variance_asset_idx: The variance asset index
:param vol_strike: The vol strike
:param vol_cap: The vol cap
:param initial_date: The initial fixing date
:param fixing_dates: The fixing dates
:param period_str: The period string
:param annualisation_factor: The annualisation factor
:param settlement_lag: The settlement lag
:param calendar_name: The calendar name
:param include_dividend_jumps: The include dividend jumps flag
:param corridor_asset_idx: The corridor asset index
:param lower_corridor_barrier: The lower corridor barrier
:param upper_corridor_barrier: The upper corridor barrier
:param corridor_type: The corridor type
:param is_normalised: The is normalised flag
"""
super(EqCorridorVolatilitySwap, self).__init__(
identifier=identifier,
currency=currency,
expiration_date=expiration_date,
equity_identifiers=equity_identifiers,
variance_asset_index=variance_asset_index,
vol_strike=vol_strike,
vol_cap=vol_cap,
initial_date=initial_date,
fixing_dates=fixing_dates,
period_str=period_str,
annualisation_factor=annualisation_factor,
settlement_lag=settlement_lag,
calendar_name=calendar_name,
include_dividend_jumps=include_dividend_jumps,
corridor_asset_index=corridor_asset_index,
lower_corridor_barrier=lower_corridor_barrier,
upper_corridor_barrier=upper_corridor_barrier,
corridor_type=corridor_type,
is_normalised=is_normalised)
def json_params(self):
params = []
params += super(EqCorridorVolatilitySwap, self).json_params()
return params
[docs]
class EqConditionalCorridorVarianceSwap(EqCorridorVolVarSwapBase):
class BarrierType(IntEnum):
Null = 0
UpAndOut = 1
DownAndOut = 2
[docs]
def __init__(self,
identifier=None,
currency=None,
expiration_date=None,
equity_identifiers=None,
variance_asset_index=None,
vol_strike=None,
vol_cap=None,
initial_date=None,
fixing_dates=None,
period_str=None,
annualisation_factor=None,
settlement_lag=None,
calendar_name=None,
include_dividend_jumps=None,
corridor_asset_index=None,
lower_corridor_barrier=None,
upper_corridor_barrier=None,
corridor_type=None,
is_normalised=None,
knockout_barrier=None,
knockout_barrier_type=None,
knockout_asset_index=None,
# legacy fields
variance_asset_idx=None,
corridor_asset_idx=None,
knockout_asset_idx=None,
upper_barrier=None,
lower_barrier=None,
tenor=None,
**kwargs):
"""
:param identifier: The security identifier
:param currency: The currency
:param expiration_date: The expiration date
:param equity_identifiers: The equity assets
:param variance_asset_idx: The variance asset index
:param vol_strike: The vol strike
:param vol_cap: The vol cap
:param initial_date: The initial fixing date
:param fixing_dates: The fixing dates
:param period_str: The period string
:param annualisation_factor: The annualisation factor
:param settlement_lag: The settlement lag
:param calendar_name: The calendar name
:param include_dividend_jumps: The include dividend jumps flag
:param corridor_asset_idx: The corridor asset index
:param lower_corridor_barrier: The lower corridor barrier
:param upper_corridor_barrier: The upper corridor barrier
:param corridor_type: The corridor type
:param is_normalised: The is normalised flag
"""
self.knockout_barrier = knockout_barrier
self.knockout_barrier_type = knockout_barrier_type
self.knockout_asset_index = knockout_asset_index if knockout_asset_index is not None else knockout_asset_idx
super(EqConditionalCorridorVarianceSwap, self).__init__(
identifier=identifier,
currency=currency,
expiration_date=expiration_date,
equity_identifiers=equity_identifiers,
variance_asset_index=variance_asset_index if variance_asset_index is not None else variance_asset_idx,
vol_strike=vol_strike,
vol_cap=vol_cap,
initial_date=initial_date,
fixing_dates=fixing_dates,
period_str=period_str if period_str is not None else tenor,
annualisation_factor=annualisation_factor,
settlement_lag=settlement_lag,
calendar_name=calendar_name,
include_dividend_jumps=include_dividend_jumps,
corridor_asset_index=corridor_asset_index if corridor_asset_index is not None else corridor_asset_idx,
lower_corridor_barrier=lower_corridor_barrier if lower_corridor_barrier is not None else lower_barrier,
upper_corridor_barrier=upper_corridor_barrier if upper_corridor_barrier is not None else upper_barrier,
corridor_type=corridor_type,
is_normalised=is_normalised)
def json_params(self):
params = [
'knockout_barrier',
'knockout_barrier_type',
'knockout_asset_index',
]
params += super(EqConditionalCorridorVarianceSwap, self).json_params()
return params
[docs]
class EqDoubleKnockin(FullySpecified):
class ClaimType(IntEnum):
Call = 0
Put = 1
Forward = 2
DigitalCall = 3
DigitalPut = 4
[docs]
def __init__(self,
identifier=None,
underlyer=None,
calendar_name=None,
currency=None,
strike=None,
upper_barrier=None,
lower_barrier=None,
barrier_start_date=None,
barrier_end_date=None,
expiration_date=None,
settlement_lag=None,
option_claim_type=None,
rebate=None,
**kwargs):
"""
:param identifier: The security identifier
:param underlyer: The underlyer
:param calendar_name: The calendar name
:param currency: The currency
:param strike: The strike
:param upper_barrier: The upper barrier
:param lower_barrier: The lower barrier
:param barrier_start_date: The barrier start date
:param barrier_end_date: The barrier end date
:param expiration_date: The expiration date
:param settlement_lag: The settlement lag
:param option_claim_type: The claim type
:param rebate: The rebate
"""
self.underlyer = underlyer
self.calendar_name = calendar_name
self.strike = strike
self.upper_barrier = upper_barrier
self.lower_barrier = lower_barrier
self.barrier_start_date = barrier_start_date
self.barrier_end_date = barrier_end_date
self.settlement_lag = settlement_lag
self.option_claim_type = option_claim_type
self.rebate = rebate
super(EqDoubleKnockin, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'underlyer',
'calendar_name',
'strike',
'upper_barrier',
'lower_barrier',
'barrier_start_date',
'barrier_end_date',
'settlement_lag',
'option_claim_type',
'rebate',
]
params += super(EqDoubleKnockin, self).json_params()
return params
[docs]
class EqDoubleKnockout(FullySpecified):
class ClaimType(IntEnum):
Call = 0
Put = 1
Forward = 2
DigitalCall = 3
DigitalPut = 4
class RebateType(IntEnum):
PayAtKnock = 1
PayAtMaturity = 2
[docs]
def __init__(self,
identifier=None,
underlyer=None,
calendar_name=None,
currency=None,
strike=None,
upper_barrier=None,
lower_barrier=None,
barrier_start_date=None,
barrier_end_date=None,
expiration_date=None,
settlement_lag=None,
option_claim_type=None,
option_rebate_type=None,
rebate=None,
**kwargs):
"""
:param identifier: The security identifier
:param underlyer: The underlyer
:param calendar_name: The calendar name
:param currency: The currency
:param strike: The strike
:param upper_barrier: The upper barrier
:param lower_barrier: The lower barrier
:param barrier_start_date: The barrier start date
:param barrier_end_date: The barrier end date
:param expiration_date: The expiration date
:param settlement_lag: The settlement lag
:param option_claim_type: The claim type
:param option_rebate_type: The option rebate type
:param rebate: The rebate
"""
self.underlyer = underlyer
self.calendar_name = calendar_name
self.strike = strike
self.upper_barrier = upper_barrier
self.lower_barrier = lower_barrier
self.barrier_start_date = barrier_start_date
self.barrier_end_date = barrier_end_date
self.settlement_lag = settlement_lag
self.option_claim_type = option_claim_type
self.option_rebate_type = option_rebate_type
self.rebate = rebate
super(EqDoubleKnockout, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'underlyer',
'calendar_name',
'strike',
'upper_barrier',
'lower_barrier',
'barrier_start_date',
'barrier_end_date',
'settlement_lag',
'option_claim_type',
'option_rebate_type',
'rebate',
]
params += super(EqDoubleKnockout, self).json_params()
return params
[docs]
class EqFVASwaption(FullySpecified):
class OptionSwaptionClaimType(IntEnum):
Call = 0
Put = 1
[docs]
def __init__(self,
identifier=None,
underlyer=None,
currency=None,
expiration_date=None,
swaption_claim_type=None,
claim_type=None,
premium_determination_date=None,
benchmark_growth=None,
benchmark_rate=None,
benchmark_vol=None,
calendar_name=None,
settlement_lag=None,
strike=None,
benchmark_premium_payment_date=None,
**kwargs):
"""
:param identifier: The security identifier
:param underlyer: The underlyer
:param currency: The currency
:param expiration_date: The expiration date
:param swaption_claim_type: The swaption claim type
:param premium_determination_date: The premium determination date
:param benchmark_growth: The benchmark growth
:param benchmark_rate: The benchmark rate
:param benchmark_volatility: The benchmark volatility
:param calendar_name: The calendar name
:param settlement_lag: The settlement lag
:param claim_type: The claim type
:param strike: The strike
:param premium_payment_date: The premium payment date
"""
self.underlyer = underlyer
self.swaption_claim_type = swaption_claim_type
self.premium_determination_date = premium_determination_date
self.benchmark_growth = benchmark_growth
self.benchmark_rate = benchmark_rate
self.benchmark_vol = benchmark_vol
self.calendar_name = calendar_name
self.settlement_lag = settlement_lag
self.claim_type = claim_type
self.strike = strike
self.benchmark_premium_payment_date = benchmark_premium_payment_date
super(EqFVASwaption, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'underlyer',
'swaption_claim_type',
'premium_determination_date',
'benchmark_growth',
'benchmark_rate',
'benchmark_vol',
'calendar_name',
'settlement_lag',
'claim_type',
'strike',
'benchmark_premium_payment_date',
]
params += super(EqFVASwaption, self).json_params()
return params
[docs]
class EqGeometricVarianceSwap(FullySpecified):
[docs]
def __init__(self,
identifier=None,
basket_name=None,
currency=None,
expiration_date=None,
equity_identifiers=None,
vol_strike=None,
vol_cap=None,
initial_date=None,
fixing_dates=None,
period_str=None,
annualisation_factor=None,
settlement_lag=None,
return_lag=1,
include_dividend_jumps=None,
calendar_name=None,
**kwargs):
"""
:param identifier: The security identifier
:param basket_name: The basket name
:param currency: The currency
:param expiration_date: The expiration date
:param equity_identifiers: The equity assets
:param vol_strike: The vol strike
:param vol_cap: The vol_cap
:param initial_date: The initial date
:param fixing_dates: The fixing dates
:param period_str: The period
:param annualisation_factor: The annualisation factor
:param settlement_lag: The settlement lag
:param return_lag: The return lag
:param include_dividend_jumps: The include dividend jumps
:param calendar_name: The calendar name
"""
self.basket_name = basket_name
self.equity_identifiers = equity_identifiers
self.vol_strike = vol_strike
self.vol_cap = vol_cap
self.initial_date = initial_date
self.fixing_dates = fixing_dates
self.period_str = period_str
self.annualisation_factor = annualisation_factor
self.settlement_lag = settlement_lag
self.return_lag = return_lag
self.include_dividend_jumps = include_dividend_jumps
self.calendar_name = calendar_name
super(EqGeometricVarianceSwap, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'basket_name',
'equity_identifiers',
'vol_strike',
'vol_cap',
'initial_date',
'fixing_dates',
'period_str',
'annualisation_factor',
'settlement_lag',
'return_lag',
'include_dividend_jumps',
'calendar_name',
]
params += super(EqGeometricVarianceSwap, self).json_params()
return params
[docs]
class EqKnockin(FullySpecified):
class ClaimType(IntEnum):
Call = 0
Put = 1
Forward = 2
DigitalCall = 3
DigitalPut = 4
class BarrierType(IntEnum):
DownAndIn = 1
UpAndIn = 0
[docs]
def __init__(self,
identifier=None,
underlyer=None,
calendar_name=None,
currency=None,
strike=None,
option_barrier_type=None,
barrier=None,
barrier_start_date=None,
barrier_end_date=None,
expiration_date=None,
settlement_delay=None,
option_claim_type=None,
rebate=None,
**kwargs):
"""
:param identifier: The security identifier
:param underlyer: The underlyer
:param calendar_name: The calendar name
:param currency: The currency
:param strike: The strike
:param barrier_type: The barrier_type
:param barrier: The barrier
:param barrier_start_date: The barrier start date
:param barrier_end_date: The barrier end date
:param expiration_date: The expiration date
:param settlement_delay: The settlement delay
:param claim_type: The claim type
:param rebate: The rebate
"""
self.underlyer = underlyer
self.calendar_name = calendar_name
self.strike = strike
self.option_barrier_type = option_barrier_type
self.barrier = barrier
self.barrier_start_date = barrier_start_date
self.barrier_end_date = barrier_end_date
self.settlement_delay = settlement_delay
self.option_claim_type = option_claim_type
self.rebate = rebate
super(EqKnockin, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'underlyer',
'calendar_name',
'strike',
'option_barrier_type',
'barrier',
'barrier_start_date',
'barrier_end_date',
'settlement_delay',
'option_claim_type',
'rebate',
]
params += super(EqKnockin, self).json_params()
return params
[docs]
class EqKnockout(FullySpecified):
class ClaimType(IntEnum):
Call = 0
Put = 1
Forward = 2
DigitalCall = 3
DigitalPut = 4
class BarrierType(IntEnum):
DownAndOut = 1
UpAndOut = 0
class RebateType(IntEnum):
PayAtKnock = 1
PayAtMaturity = 2
[docs]
def __init__(self,
identifier=None,
underlyer=None,
calendar_name=None,
currency=None,
strike=None,
option_barrier_type=None,
barrier=None,
barrier_start_date=None,
barrier_end_date=None,
expiration_date=None,
settlement_delay=None,
option_claim_type=None,
option_rebate_type=None,
rebate=None,
**kwargs):
"""
:param identifier: The security identifier
:param underlyer: The underlyer
:param calendar_name: The calendar name
:param currency: The currency
:param strike: The strike
:param barrier_type: The barrier_type
:param barrier: The barrier
:param barrier_start_date: The barrier start date
:param barrier_end_date: The barrier end date
:param expiration_date: The expiration date
:param settlement_delay: The settlement delay
:param claim_type: The claim type
:param option_rebate_type: The option rebate type
:param rebate: The rebate
"""
self.underlyer = underlyer
self.calendar_name = calendar_name
self.strike = strike
self.option_barrier_type = option_barrier_type
self.barrier = barrier
self.barrier_start_date = barrier_start_date
self.barrier_end_date = barrier_end_date
self.settlement_delay = settlement_delay
self.option_claim_type = option_claim_type
self.option_rebate_type = option_rebate_type
self.rebate = rebate
super(EqKnockout, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'underlyer',
'calendar_name',
'strike',
'option_barrier_type',
'barrier',
'barrier_start_date',
'barrier_end_date',
'settlement_delay',
'option_claim_type',
'option_rebate_type',
'rebate',
]
params += super(EqKnockout, self).json_params()
return params
[docs]
class EqTarn(FullySpecified):
class BarrierType(IntEnum):
KnockIn = 1
KnockOut = 2
class SettlementType(IntEnum):
Physical = 0
Cash = 1
class TerminationCondition(IntEnum):
ByProfitAdjustedStrike = 0
ByItmFixingsNoPayoff = 1
ByProfitAdjustedNotional = 2
ByItmFixingsRegular = 3
ByProfitFullPayoff = 4
ByProfitNoPayoff = 5
[docs]
def __init__(self,
identifier=None,
business_day_convention=None,
calendar_id=None,
call_barrier_levels=None,
call_barrier_type=None,
call_notionals=None,
call_strikes=None,
currency=None,
end_stub=None,
end_to_end=None,
expiration_date=None,
first_fixing_date=None,
lower_knockout_levels=None,
next_fixing_idx=None,
period_str=None,
pivot_strikes=None,
put_barrier_levels=None,
put_barrier_type=None,
put_notionals=None,
put_strikes=None,
schedule_end_date=None,
schedule_roll_date=None,
schedule_start_date=None,
settlement_lag=None,
settlement_type=None,
start_stub=None,
target_level=None,
termination_condition=None,
underlyer=None,
upper_call_barrier_levels=None,
upper_call_barrier_type=None,
upper_call_notionals=None,
upper_call_strikes=None,
upper_knockout_levels=None,
upper_put_barrier_levels=None,
upper_put_barrier_type=None,
upper_put_notionals=None,
upper_put_strikes=None,
**kwargs):
"""
:param identifier: The security identifier
:param business_day_convention: The business day convention
:param calendar_id: The calendar id
:param call_barrier_levels: The call barrier levels
:param call_barrier_type: The call barrier type
:param call_notionals: The call notionals
:param call_strikes: The call strikes
:param currency: The currency
:param end_stub: The end stub
:param end_to_end: The end to end
:param expiration_date: The expiration date
:param first_fixing_date: The first fixing date
:param lower_knockout_levels: The lower knockout levels
:param next_fixing_idx: The nex fixing index
:param period_str: The period str
:param pivot_strikes: The pivot strikes
:param put_barrier_levels: The put barrier levels
:param put_barrier_type: The put barrier type
:param put_notionals: The put notionals
:param put_strikes: The put strikes
:param schedule_end_date: The schedule end date
:param schedule_roll_date: The schedule roll date
:param schedule_start_date: The schedule start date
:param settlement_lag: The settlement lag
:param settlement_type: The settlement type
:param start_stub: The start stub
:param target_level: The target level
:param termination_condition: The termination condition
:param underlyer: The underlyer
:param upper_call_barrier_levels: The upper call barrier levels
:param upper_call_barrier_type: The upper call barrier type
:param upper_call_notionals: The upper call notionals
:param upper_call_strikes: The upper call strikes
:param upper_knockout_levels: The upper knockout levels
:param upper_put_barrier_levels: The upper put barrier levels
:param upper_put_barrier_type: The upper put barrier type
:param upper_put_notionals: The upper put notionals
:param upper_put_strikes: The upper put strikes
"""
self.business_day_convention = business_day_convention
self.calendar_id = calendar_id
self.call_barrier_levels = call_barrier_levels
self.call_barrier_type = call_barrier_type
self.call_notionals = call_notionals
self.call_strikes = call_strikes
self.end_stub = end_stub
self.end_to_end = end_to_end
self.first_fixing_date = first_fixing_date
self.lower_knockout_levels = lower_knockout_levels
self.next_fixing_idx = next_fixing_idx
self.period_str = period_str
self.pivot_strikes = pivot_strikes
self.put_barrier_levels = put_barrier_levels
self.put_barrier_type = put_barrier_type
self.put_notionals = put_notionals
self.put_strikes = put_strikes
self.schedule_end_date = schedule_end_date
self.schedule_roll_date = schedule_roll_date
self.schedule_start_date = schedule_start_date
self.settlement_lag = settlement_lag
self.settlement_type = settlement_type
self.start_stub = start_stub
self.target_level = target_level
self.termination_condition = termination_condition
self.underlyer = underlyer
self.upper_knockout_levels = upper_knockout_levels
self.upper_call_barrier_levels = upper_call_barrier_levels
self.upper_call_barrier_type = upper_call_barrier_type
self.upper_call_notionals = upper_call_notionals
self.upper_call_strikes = upper_call_strikes
self.upper_knockout_levels = upper_knockout_levels
self.upper_put_barrier_levels = upper_put_barrier_levels
self.upper_put_barrier_type = upper_put_barrier_type
self.upper_put_notionals = upper_put_notionals
self.upper_put_strikes = upper_put_strikes
super(EqTarn, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'business_day_convention',
'calendar_id',
'call_barrier_levels',
'call_barrier_type',
'call_notionals',
'call_strikes',
'end_stub',
'end_to_end',
'first_fixing_date',
'lower_knockout_levels',
'next_fixing_idx',
'period_str',
'pivot_strikes',
'put_barrier_levels',
'put_barrier_type',
'put_notionals',
'put_strikes',
'schedule_end_date',
'schedule_roll_date',
'schedule_start_date',
'settlement_lag',
'settlement_type',
'start_stub',
'target_level',
'termination_condition',
'underlyer',
'upper_call_barrier_levels',
'upper_call_barrier_type',
'upper_call_notionals',
'upper_call_strikes',
'upper_knockout_levels',
'upper_put_barrier_levels',
'upper_put_barrier_type',
'upper_put_notionals',
'upper_put_strikes'
]
params += super(EqTarn, self).json_params()
return params
[docs]
class EqVolatilityKnockoutOption(EqVolatilitySwapBase):
class ClaimType(IntEnum):
Call = 0
Put = 1
[docs]
def __init__(self,
identifier=None,
underlyer=None,
currency=None,
calendar_name=None,
option_claim_type=None,
floor_level=None,
cap_level=None,
strike=None,
annualisation_factor=None,
expiration_date=None,
include_dividend_jumps=None,
initial_date=None,
settlement_delay=None,
tenor=None,
vol_barrier=None,
vol_strike=None,
rebate=None,
return_lag=1,
knockin_level=-1,
knockin_barrier_type=EqVolatilitySwapBase.BarrierType.NULL,
**kwargs):
"""
:param identifier: The security identifier
:param underlyer: The underlyer
:param currency: The currency
:param calendar: The calendar
:param option_claim_type: The claim type
:param floor_level: The floor level
:param cap_level: The cap level
:param strike: The strike
:param annualisation_factor: The annualisation factor
:param expiration_date: The expiration date
:param include_dividend_jumps: The include dividend jumps
:param initial_fixing_date: The initial fixing date
:param settlement_delay: The settlement delay
:param tenor: The tenor
:param vol_barrier: The barrier
:param rebate: The rebate
:param knockin_level: The knockin_level
:param knockin_barrier_type: The knockin_barrier_type
"""
self.option_claim_type = option_claim_type
self.floor_level = floor_level
self.cap_level = cap_level
self.strike = strike
self.vol_barrier = vol_barrier
self.rebate = rebate
self.knockin_level = knockin_level
self.knockin_barrier_type = knockin_barrier_type
super(EqVolatilityKnockoutOption, self).__init__(
annualisation_factor=annualisation_factor,
calendar_name=calendar_name,
currency=currency,
expiration_date=expiration_date,
identifier=identifier,
include_dividend_jumps=include_dividend_jumps,
initial_date=initial_date,
return_lag=return_lag,
settlement_delay=settlement_delay,
tenor=tenor,
underlyer=underlyer,
vol_strike=vol_strike)
def json_params(self):
params = [
'option_claim_type',
'floor_level',
'cap_level',
'strike',
'vol_barrier',
'rebate',
'knockin_level',
'knockin_barrier_type'
]
params += super(EqVolatilityKnockoutOption, self).json_params()
return params
[docs]
class EqVolIndexOption(FullySpecified):
class ClaimType(IntEnum):
Call = 0
Put = 1
Forward = 2
DigitalCall = 3
DigitalPut = 4
class SettlementType(IntEnum):
Physical = 0
Cash = 1
[docs]
def __init__(self,
identifier=None,
eq_vol_index_identifier=None,
underlyer=None,
currency=None,
calendar=None,
expiration_date=None,
option_claim_type=None,
strike=None,
option_settlement_type=None,
premium_paid_up_front=None,
**kwargs):
"""
:param identifier: The security identifier
:param eq_vol_index_identifier: The underlyer
:param underlyer: The underlyer
:param currency: The currency
:param calendar: The calendar
:param expiration_date: The expiration date
:param option_claim_type: The option claim type
:param strike: The strike
:param option_settlement_type: The option settlement type
:param premium_paid_up_front: The premium paid up front flag
"""
if (underlyer == None):
self.underlyer = eq_vol_index_identifier
else:
self.underlyer = underlyer
self.calendar = calendar
self.option_claim_type = option_claim_type
self.strike = strike
self.option_settlement_type = option_settlement_type
self.premium_paid_up_front = premium_paid_up_front
super(EqVolIndexOption, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'underlyer',
'calendar',
'option_claim_type',
'strike',
'option_settlement_type',
'premium_paid_up_front',
]
params += super(EqVolIndexOption, self).json_params()
return params
[docs]
class FxAccumulator(FullySpecified):
class BarrierType(IntEnum):
KnockOut = 2
KnockIn = 1
Null = 0
[docs]
def __init__(self,
identifier=None,
fx_pair=None,
currency=None,
expiration_date=None,
is_accumulator=None,
cutoff=None,
business_day_convention=None,
calendar_id=None,
schedule_start_date=None,
schedule_end_date=None,
schedule_roll_date=None,
fixing_dates=None,
period_str=None,
start_stub=None,
end_stub=None,
end_to_end=None,
strikes=None,
leveraging_factors=None,
settlement_lag=None,
settlement_type=None,
barrier_start_date=None,
knockout_barrier_levels=None,
call_barrier_levels=None,
put_barrier_levels=None,
call_barrier_type=None,
put_barrier_type=None,
notionals=None,
notional_currency=None,
**kwargs):
"""
:param identifier: The security identifier
:param fx_pair: The fx pair
:param is_accumulator: The is accumulator flag
:param cutoff: The curoff
:param business_day_convention: The business day convention
:param calendar_id: The calendar id
:param schedule_start_date: The schedule start date
:param schedule_end_date: The schedule end date
:param schedule_foll_date: The schedule foll date
:param fixing_dates: The fixing dates
:param period_str: The period str
:param start_stub: The start stub
:param end_stub: The end stub
:param end_to_end: The end to end
:param strikes: The strikes
:param leveraging_factors: The leveraging factors
:param settlement_lag: The settlement lag
:param settlement_type: The settlement type
:param barrier_start_date: The barrier start date
:param knockout_barrier_levels: The knockout barrier levels
:param call_barrier_levels: The call barrier levels
:param put_barrier_levels: The put barrier levels
:param call_barrier_type: The call barrier type
:param put_barrier_type: The put barrier type
:param notionals: The notionals
:param notional_currency: The notional currency
"""
self.fx_pair = fx_pair
self.is_accumulator = is_accumulator
self.cutoff = cutoff
self.business_day_convention = business_day_convention
self.calendar_id = calendar_id
self.schedule_start_date = schedule_start_date
self.schedule_end_date = schedule_end_date
self.schedule_roll_date = schedule_roll_date
self.fixing_dates = fixing_dates
self.period_str = period_str
self.start_stub = start_stub
self.end_stub = end_stub
self.end_to_end = end_to_end
self.strikes = strikes
self.leveraging_factors = leveraging_factors
self.settlement_lag = settlement_lag
self.settlement_type = settlement_type
self.barrier_start_date = barrier_start_date
self.knockout_barrier_levels = knockout_barrier_levels
self.call_barrier_levels = call_barrier_levels
self.put_barrier_levels = put_barrier_levels
self.call_barrier_type = call_barrier_type
self.put_barrier_type = put_barrier_type
self.notionals = notionals
self.notional_currency = notional_currency
super(FxAccumulator, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'fx_pair',
'is_accumulator',
'cutoff',
'business_day_convention',
'calendar_id',
'schedule_start_date',
'schedule_end_date',
'schedule_roll_date',
'fixing_dates',
'period_str',
'start_stub',
'end_stub',
'end_to_end',
'strikes',
'leveraging_factors',
'settlement_lag',
'settlement_type',
'barrier_start_date',
'knockout_barrier_levels',
'call_barrier_levels',
'put_barrier_levels',
'call_barrier_type',
'put_barrier_type',
'notionals',
'notional_currency'
]
params += super(FxAccumulator, self).json_params()
return params
[docs]
class FxBarrierMA(FullySpecified):
class ClaimTypeFx(IntEnum):
DigitalCall = 0
DigitalPut = 1
class KnockTypeFx(IntEnum):
KnockOut = 0
KnockIn = 1
class VolKnockTypeFx(IntEnum):
VolKnockOut = 0
VolKnockIn = 1
[docs]
def __init__(self,
identifier=None,
fx_pairs=None,
basket_name=None,
currency=None,
start_date=None,
expiration_date=None,
barrier_start_date=None,
barrier_end_date=None,
settlement_date=None,
upper_barrier_levels=None,
lower_barrier_levels=None,
vol_barrier_levels=None,
cutoff=None,
option_knock_type=None,
option_vol_knock_type=None,
strikes=None,
claim_types=None,
calendar_name=None,
is_worst_knock=None,
period_str=None,
annualisation_factor=None,
include_mean_adjustment=None,
**kwargs):
"""
:param identifier: The security identifier
:param fx_pairs: The fx pairs
:param basket_name: The basket name
:param currency: The currency
:param start_date: The start date
:param expiration_date: The expiration date
:param barrier_start_date: The barrier start date
:param barrier_end_date: The barrier end date
:param settlement_date: The settlement date
:param upper_barrier_levels: The upper barriers
:param lower_barrier_levels: The lower barriers
:param vol_barrier_levels: The vol barriers
:param cutoff: The cutoff
:param option_knock_type: The option knock type
:param option_vol_knock_type: The option vol knock type
:param strikes: The strikes
:param claim_types: The claim types
:param calendar_name: The calendar name
:param is_worst_knock: The is worst knock flag
:param period_str: The period str
:param annualisation_factor: The annualisation factor
:param include_mean_adjustment: The include mean adjustment
"""
self.fx_pairs = fx_pairs
self.basket_name = basket_name
self.start_date = start_date
self.barrier_start_date = barrier_start_date
self.barrier_end_date = barrier_end_date
self.settlement_date = settlement_date
self.upper_barrier_levels = upper_barrier_levels
self.lower_barrier_levels = lower_barrier_levels
self.vol_barrier_levels = vol_barrier_levels
self.cutoff = cutoff
self.option_knock_type = option_knock_type
self.option_vol_knock_type = option_vol_knock_type
self.strikes = strikes
self.claim_types = claim_types
self.calendar_name = calendar_name
self.is_worst_knock = is_worst_knock
self.period_str = period_str
self.annualisation_factor = annualisation_factor
self.include_mean_adjustment = include_mean_adjustment
super(FxBarrierMA, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'fx_pairs',
'basket_name',
'start_date',
'barrier_start_date',
'barrier_end_date',
'settlement_date',
'upper_barrier_levels',
'lower_barrier_levels',
'vol_barrier_levels',
'cutoff',
'option_knock_type',
'option_vol_knock_type',
'strikes',
'claim_types',
'calendar_name',
'is_worst_knock',
'period_str',
'annualisation_factor',
'include_mean_adjustment',
]
params += super(FxBarrierMA, self).json_params()
return params
def to_dict(self):
param_dict = super(FxBarrierMA, self).to_dict()
if 'claim_types' in param_dict.keys():
claim_types = param_dict['claim_types']
if isinstance(claim_types, dict):
claim_type_list = []
for k, v in claim_types.items():
claim_type_list.append({'key': k, 'value': v})
param_dict.update({'claim_types': claim_type_list})
if 'strikes' in param_dict.keys():
strikes = param_dict['strikes']
if isinstance(strikes, dict):
strikes_list = []
for k, v in strikes.items():
strikes_list.append({'key': k, 'value': v})
param_dict.update({'strikes': strikes_list})
if 'upper_barrier_levels' in param_dict.keys():
upper_barrier_levels = param_dict['upper_barrier_levels']
if isinstance(upper_barrier_levels, dict):
upper_barrier_level_list = []
for k, v in upper_barrier_levels.items():
upper_barrier_level_list.append({'key': k, 'value': v})
param_dict.update({'upper_barrier_levels': upper_barrier_level_list})
if 'lower_barrier_levels' in param_dict.keys():
lower_barrier_levels = param_dict['lower_barrier_levels']
if isinstance(lower_barrier_levels, dict):
lower_barrier_level_list = []
for k, v in lower_barrier_levels.items():
lower_barrier_level_list.append({'key': k, 'value': v})
param_dict.update({'lower_barrier_levels': lower_barrier_level_list})
if 'vol_barrier_levels' in param_dict.keys():
vol_barrier_levels = param_dict['vol_barrier_levels']
if isinstance(vol_barrier_levels, dict):
vol_barrier_level_list = []
for k, v in vol_barrier_levels.items():
vol_barrier_level_list.append({'key': k, 'value': v})
param_dict.update({'vol_barrier_levels': vol_barrier_level_list})
return param_dict
[docs]
class FxBasketFuture(FullySpecified):
[docs]
def __init__(self,
identifier=None,
fx_pairs=None,
quantities=None,
averaging_type=None,
basket_name=None,
currency=None,
divisor=None,
expiration_date=None,
settlement_type=None,
**kwargs):
"""
:param identifier: The security identifier
:param fx_pairs: The fx pairs
:param quantities: The quantities
:param averaging_type: The averaging type
:param basket_name: The basket name
:param currency: The currency
:param divisor: The divisor
:param expiration_date: The expiration date
:param settlement_type: The settlement type
"""
self.fx_pairs = fx_pairs
self.quantities = quantities
self.averaging_type = averaging_type
self.basket_name = basket_name
self.divisor = divisor
self.settlement_type = settlement_type
super(FxBasketFuture, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'fx_pairs',
'quantities',
'averaging_type',
'basket_name',
'divisor',
'settlement_type',
]
params += super(FxBasketFuture, self).json_params()
return params
[docs]
class FxBasketOption(FullySpecified):
class ClaimType(IntEnum):
Put = 0
Call = 1
[docs]
def __init__(self,
identifier=None,
fx_basket_future=None,
fx_pairs=None,
quantities=None,
averaging_type=None,
claim_type=None,
strike=None,
basket_name=None,
currency=None,
divisor=None,
expiration_date=None,
settlement_date=None,
**kwargs):
"""
:param identifier: The security identifier
:param fx_basket_future: The fx basket future underlyer
:param fx_pairs: The fx pairs
:param quantities: The quantities
:param averaging_type: The averaging type
:param claim_type: The claim type
:param strike: The strike
:param basket_name: The basket name
:param currency: The currency
:param divisor: The divisor
:param expiration_date: The expiration date
:param settlement_date: The settlement date
"""
self.fx_basket_future = fx_basket_future
self.fx_pairs = fx_pairs
self.quantities = quantities
self.averaging_type = averaging_type
self.claim_type = claim_type
self.strike = strike
self.basket_name = basket_name
self.divisor = divisor
self.settlement_date = settlement_date
super(FxBasketOption, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'fx_basket_future',
'fx_pairs',
'quantities',
'averaging_type',
'claim_type',
'strike',
'basket_name',
'divisor',
'settlement_date',
]
params += super(FxBasketOption, self).json_params()
return params
[docs]
class FxCorrelationSwap(FullySpecified):
[docs]
def __init__(self,
identifier=None,
fx_pairs=None,
strike=None,
basket_name=None,
start_date=None,
expiration_date=None,
period=None,
business_day_convention=None,
settlement_lag=None,
currency=None,
**kwargs):
"""
:param identifier: The security identifier
:param fx_pairs: The fx pairs
:param strike: The strike
:param basket_name: The basket name
:param start_date: The start date
:param expiration_date: The expiration date
:param period: The period
:param business_day_convention: The business day convention
:param settlement_lag: The settlement lag
:param currency: The currency
"""
self.fx_pairs = fx_pairs
self.strike = strike
self.basket_name = basket_name
self.start_date = start_date
self.period = period
self.business_day_convention = business_day_convention
self.settlement_lag = settlement_lag
super(FxCorrelationSwap, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'fx_pairs',
'strike',
'basket_name',
'start_date',
'period',
'business_day_convention',
'settlement_lag',
]
params += super(FxCorrelationSwap, self).json_params()
return params
[docs]
class FxFVA(FullySpecified):
class StrikeType(IntEnum):
Fixed = 0
Floating = 1
DeltaNeutral = 2
[docs]
def __init__(self,
identifier=None,
fx_pair=None,
currency=None,
expiration_date=None,
premium_determination_date=None,
benchmark_volatility=None,
cutoff=None,
claim_type=None,
strike_type=None,
strike=None,
premium_payment_date=None,
settlement_date=None,
premium_currency=None,
settlement_type=None,
**kwargs):
"""
:param identifier: The security identifier
:param fx_pair: The fx pair
:param currency: The currency
:param expiration_date: The expiration date
:param premium_determination_date: The premium determination date
:param benchmark_volatility: The benchmark volatility
:param cutoff: The cutoff
:param claim_type: The claim type
:param strike_type: The strike type
:param strike: The strike
:param premium_payment_date: The premium payment date
:param settlement_date: The settlement date
:param premium_currency: The premium currency
:param settlement_type: The settlement type
"""
self.fx_pair = fx_pair
self.premium_determination_date = premium_determination_date
self.benchmark_volatility = benchmark_volatility
self.cutoff = cutoff
self.claim_type = claim_type
self.strike_type = strike_type
self.strike = strike
self.premium_payment_date = premium_payment_date
self.settlement_date = settlement_date
self.premium_currency = premium_currency
self.settlement_type = settlement_type
super(FxFVA, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'fx_pair',
'premium_determination_date',
'benchmark_volatility',
'cutoff',
'claim_type',
'strike_type',
'strike',
'premium_payment_date',
'settlement_date',
'premium_currency',
'settlement_type',
]
params += super(FxFVA, self).json_params()
return params
[docs]
class FxVarianceSwapBase(FullySpecified):
[docs]
def __init__(self,
identifier=None,
annualisation_factor=None,
fx_pair=None,
currency=None,
calendar_name=None,
expiration_date=None,
initial_date=None,
settlement_date=None,
tenor=None,
vol_strike=None,
premium_currency=None,
**kwargs):
"""
:param identifier: The security identifier
:param annualisation_factor: The annualisation factor
:param fx_pair: The fx pair
:param currency: The currency
:param calendar_name: The calendar name
:param expiration_date: The expiration date
:param initial_fixing_date: The initial fixing date
:param settlement_date: The settlement date
:param tenor: The tenor
:param vol_strike: The vol_strike
:param premium_currency: The premium currency
"""
self.annualisation_factor = annualisation_factor
self.fx_pair = fx_pair
self.calendar_name = calendar_name
self.initial_date = initial_date
self.settlement_date = settlement_date
self.tenor = tenor
self.vol_strike = vol_strike
self.premium_currency = premium_currency
super(FxVarianceSwapBase, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'annualisation_factor',
'fx_pair',
'calendar_name',
'initial_date',
'settlement_date',
'tenor',
'vol_strike',
'premium_currency',
]
params += super(FxVarianceSwapBase, self).json_params()
return params
[docs]
class FxVarianceSwap(FxVarianceSwapBase):
[docs]
def __init__(self,
identifier=None,
annualisation_factor=None,
fx_pair=None,
currency=None,
calendar_name=None,
expiration_date=None,
initial_date=None,
settlement_date=None,
tenor=None,
vol_strike=None,
premium_currency=None,
cap_level=None,
**kwargs):
"""
:param identifier: The security identifier
:param annualisation_factor: The annualisation factor
:param fx_pair: The fx pair
:param currency: The currency
:param calendar_name: The calendar name
:param expiration_date: The expiration date
:param initial_fixing_date: The initial fixing date
:param settlement_date: The settlement date
:param tenor: The tenor
:param vol_strike: The vol_strike
:param premium_currency: The premium currency
"""
self.cap_level = cap_level
super(FxVarianceSwap, self).__init__(
identifier=identifier,
annualisation_factor=annualisation_factor,
fx_pair=fx_pair,
currency=currency,
calendar_name=calendar_name,
expiration_date=expiration_date,
initial_date=initial_date,
settlement_date=settlement_date,
tenor=tenor,
vol_strike=vol_strike,
premium_currency=premium_currency)
def json_params(self):
params = [
'cap_level'
]
params += super(FxVarianceSwap, self).json_params()
return params
[docs]
class FxVolatilitySwap(FxVarianceSwapBase):
[docs]
def __init__(self,
identifier=None,
annualisation_factor=None,
fx_pair=None,
currency=None,
calendar_name=None,
expiration_date=None,
initial_date=None,
settlement_date=None,
tenor=None,
vol_strike=None,
premium_currency=None,
cap_level=None,
**kwargs):
"""
:param identifier: The security identifier
:param annualisation_factor: The annualisation factor
:param fx_pair: The fx pair
:param currency: The currency
:param calendar_name: The calendar name
:param expiration_date: The expiration date
:param initial_fixing_date: The initial fixing date
:param settlement_date: The settlement date
:param tenor: The tenor
:param vol_strike: The vol_strike
:param premium_currency: The premium currency
"""
self.cap_level = cap_level
super(FxVolatilitySwap, self).__init__(
identifier=identifier,
annualisation_factor=annualisation_factor,
fx_pair=fx_pair,
currency=currency,
calendar_name=calendar_name,
expiration_date=expiration_date,
initial_date=initial_date,
settlement_date=settlement_date,
tenor=tenor,
vol_strike=vol_strike,
premium_currency=premium_currency)
def json_params(self):
params = [
'cap_level'
]
params += super(FxVolatilitySwap, self).json_params()
return params
[docs]
class IROption(FullySpecified):
class ClaimType(IntEnum):
Put = 0
Call = 1
[docs]
def __init__(self,
identifier=None,
ir_future=None,
currency=None,
expiration_date=None,
option_claim_type=None,
strike=None,
premium_paid_up_front=None,
**kwargs):
"""
:param identifier: The security identifier
:param ir_future: The underlyer
:param currency: The currency
:param expiration_date: The expiration date
:param option_claim_type: The claim type
:param strike: The strike
:param premium_paid_up_front: The premium paid up front flag
"""
self.ir_future = ir_future
self.option_claim_type = option_claim_type
self.strike = strike
self.premium_paid_up_front = premium_paid_up_front
super(IROption, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'ir_future',
'option_claim_type',
'strike',
'premium_paid_up_front',
]
params += super(IROption, self).json_params()
return params
[docs]
class EqBasketOption(FullySpecified):
class ClaimType(IntEnum):
Call = 0
Put = 1
DigitalCall = 2
DigitalPut = 3
class AveragingType(IntEnum):
Arithmetic = 0
Geometric = 1
[docs]
def __init__(self,
identifier=None,
equity_identifiers=None,
basket_name=None,
currency=None,
quantities=None,
divisor=None,
strike=None,
basket_averaging_type=None,
option_claim_type=None,
expiration_date=None,
calendar=None,
settlement_lag=None,
weights=None,
initial_fixings=None,
initial_fx_rates=None,
is_quanto=None,
is_compo=None,
is_dispersion=None,
premium_paid_upfront=None,
traded_price=None,
**kwargs):
"""
:param identifier: The security identifier
:param equity_identifiers: The equity assets
:param basket_name: The basket name
:param currency: The currency
:param quantities: The quantities
:param divisor: The divisor
:param strike: The strike
:param basket_averaging_type: The basket averaging type
:param option_claim_type: The option claim type
:param expiration_date: The expiration date
:param calendar: The calendar
:param settlement_lag: The settlement lag
:param weights: The weights
:param initial_fixings: The initial fixings
:param initial_fx_rates: The initial fx rates
:param is_quanto: The Is Quanto flag
:param is_compo: The Is Compo flag
:param is_dispersion: The Is Dispersion flag
:param premium_paid_upfront: The premium paid up front flag
:param traded_price: The traded price
"""
self.equity_identifiers = equity_identifiers
self.basket_name = basket_name
self.quantities = quantities
self.divisor = divisor
self.strike = strike
self.basket_averaging_type = basket_averaging_type
self.option_claim_type = option_claim_type
self.calendar = calendar
self.settlement_lag = settlement_lag
self.weights = weights
self.initial_fixings = initial_fixings
self.initial_fx_rates = initial_fx_rates
self.is_quanto = is_quanto
self.is_compo = is_compo
self.is_dispersion = is_dispersion
self.premium_paid_upfront = premium_paid_upfront
self.traded_price = traded_price
super(EqBasketOption, self).__init__(
currency=currency,
expiration_date=expiration_date,
identifier=identifier)
def json_params(self):
params = [
'equity_identifiers',
'basket_name',
'quantities',
'divisor',
'strike',
'basket_averaging_type',
'option_claim_type',
'calendar',
'settlement_lag',
'weights',
'initial_fixings',
'initial_fx_rates',
'is_quanto',
'is_compo',
'is_dispersion',
'premium_paid_upfront',
'traded_price',
]
params += super(EqBasketOption, self).json_params()
return params
[docs]
class PricingModelManager(TradablesType):
[docs]
def __init__(self,
convertible_bond_model_params=None,
eq_variance_swap_model_params=None,
eq_autocallable_worst_of_option_model_params=None,
eq_basket_option_model_params=None):
"""
:param convertible_bond_model_params: The convertible_bond_model_params
:param eq_variance_swap_model_params: The eq_variance_swap_model_params
:param eq_autocallable_worst_of_option_model_params: The eq_autocallable_worst_of_option_model_params
:param eq_basket_option_model_params: The eq_basket_option_model_params
"""
self.convertible_bond_model_params = convertible_bond_model_params
self.eq_variance_swap_model_params = eq_variance_swap_model_params
self.eq_autocallable_worst_of_option_model_params = eq_autocallable_worst_of_option_model_params
self.eq_basket_option_model_params = eq_basket_option_model_params
def json_params(self):
params = [
'convertible_bond_model_params',
'eq_variance_swap_model_params',
'eq_autocallable_worst_of_option_model_params',
'eq_basket_option_model_params'
]
return params
[docs]
class ConvertibleBondModelParams(TradablesType):
[docs]
def __init__(self,
time_step_size=5,
log_spot_step_size=0.25,
loss_given_default=0.0,
min_log_spot=-5,
max_log_spot=5,
min_number_time_steps=30,
min_number_of_spot_points=800,
grid_factor=1,
use_andersen_buffum_model=False,
parity_calculation_ignore_inactive_conversion=False,
recovery_is_fraction_of_price=True,
use_effective_soft_call_trigger=False):
"""
:param time_step_size: The stime_step_size
:param log_spot_step_size: The log_spot_step_size
:param loss_given_default: The loss_given_default
:param min_log_spot: The min_log_spot
:param max_log_spot: The max_log_spot
:param min_number_time_steps: The min_number_time_steps
:param min_number_of_spot_points: The min_number_of_spot_points
:param grid_factor: The grid_factor
:param use_andersen_buffum_model: The use_andersen_buffum_model
:param parity_calculation_ignore_inactive_conversion: The parity_calculation_ignore_inactive_conversion
:param recovery_is_fraction_of_price: use false if recovery rate is a fraction of par
:param use_effective_soft_call_trigger: use true to value soft call condition using an effective trigger
"""
self.time_step_size = time_step_size
self.log_spot_step_size = log_spot_step_size
self.loss_given_default = loss_given_default
self.min_log_spot = min_log_spot
self.max_log_spot = max_log_spot
self.min_number_time_steps = min_number_time_steps
self.min_number_of_spot_points = min_number_of_spot_points
self.grid_factor = grid_factor
self.use_andersen_buffum_model = use_andersen_buffum_model
self.parity_calculation_ignore_inactive_conversion = parity_calculation_ignore_inactive_conversion
self.recovery_is_fraction_of_price = recovery_is_fraction_of_price
self.use_effective_soft_call_trigger = use_effective_soft_call_trigger
def json_params(self):
params = [
'time_step_size',
'log_spot_step_size',
'loss_given_default',
'min_log_spot',
'max_log_spot',
'min_number_time_steps',
'min_number_of_spot_points',
'grid_factor',
'use_andersen_buffum_model',
'parity_calculation_ignore_inactive_conversion',
'recovery_is_fraction_of_price',
'use_effective_soft_call_trigger'
]
return params
[docs]
class EqVarianceSwapModelParams(TradablesType):
[docs]
def __init__(self,
log_spot_step_size=0.5,
max_log_spot=10.0,
min_log_spot=-10.0):
"""
:param log_spot_step_size: The log_spot_step_size
:param min_log_spot: The min_log_spot
:param max_log_spot: The max_log_spot
"""
self.log_spot_step_size = log_spot_step_size
self.min_log_spot = min_log_spot
self.max_log_spot = max_log_spot
def json_params(self):
params = [
'log_spot_step_size',
'min_log_spot',
'max_log_spot',
]
return params
[docs]
class EqAutocallableWorstOfOptionModelParams(TradablesType):
class Method(IntEnum):
MonteCarlo = 0
FiniteDifference = 1
[docs]
def __init__(self,
pricing_method=Method.FiniteDifference,
num_simulations=10000,
num_time_points=100,
num_strike_points=100,
strike_stdev=7.0,
max_init_time_step=3,
time_step_size=5,
min_number_of_time_steps=40,
min_log_spot=-5,
max_log_spot=5,
grid_factor=10,
min_number_of_spot_points=100):
"""
:param pricing_method: The pricing method
:param num_simulations: The number of simulations for Monte Carlo method
:param num_time_points: The number of time points for Monte Carlo method
:param num_strike_points: The number of strike points for MOnte Carlo method
:param strike_stdev: The strike stdev for Monte Carlo method
:param max_init_time_step: The maximum initial time step for Monte Carlo method
:param time_step_size: The time step size for finite difference method
:param min_number_of_time_steps: The minimum number of time steps for finite difference method
:param min_log_spot: The minimum log spot for finite difference method
:param max_log_spot: The maximum log spot for finite difference method
:param grid_factor: The grid factor for finite difference method
:param min_number_of_spot_points: The minimum number of spot points for finite difference method
"""
self.pricing_method = pricing_method
self.num_simulations = num_simulations
self.num_time_points = num_time_points
self.num_strike_points = num_strike_points
self.strike_stdev = strike_stdev
self.max_init_time_step = max_init_time_step
self.time_step_size = time_step_size
self.min_number_of_time_steps = min_number_of_time_steps
self.min_log_spot = min_log_spot
self.max_log_spot = max_log_spot
self.grid_factor = grid_factor
self.min_number_of_spot_points = min_number_of_spot_points
def json_params(self):
params = [
'pricing_method',
'num_simulations',
'num_time_points',
'num_strike_points',
'strike_stdev',
'max_init_time_step',
'time_step_size',
'min_number_of_time_steps',
'min_log_spot',
'max_log_spot',
'grid_factor',
'min_number_of_spot_points'
]
return params
[docs]
class EqBasketOptionModelParams(TradablesType):
class Method(IntEnum):
BlackScholes = 0
MonteCarlo = 1
[docs]
def __init__(self,
pricing_method=Method.BlackScholes,
use_contract_traded_price=True,
num_simulations=10000,
num_time_points=100,
num_strike_points=100,
strike_stdev=7.0,
max_init_time_step=1):
"""
:param pricing_method: The pricing method
:param use_contract_traded_price: If true the traded price stamped on the contract is used, otherwise the
traded price is set to the current option premium so that the NPV is zero
:param num_simulations: The number of simulations for Monte Carlo method
:param num_time_points: The number of time points for Monte Carlo method
:param num_strike_points: The number of strike points for Monte Carlo method
:param strike_stdev: The strike stdev for Monte Carlo method
:param max_init_time_step: The maximum initial time step for Monte Carlo method
"""
self.pricing_method = pricing_method
self.use_contract_traded_price = use_contract_traded_price
self.num_simulations = num_simulations
self.num_time_points = num_time_points
self.num_strike_points = num_strike_points
self.strike_stdev = strike_stdev
self.max_init_time_step = max_init_time_step
def json_params(self):
params = [
'pricing_method',
'use_contract_traded_price',
'num_simulations',
'num_time_points',
'num_strike_points',
'strike_stdev',
'max_init_time_step'
]
return params