Source code for derivitec.market_data.types

from enum import IntEnum

from derivitec.core.dict_builder_abstract import DictBuilderAbstract


[docs] class MarketDataType(DictBuilderAbstract): _dotnet_namespace = ""
[docs] class LocalVolatilityArbitrageType(IntEnum): Butterfly = 2 Calendar = 1 Null = 0
[docs] class InstrumentIdentifierType(IntEnum): NotSet = -1 Derivitec = 0 Ric = 1 Bloomberg = 2 Isin = 3 Figi = 4 Sedol = 5
[docs] class CommodityInfo(MarketDataType):
[docs] def __init__(self, currency=None, exchange=None, id=None, is_active=None, name=None, sector=None, settlement_calendar=None, settlement_lag=None, sub_sector=None, unit=None): """ :param currency: The currency :param exchange: The exchange :param id: The id :param is_active: The is active :param name: The name :param sector: The sector :param settlement_calendar: The settlement calendar :param settlement_lag: The settlement lag :param sub_sector: The sub sector :param unit: The unit """ self.currency = currency self.exchange = exchange self.id = id self.is_active = is_active self.name = name self.sector = sector self.settlement_calendar = settlement_calendar self.settlement_lag = settlement_lag self.sub_sector = sub_sector self.unit = unit
def json_params(self): params = [ 'currency', 'exchange', 'id', 'is_active', 'name', 'sector', 'settlement_calendar', 'settlement_lag', 'sub_sector', 'unit', ] return params
[docs] class VolatilityData(MarketDataType):
[docs] def __init__(self, date=None, strike_type=None, strikes=None, vols=None): """ :param date: The date :param strike_type: The strike type :param strikes: The strikes :param vols: The vols """ self.date = date self.strike_type = strike_type self.strikes = strikes self.vols = vols
def json_params(self): params = [ 'date', 'strike_type', 'strikes', 'vols', ] return params
[docs] class LocalVolatilityDetails(MarketDataType):
[docs] def __init__(self, arbitrage_types=None, error_message=None, forwards=None, local_volatilities=None, log_spots=None, spots=None, times=None): """ :param arbitrage_types: The arbitrage types :param error_message: The error message :param forwards: The forwards :param local_volatilities: The local volatilities :param log_spots: The log spots :param spots: The spots :param times: The times """ self.arbitrage_types = arbitrage_types self.error_message = error_message self.forwards = forwards self.local_volatilities = local_volatilities self.log_spots = log_spots self.spots = spots self.times = times
def json_params(self): params = [ 'arbitrage_types', 'error_message', 'forwards', 'local_volatilities', 'log_spots', 'spots', 'times', ] return params
[docs] class EquityDescriptor(MarketDataType):
[docs] def __init__(self, dividend_end_date=None, dividend_start_date=None, spot_fixing_end_date=None, spot_fixing_start_date=None, include_index_component_data=None): """ :param dividend_end_date: The dividend end date :param dividend_start_date: The dividend start date :param spot_fixing_end_date: The spot fixing end date :param spot_fixing_start_date: The spot fixing start date """ self.dividend_end_date = dividend_end_date self.dividend_start_date = dividend_start_date self.spot_fixing_end_date = spot_fixing_end_date self.spot_fixing_start_date = spot_fixing_start_date self.include_index_component_data = include_index_component_data
def json_params(self): params = [ 'dividend_end_date', 'dividend_start_date', 'spot_fixing_end_date', 'spot_fixing_start_date', 'include_index_component_data' ] return params
[docs] class EquityVolSurfaceParameters(MarketDataType):
[docs] def __init__(self, atm_forward=None, atmf_vol=None, call_wing=None, expiry=None, maturity=None, put_wing=None, skew=None, smile=None): """ :param atm_forward: The atm forward :param atmf_vol: The atmf vol :param call_wing: The call wing :param expiry: The expiry :param maturity: The maturity :param put_wing: The put wing :param skew: The skew :param smile: The smile """ self.atm_forward = atm_forward self.atmf_vol = atmf_vol self.call_wing = call_wing self.expiry = expiry self.maturity = maturity self.put_wing = put_wing self.skew = skew self.smile = smile
def json_params(self): params = [ 'atm_forward', 'atmf_vol', 'call_wing', 'expiry', 'maturity', 'put_wing', 'skew', 'smile', ] return params
[docs] class AssetIdRicPair(MarketDataType):
[docs] def __init__(self, id=None, ric=None): """ :param id: The id :param ric: The ric """ self.id = id self.ric = ric
def json_params(self): params = [ 'id', 'ric', ] return params
[docs] class Fixings(MarketDataType):
[docs] def __init__(self, asset_id=None, dates=None, values=None): """ :param dates: The asset id :param dates: The dates :param values: The values """ self.asset_id = asset_id self.dates = dates self.values = values
def json_params(self): params = [ 'asset_id', 'dates', 'values', ] return params
[docs] class OptionVolPoint(MarketDataType):
[docs] def __init__(self, identifier=None, ask_vol=None, bid_vol=None, call_delta=None, claim_type=None, close_vol=None, delta=None, expiry=None, marked_vol=None, maturity=None, strike=None): """ :param identifier: The identifier :param ask_vol: The ask vol :param bid_vol: The bid vol :param call_delta: The call delta :param claim_type: The claim type :param close_vol: The close vol :param delta: The delta :param expiry: The expiry :param marked_vol: The marked vol :param maturity: The maturity :param strike: The strike """ self.identifier = identifier self.ask_vol = ask_vol self.bid_vol = bid_vol self.call_delta = call_delta self.claim_type = claim_type self.close_vol = close_vol self.delta = delta self.expiry = expiry self.marked_vol = marked_vol self.maturity = maturity self.strike = strike
def json_params(self): params = [ 'identifier', 'ask_vol', 'bid_vol', 'call_delta', 'claim_type', 'close_vol', 'delta', 'expiry', 'marked_vol', 'maturity', 'strike', ] return params
[docs] class MarketDataError(MarketDataType):
[docs] def __init__(self, message=None, reference_date=None): """ :param message: The message :param reference_date: The reference date """ self.message = message self.reference_date = reference_date
def json_params(self): params = [ 'message', 'reference_date', ] return params
[docs] class FxVolSurfaceParameters(MarketDataType):
[docs] def __init__(self, atm_forward=None, atmf_vol=None, call_wing=None, expiry=None, maturity=None, put_wing=None, skew=None, smile=None): """ :param atm_forward: The atm forward :param atmf_vol: The atmf vol :param call_wing: The call wing :param expiry: The expiry :param maturity: The maturity :param put_wing: The put wing :param skew: The skew :param smile: The smile """ self.atm_forward = atm_forward self.atmf_vol = atmf_vol self.call_wing = call_wing self.expiry = expiry self.maturity = maturity self.put_wing = put_wing self.skew = skew self.smile = smile
def json_params(self): params = [ 'atm_forward', 'atmf_vol', 'call_wing', 'expiry', 'maturity', 'put_wing', 'skew', 'smile', ] return params
[docs] class FxVolatilityTermStructure(MarketDataType):
[docs] def __init__(self, expiries=None, volatility_curves=None): """ :param expiries: The expiries :param volatility_curves: The volatility curves """ self.expiries = expiries self.volatility_curves = volatility_curves
def json_params(self): params = [ 'expiries', 'volatility_curves', ] return params
[docs] class CoveredStock(MarketDataType):
[docs] def __init__(self, id=None, identifier=None, ignore=None, notes=None): """ :param id: The id :param identifier: The identifier :param ignore: The ignore :param notes: The notes """ self.id = id self.identifier = identifier self.ignore = ignore self.notes = notes
def json_params(self): params = [ 'id', 'identifier', 'ignore', 'notes', ] return params
[docs] class Dividends(MarketDataType):
[docs] def __init__(self, all_in_rates=None, asset_ids=None, cash_divs=None, confirmed_flags=None, currencies=None, declared_dates=None, div_types=None, div_yields=None, ex_dates=None, pay_dates=None, record_dates=None, reference_date=None, withholding_tax_rates=None): """ :param all_in_rates: The all in rates :param cash_divs: The cash divs :param confirmed_flags: The confirmed flags :param currencies: The currencies :param declared_dates: The declared dates :param div_types: The div types :param div_yields: The div yields :param ex_dates: The ex dates :param pay_dates: The pay dates :param record_dates: The record dates :param reference_date: The reference date """ self.all_in_rates = all_in_rates self.asset_ids = asset_ids self.cash_divs = cash_divs self.confirmed_flags = confirmed_flags self.currencies = currencies self.declared_dates = declared_dates self.div_types = div_types self.div_yields = div_yields self.ex_dates = ex_dates self.pay_dates = pay_dates self.record_dates = record_dates self.reference_date = reference_date self.withholding_tax_rates = withholding_tax_rates
def json_params(self): params = [ 'all_in_rates', 'asset_ids', 'cash_divs', 'confirmed_flags', 'currencies', 'declared_dates', 'div_types', 'div_yields', 'ex_dates', 'pay_dates', 'record_dates', 'reference_date', 'withholding_tax_rates' ] return params
[docs] class CoveredCurrency(MarketDataType):
[docs] def __init__(self, currency=None): """ :param currency: The currency """ self.currency = currency
def json_params(self): params = [ 'currency', ] return params
[docs] class CoveredRateAsset(MarketDataType):
[docs] def __init__(self, currency=None, id=None, name=None, type=None): """ :param currency: The currency :param id: The id :param name: The name :param type: The type """ self.currency = currency self.id = id self.name = name self.type = type
def json_params(self): params = [ 'currency', 'id', 'name', 'type', ] return params
[docs] class DiscountCurveBump(MarketDataType):
[docs] def __init__(self, rate_bumps=None, tenors=None, maturities=None, use_proportional_rate_bumps=None, use_forward_rate_bumps=None): """ :param rate_bumps: The rate bumps :param tenors: The tenors :param maturities: The maturities :param use_proportional_rate_bumps: The use_proportional_rate_bumps flag :param use_forward_rate_bumps: The use_forward_rate_bumps flag """ self.rate_bumps = rate_bumps self.tenors = tenors self.maturities = maturities self.use_proportional_rate_bumps = use_proportional_rate_bumps self.use_forward_rate_bumps = use_forward_rate_bumps
def json_params(self): params = [ 'rate_bumps', 'tenors', 'maturities', 'use_proportional_rate_bumps', 'use_forward_rate_bumps' ] return params
[docs] class DividendBump(MarketDataType):
[docs] def __init__(self, shock_sizes=None, tenors=None, maturities=None, bump_cash_dividends=True, bump_dividend_yields=True, bump_confirmed_dividends=False, all_in_rate_bumps=None, asset_identifier=None): """ :param shock_sizes: The shock size :param tenors: The tenors :param maturities: The maturities :param bump_cash_dividends: The bump_cash_dividends flag :param bump_confirmed_dividends: The bump_confirmed_dividends flag :param all_in_rate_bumps: The all_in_rate_bumps :param asset_identifier: The asset_identifier """ self.shock_sizes = shock_sizes self.tenors = tenors self.maturities = maturities self.bump_cash_dividends = bump_cash_dividends self.bump_dividend_yields = bump_dividend_yields self.bump_confirmed_dividends = bump_confirmed_dividends self.all_in_rate_bumps = all_in_rate_bumps self.asset_identifier = asset_identifier
def json_params(self): params = [ 'shock_sizes', 'tenors', 'maturities', 'bump_cash_dividends', 'bump_dividend_yields', 'bump_confirmed_dividends', 'all_in_rate_bumps', 'asset_identifier' ] return params
[docs] class DiscountCurveOverrideBase(MarketDataType):
[docs] def __init__(self, currency, discount_factors, maturities): """ :param currency: The currency :param discount_factors: The discount factors :param maturities: The maturities """ self.currency = currency self.discount_factors = discount_factors self.maturities = maturities
def json_params(self): params = [ 'currency', 'discount_factors', 'maturities' ] return params
[docs] class DiscountCurveOverride(DiscountCurveOverrideBase):
[docs] def __init__(self, currency, curve_name, discount_factors, maturities): """ :param currency: The currency :param curve_name: The curve name :param discount_factors: The discount factors :param maturities: The maturities """ super(DiscountCurveOverride, self).__init__( currency, discount_factors, maturities) self.curve_name = curve_name
def json_params(self): params = ['curve_name'] params += super(DiscountCurveOverride, self).json_params() return params
[docs] class CurveFittingOverride(MarketDataType):
[docs] def __init__(self, currency=None, curve_name=None, instrument_set=None, instrument_quotes=None): """ :param currency: The currency :param curve_name: The curve name :param instrument_set: The instrument set :param instrument_quotes: The instrument quotes """ self.currency = currency self.curve_name = curve_name self.instrument_set = instrument_set self.instrument_quotes = instrument_quotes
def json_params(self): params = [ 'currency', 'curve_name', 'instrument_set', 'instrument_quotes' ] return params
[docs] class BondYieldCurveOverride(DiscountCurveOverrideBase):
[docs] def __init__(self, bond_issuer=None, currency=None, discount_factors=None, maturities=None, debt_type=None, bond_identifier=None, reference_curve_name=None, reference_curve_maturities=None, reference_curve_discount_factors=None): """ :param bond_issuer: The bond issuer :param currency: The currency :param discount_factors: The discount factors :param maturities: The maturities :param debt_type: The debt type :param bond_identifier: The bond identifier if this curve is to be used to price a single bond :param reference_curve_name: The reference curve name :param reference_curve_maturities: The reference curve maturities (in calendar days) :param reference_curve_discount_factors: The reference curve discount factors """ super(BondYieldCurveOverride, self).__init__( currency, discount_factors, maturities) self.bond_issuer = bond_issuer self.debt_type = debt_type self.bond_identifier = bond_identifier self.reference_curve_name = reference_curve_name self.reference_curve_maturities = reference_curve_maturities self.reference_curve_discount_factors = reference_curve_discount_factors
def json_params(self): params = ['bond_issuer', 'debt_type', 'bond_identifier', 'reference_curve_name', 'reference_curve_maturities', 'reference_curve_discount_factors'] params += super(BondYieldCurveOverride, self).json_params() return params
[docs] class BorrowCurveOverride(DiscountCurveOverrideBase):
[docs] def __init__(self, asset_identifier, discount_factors, maturities): """ :param asset_identifier: The asset identifier :param discount_factors: The discount factors :param maturities: The maturities """ super(BorrowCurveOverride, self).__init__( "", discount_factors, maturities) self.asset_identifier = asset_identifier
def json_params(self): params = ['asset_identifier'] params += super(BorrowCurveOverride, self).json_params() return params
[docs] class DividendsOverride(MarketDataType):
[docs] def __init__(self, asset_identifier=None, dividends=None, dividend_yields=None, use_forward_dividend_yields=True): """ :param asset_identifier: The asset identifier :param dividends: The dividends """ self.asset_identifier = asset_identifier self.dividends = dividends self.dividend_yields = dividend_yields self.use_forward_dividend_yields = use_forward_dividend_yields
@staticmethod def FromCashDivs(asset_identifier, currency, ex_dates, cash_divs): return DividendsOverride( asset_identifier=asset_identifier, dividends=Dividends( all_in_rates=[1.0 for _ in ex_dates], cash_divs=cash_divs, confirmed_flags=[False for _ in ex_dates], currencies=[currency for _ in ex_dates], declared_dates=ex_dates, div_types=['Regular' for _ in ex_dates], div_yields=[0.0 for _ in ex_dates], ex_dates=ex_dates, pay_dates=ex_dates, record_dates=ex_dates ), dividend_yields=None, use_forward_dividend_yields=True ) def json_params(self): params = [ 'asset_identifier', 'dividends', 'dividend_yields', 'use_forward_dividend_yields' ] return params def to_dict(self): param_dict = super(DividendsOverride, self).to_dict() if 'dividend_yields' in param_dict.keys(): dividend_yields = param_dict['dividend_yields'] if isinstance(dividend_yields, dict): dividend_yields_list = [] for k, v in dividend_yields.items(): dividend_yields_list.append({'key': k, 'value': v}) param_dict.update({'dividend_yields': dividend_yields_list}) return param_dict
[docs] class MarketDataOverride(MarketDataType):
[docs] def __init__(self, bond_prices=None, bond_yield_curve_overrides=None, discount_curve_overrides=None, discount_curve_fitting_overrides=None, equity_spot_overrides=None, equity_vol_surface_spot_model=None, fx_spot_currency=None, fx_spot_overrides_by_currency=None, equity_vol_grid_overrides=None, equity_vol_surface_overrides=None, index_curve_overrides=None, index_curve_fitting_overrides=None, cmdty_spot_overrides=None, borrow_curve_overrides=None, dividends_overrides=None, andersen_buffum_parameters_overrides=None, recovery_rate_overrides=None, equity_fx_correlation_overrides=None, equity_equity_correlation_overrides=None, equity_vol_of_var_curve_overrides=None): """ :param equity_vol_of_var_curve_overrides: Request-scoped replacement vol-of-variance curves. Curves apply when their reference date matches the calculation pricing/as-of date and take precedence over stored marks; curves for other dates are ignored. Use calendar-day maturities and finite non-negative decimal volatilities; zero disables the vol-of-variance convexity adjustment. No marks are uploaded. :type equity_vol_of_var_curve_overrides: list[:class:`derivitec.market_data.EquityVolOfVarCurve`] :param bond_prices: The bond prices :type bond_prices: list[:class:`derivitec.market_data.BondDataExternal`] :param bond_yield_curve_overrides: The bond yield curve overrides :type bond_yield_curve_overrides: list[:class:`derivitec.market_data.BondYieldCurveOverride`] :param discount_curve_overrides: The discount curve overrides :type discount_curve_overrides: list[:class:`derivitec.market_data.DiscountCurveOverride`] :param discount_curve_fitting_overrides: The discount curve fitting overrides :type discount_curve_fitting_overrides: list[:class:`derivitec.market_data.CurveFittingOverride`] :param equity_spot_overrides: The equity spot overrides :type equity_spot_overrides: dict[:class:`derivitec.misc.types.InstrumentIdentifier`, float] :param equity_vol_surface_spot_model: The equity vol surface spot model. Controls how the vol surface slides when a spot override is supplied. This is distinct from the spot_ref embedded in a vol grid override, which is used for vol surface construction only (i.e. to convert the supplied vol grid into z-space). When both a spot override and a vol grid override are present, equity_vol_surface_spot_model only makes a difference if the spot_ref embedded in the vol grid differs from the spot override. :type equity_vol_surface_spot_model: :class:`derivitec.market_data.EquityVolSurface.SpotModel` :param fx_spot_currency: The fx spot currency :type fx_spot_currency: str :param fx_spot_overrides_by_currency: The fx spot overrides by currency :type fx_spot_overrides_by_currency: dict[str, float] :param equity_vol_grid_overrides: The equity vol grid overrides :type equity_vol_grid_overrides: list[:class:`derivitec.market_data.EquityVolGrid`] :param equity_vol_surface_overrides: The equity vol surface overrides :type equity_vol_surface_overrides: list[:class:`derivitec.market_data.EquityVolSurface`] :param index_curve_overrides: The index curve overrides :type index_curve_overrides: list[:class:`derivitec.market_data.DiscountCurveOverride`] :param index_curve_fitting_overrides: The index curve fitting overrides :type index_curve_fitting_overrides: list[:class:`derivitec.market_data.CurveFittingOverride`] :param cmdty_spot_overrides: The cmdty spot overrides :type cmdty_spot_overrides: dict[str, float] :param borrow_curve_overrides: The borrow curve overrides :type borrow_curve_overrides: list[:class:`derivitec.market_data.BorrowCurveOverride`] :param dividends_overrides: The dividends overrides :type dividends_overrides: list[:class:`derivitec.market_data.DividendsOverride`] :param andersen_buffum_parameters_overrides: The Andersen Buffum parameters overrides :type andersen_buffum_parameters_overrides: list[:class:`derivitec.market_data.AndersenBuffumParameters`] :param recovery_rate_overrides: The recovery rate overrides :type recovery_rate_overrides: dict[:class:`derivitec.misc.types.InstrumentIdentifier`, float] :param equity_fx_correlation_overrides: The equity fx correlation overrides :type equity_fx_correlation_overrides: list[:class:`derivitec.market_data.EquityFxCorrelationData`] :param equity_equity_correlation_overrides: The equity equity correlation overrides :type equity_equity_correlation_overrides: list[:class:`derivitec.market_data.EquityEquityCorrelationData`] """ self.equity_vol_of_var_curve_overrides = equity_vol_of_var_curve_overrides self.bond_prices = bond_prices self.bond_yield_curve_overrides = bond_yield_curve_overrides self.discount_curve_overrides = discount_curve_overrides self.discount_curve_fitting_overrides = discount_curve_fitting_overrides self.equity_spot_overrides = equity_spot_overrides self.equity_vol_surface_spot_model = equity_vol_surface_spot_model self.fx_spot_currency = fx_spot_currency self.fx_spot_overrides_by_currency = fx_spot_overrides_by_currency self.equity_vol_grid_overrides = equity_vol_grid_overrides self.equity_vol_surface_overrides = equity_vol_surface_overrides self.index_curve_overrides = index_curve_overrides self.index_curve_fitting_overrides = index_curve_fitting_overrides self.cmdty_spot_overrides = cmdty_spot_overrides self.borrow_curve_overrides = borrow_curve_overrides self.dividends_overrides = dividends_overrides self.andersen_buffum_parameters_overrides = andersen_buffum_parameters_overrides self.recovery_rate_overrides = recovery_rate_overrides self.equity_fx_correlation_overrides = equity_fx_correlation_overrides self.equity_equity_correlation_overrides = equity_equity_correlation_overrides
def json_params(self): params = [ 'equity_vol_of_var_curve_overrides', 'bond_prices', 'bond_yield_curve_overrides', 'discount_curve_overrides', 'equity_spot_overrides', 'equity_vol_surface_spot_model', 'fx_spot_currency', 'fx_spot_overrides_by_currency', 'equity_vol_grid_overrides', 'equity_vol_surface_overrides', 'index_curve_overrides', 'cmdty_spot_overrides', 'borrow_curve_overrides', 'dividends_overrides', 'andersen_buffum_parameters_overrides', 'discount_curve_fitting_overrides', 'index_curve_fitting_overrides', 'recovery_rate_overrides', 'equity_fx_correlation_overrides', 'equity_equity_correlation_overrides' ] return params def to_dict(self): param_dict = super(MarketDataOverride, self).to_dict() if 'fx_spot_overrides_by_currency' in param_dict.keys(): fx_spot_overrides_by_currency = param_dict['fx_spot_overrides_by_currency'] if isinstance(fx_spot_overrides_by_currency, dict): fx_spot_overrides_by_currency_list = [] for k, v in fx_spot_overrides_by_currency.items(): fx_spot_overrides_by_currency_list.append({'key': k, 'value': v}) param_dict.update({'fx_spot_overrides_by_currency': fx_spot_overrides_by_currency_list}) if 'cmdty_spot_overrides' in param_dict.keys(): cmdty_spot_overrides = param_dict['cmdty_spot_overrides'] if isinstance(cmdty_spot_overrides, dict): cmdty_spot_overrides_list = [] for k, v in cmdty_spot_overrides.items(): cmdty_spot_overrides_list.append({'key': k, 'value': v}) param_dict.update({'cmdty_spot_overrides': cmdty_spot_overrides_list}) return param_dict
[docs] class YieldCurvePoint(MarketDataType):
[docs] def __init__(self, expiry=None, maturity=None, rate=None): """ :param expiry: The expiry :param maturity: The maturity :param rate: The rate """ self.expiry = expiry self.maturity = maturity self.rate = rate
def json_params(self): params = [ 'expiry', 'maturity', 'rate', ] return params
[docs] class DiscountCurveDescriptor(MarketDataType):
[docs] def __init__(self, currency=None, curve_name=None): """ :param currency: The currency :param curve_name: The curve name """ self.currency = currency self.curve_name = curve_name
def json_params(self): params = [ 'currency', 'curve_name', ] return params
[docs] class FxCrossDescriptor(MarketDataType):
[docs] def __init__(self, fixing_end_date=None, fixing_start_date=None, high_low_fixing_end_date=None, high_low_fixing_start_date=None): """ :param fixing_end_date: The fixing end date :param fixing_start_date: The fixing start date :param high_low_fixing_end_date: The high low fixing end date :param high_low_fixing_start_date: The high low fixing start date """ self.fixing_end_date = fixing_end_date self.fixing_start_date = fixing_start_date self.high_low_fixing_end_date = high_low_fixing_end_date self.high_low_fixing_start_date = high_low_fixing_start_date
def json_params(self): params = [ 'fixing_end_date', 'fixing_start_date', 'high_low_fixing_end_date', 'high_low_fixing_start_date', ] return params
[docs] class DividendPoint(MarketDataType):
[docs] def __init__(self, all_in_rate=None, announcement_date=None, cash_dividend=None, confirmed=None, dividend_yield=None, ex_date=None, pay_date=None, record_date=None): """ :param all_in_rate: The all in rate :param announcement_date: The announcement date :param cash_dividend: The cash dividend :param confirmed: The confirmed :param dividend_yield: The dividend yield :param ex_date: The ex date :param pay_date: The pay date :param record_date: The record date """ self.all_in_rate = all_in_rate self.announcement_date = announcement_date self.cash_dividend = cash_dividend self.confirmed = confirmed self.dividend_yield = dividend_yield self.ex_date = ex_date self.pay_date = pay_date self.record_date = record_date
def json_params(self): params = [ 'all_in_rate', 'announcement_date', 'cash_dividend', 'confirmed', 'dividend_yield', 'ex_date', 'pay_date', 'record_date', ] return params
[docs] class FxForwardPoint(MarketDataType):
[docs] def __init__(self, date=None, domestic_discount_factor=None, foreign_discount_factor=None, forward=None): """ :param date: The date :param domestic_discount_factor: The domestic discount factor :param foreign_discount_factor: The foreign discount factor :param forward: The forward """ self.date = date self.domestic_discount_factor = domestic_discount_factor self.foreign_discount_factor = foreign_discount_factor self.forward = forward
def json_params(self): params = [ 'date', 'domestic_discount_factor', 'foreign_discount_factor', 'forward', ] return params
[docs] class RateAssetError(MarketDataType):
[docs] def __init__(self, message=None, rate_asset_id=None, reference_date=None): """ :param message: The message :param rate_asset_id: The rate asset id :param reference_date: The reference date """ self.message = message self.rate_asset_id = rate_asset_id self.reference_date = reference_date
def json_params(self): params = [ 'message', 'rate_asset_id', 'reference_date', ] return params
[docs] class MktDataContainer(MarketDataType):
[docs] def __init__(self, bond_yield_curve_map=None, calendar_map=None, cmdty_vol_surface_map=None, commodity_map=None, correlation_eq_fx_map=None, correlation_eq_eq_map=None, correlation_fx_fx_map=None, credit_index_correlation_map=None, discount_curve_map=None, equity_asset_map=None, equity_vol_index_map=None, equity_vol_surface_map=None, equity_vol_index_vol_surface_map=None, fx_cross_map=None, fx_vol_surface_map=None, pricing_date=None, rate_asset_map=None, recovery_rate_map=None, survival_curve_map=None, swaption_vol_cube_map=None, equity_vol_of_var_curve_map=None, **kwargs): """ :param equity_vol_of_var_curve_map: EquityVolOfVarCurve list required by the requested contracts. :param bond_yield_curve_map: The bond yield curve map :param calendar_map: The calendar map :param cmdty_vol_surface_map: The cmdty vol surface map :param commodity_map: The commodity map :param correlation_eq_fx_map: The correlation eq fx map :param correlation_eq_eq_map: The correlation eq eq map :param correlation_fx_fx_map: The correlation fx fx map :param credit_index_correlation_map: The credit index correlation map :param discount_curve_map: The discount curve map :param equity_asset_map: The equity asset map :param equity_vol_index_map: The equity vol index map :param equity_vol_surface_map: The equity vol surface map :param equity_vol_index_vol_surface_map: The equity vol surface map :param fx_cross_map: The fx cross map :param fx_vol_surface_map: The fx vol surface map :param pricing_date: The pricing date :param rate_asset_map: The rate asset map :param recovery_rate_map: The recovery rate map :param survival_curve_map: The survival curve map :param swaption_vol_cube_map: The swaption vol cube map """ self.equity_vol_of_var_curve_map = equity_vol_of_var_curve_map self.bond_yield_curve_map = bond_yield_curve_map self.calendar_map = calendar_map self.cmdty_vol_surface_map = cmdty_vol_surface_map self.commodity_map = commodity_map self.correlation_eq_fx_map = correlation_eq_fx_map self.correlation_eq_eq_map = correlation_eq_eq_map self.correlation_fx_fx_map = correlation_fx_fx_map self.credit_index_correlation_map = credit_index_correlation_map self.discount_curve_map = discount_curve_map self.equity_asset_map = equity_asset_map self.equity_vol_index_map = equity_vol_index_map self.equity_vol_surface_map = equity_vol_surface_map self.equity_vol_index_vol_surface_map = equity_vol_index_vol_surface_map self.fx_cross_map = fx_cross_map self.fx_vol_surface_map = fx_vol_surface_map self.pricing_date = pricing_date self.rate_asset_map = rate_asset_map self.recovery_rate_map = recovery_rate_map self.survival_curve_map = survival_curve_map self.swaption_vol_cube_map = swaption_vol_cube_map
def json_params(self): params = [ 'equity_vol_of_var_curve_map', 'bond_yield_curve_map', 'calendar_map', 'cmdty_vol_surface_map', 'commodity_map', 'correlation_eq_fx_map', 'correlation_eq_eq_map', 'correlation_fx_fx_map', 'credit_index_correlation_map', 'discount_curve_map', 'equity_asset_map', 'equity_vol_index_map', 'equity_vol_surface_map', 'equity_vol_index_vol_surface_map', 'fx_cross_map', 'fx_vol_surface_map', 'pricing_date', 'rate_asset_map', 'recovery_rate_map', 'survival_curve_map', 'swaption_vol_cube_map', ] return params def to_dict(self): param_dict = super(MktDataContainer, self).to_dict() if 'correlation_eq_fx_map' in param_dict.keys(): correlation_eq_fx_map = param_dict['correlation_eq_fx_map'] if isinstance(correlation_eq_fx_map, dict): correlation_eq_fx_map_list = [] for k, v in correlation_eq_fx_map.items(): correlation_eq_fx_map_list.append({'key': k, 'value': v}) param_dict.update({'correlation_eq_fx_map': correlation_eq_fx_map_list}) if 'correlation_eq_eq_map' in param_dict.keys(): correlation_eq_eq_map = param_dict['correlation_eq_eq_map'] if isinstance(correlation_eq_eq_map, dict): correlation_eq_eq_map_list = [] for k, v in correlation_eq_eq_map.items(): correlation_eq_eq_map_list.append({'key': k, 'value': v}) param_dict.update({'correlation_eq_eq_map': correlation_eq_eq_map_list}) if 'correlation_fx_fx_map' in param_dict.keys(): correlation_fx_fx_map = param_dict['correlation_fx_fx_map'] if isinstance(correlation_fx_fx_map, dict): correlation_fx_fx_map_list = [] for k, v in correlation_fx_fx_map.items(): correlation_fx_fx_map_list.append({'key': k, 'value': v}) param_dict.update({'correlation_fx_fx_map': correlation_fx_fx_map_list}) if 'recovery_rate_map' in param_dict.keys(): recovery_rate_map = param_dict['recovery_rate_map'] if isinstance(recovery_rate_map, dict): recovery_rate_map_list = [] for k, v in recovery_rate_map.items(): recovery_rate_map_list.append({'key': k, 'value': v}) param_dict.update({'recovery_rate_map': recovery_rate_map_list}) if 'credit_index_correlation_map' in param_dict.keys(): credit_index_correlation_map = param_dict['credit_index_correlation_map'] if isinstance(credit_index_correlation_map, dict): credit_index_correlation_map_list = [] for k, v in credit_index_correlation_map.items(): credit_index_correlation_map_list.append({'key': k, 'value': v}) param_dict.update({'credit_index_correlation_map': credit_index_correlation_map_list}) return param_dict
[docs] class MktDataContainerExternal(MktDataContainer): # backwards compatibility pass
[docs] class EquityForwardPoint(MarketDataType):
[docs] def __init__(self, all_in_rate=None, borrow_factor=None, date=None, discount_factor=None, gross_dividend=None, net_dividend=None, forward=None, is_ex_date=None, fx_rate=None, borrow_rate=None, discount_rate=None): """ :param all_in_rate: The all in rate :param borrow_factor: The borrow factor :param date: The date :param discount_factor: The discount factor :param gross_dividend: The gross dividend :param net_dividend: The net dividend :param forward: The forward :param is_ex_date: The is ex date :param fx_rate: The fx rate :param borrow_rate: The borrow rate :param discount_rate: The discount rate """ self.all_in_rate = all_in_rate self.borrow_factor = borrow_factor self.date = date self.discount_factor = discount_factor self.gross_dividend = gross_dividend self.net_dividend = net_dividend self.forward = forward self.is_ex_date = is_ex_date self.fx_rate = fx_rate self.borrow_rate = borrow_rate self.discount_rate = discount_rate
def json_params(self): params = [ 'all_in_rate', 'borrow_factor', 'date', 'discount_factor', 'gross_dividend', 'net_dividend', 'forward', 'is_ex_date', 'fx_rate', 'borrow_rate', 'discount_rate' ] return params
[docs] class CommodityForwardPoint(MarketDataType):
[docs] def __init__(self, convenience_factor=None, date=None, discount_factor=None, forward=None): """ :param convenience_factor: The convenience factor :param date: The date :param discount_factor: The discount factor :param forward: The forward """ self.convenience_factor = convenience_factor self.date = date self.discount_factor = discount_factor self.forward = forward
def json_params(self): params = [ 'convenience_factor', 'date', 'discount_factor', 'forward', ] return params
[docs] class CommodityDescriptor(MarketDataType):
[docs] def __init__(self, spot_fixing_end_date=None, spot_fixing_start_date=None): """ :param spot_fixing_end_date: The spot fixing end date :param spot_fixing_start_date: The spot fixing start date """ self.spot_fixing_end_date = spot_fixing_end_date self.spot_fixing_start_date = spot_fixing_start_date
def json_params(self): params = [ 'spot_fixing_end_date', 'spot_fixing_start_date', ] return params
[docs] class StockInfo(MarketDataType):
[docs] def __init__(self, asset_ratio_against=None, asset_ratio_for=None, bbg_code=None, cik=None, consolidated_id=None, country=None, currency=None, cusip=None, id=None, isin=None, market_identification_code=None, morning_star_industry=None, morning_star_industry_group=None, name=None, reuters_issuer_org_id=None, ric=None, sector=None, stock_lag=None, valoren=None, x_ignite_option_code=None, x_ignite_stock_code=None, **kwargs): """ :param asset_ratio_against: The asset ratio against :param asset_ratio_for: The asset ratio for :param bbg_code: The bbg code :param cik: The cik :param consolidated_id: The consolidated id :param country: The country :param currency: The currency :param cusip: The cusip :param id: The id :param isin: The isin :param market_identification_code: The market identification code :param morning_star_industry: The morning star industry :param morning_star_industry_group: The morning star industry group :param name: The name :param reuters_issuer_org_id: The reuters issuer org id :param ric: The ric :param sector: The sector :param stock_lag: The stock lag :param valoren: The valoren :param x_ignite_option_code: The x ignite option code :param x_ignite_stock_code: The x ignite stock code """ self.asset_ratio_against = asset_ratio_against self.asset_ratio_for = asset_ratio_for self.bbg_code = bbg_code self.cik = cik self.consolidated_id = consolidated_id self.country = country self.currency = currency self.cusip = cusip self.id = id self.isin = isin self.market_identification_code = market_identification_code self.morning_star_industry = morning_star_industry self.morning_star_industry_group = morning_star_industry_group self.name = name self.reuters_issuer_org_id = reuters_issuer_org_id self.ric = ric self.sector = sector self.stock_lag = stock_lag self.valoren = valoren self.x_ignite_option_code = x_ignite_option_code self.x_ignite_stock_code = x_ignite_stock_code
def json_params(self): params = [ 'asset_ratio_against', 'asset_ratio_for', 'bbg_code', 'cik', 'consolidated_id', 'country', 'currency', 'cusip', 'id', 'isin', 'market_identification_code', 'morning_star_industry', 'morning_star_industry_group', 'name', 'reuters_issuer_org_id', 'ric', 'sector', 'stock_lag', 'valoren', 'x_ignite_option_code', 'x_ignite_stock_code', ] return params
[docs] class EquityStockGraphSettings(MarketDataType):
[docs] def __init__(self, date_format=None, end_selection_date=None, label_step=None, start_selection_date=None): """ :param date_format: The date format :param end_selection_date: The end selection date :param label_step: The label step :param start_selection_date: The start selection date """ self.date_format = date_format self.end_selection_date = end_selection_date self.label_step = label_step self.start_selection_date = start_selection_date
def json_params(self): params = [ 'date_format', 'end_selection_date', 'label_step', 'start_selection_date', ] return params
[docs] class MarketDataErrorSummary(MarketDataType):
[docs] def __init__(self, bond_yield_curve_errors=None, calendar_errors=None, cmdty_vol_surface_errors=None, commodity_errors=None, discount_curve_errors=None, equity_asset_errors=None, equity_vol_index_errors=None, equity_vol_surface_errors=None, equity_vol_index_vol_surface_errors=None, fx_cross_errors=None, fx_vol_surface_errors=None, rate_asset_errors=None, recovery_rate_errors=None, survival_curve_errors=None, swaption_vol_cube_errors=None, **kwargs): """ :param bond_yield_curve_errors: The bond yield curve errors :param calendar_errors: The calendar errors :param cmdty_vol_surface_errors: The cmdty vol surface errors :param commodity_errors: The commodity errors :param discount_curve_errors: The discount curve errors :param equity_asset_errors: The equity asset errors :param equity_vol_index_errors: The equity vol index errors :param equity_vol_surface_errors: The equity vol surface errors :param equity_vol_index_vol_surface_errors: The equity vol surface errors :param fx_cross_errors: The fx cross errors :param fx_vol_surface_errors: The fx vol surface errors :param rate_asset_errors: The rate asset errors :param recovery_rate_errors: The recovery rate errors :param survival_curve_errors: The survival curve errors :param swaption_vol_cube_errors: The swaption vol cube errors """ self.bond_yield_curve_errors = bond_yield_curve_errors self.calendar_errors = calendar_errors self.cmdty_vol_surface_errors = cmdty_vol_surface_errors self.commodity_errors = commodity_errors self.discount_curve_errors = discount_curve_errors self.equity_asset_errors = equity_asset_errors self.equity_vol_index_errors = equity_vol_index_errors self.equity_vol_surface_errors = equity_vol_surface_errors self.equity_vol_index_vol_surface_errors = equity_vol_index_vol_surface_errors self.fx_cross_errors = fx_cross_errors self.fx_vol_surface_errors = fx_vol_surface_errors self.rate_asset_errors = rate_asset_errors self.recovery_rate_errors = recovery_rate_errors self.survival_curve_errors = survival_curve_errors self.swaption_vol_cube_errors = swaption_vol_cube_errors
def json_params(self): params = [ 'bond_yield_curve_errors', 'calendar_errors', 'cmdty_vol_surface_errors', 'commodity_errors', 'discount_curve_errors', 'equity_asset_errors', 'equity_vol_index_errors', 'equity_vol_surface_errors', 'fx_cross_errors', 'fx_vol_surface_errors', 'rate_asset_errors', 'recovery_rate_errors', 'survival_curve_errors', 'swaption_vol_cube_errors', ] return params
[docs] class EquityVolatilityTermStructure(MarketDataType):
[docs] def __init__(self, expiries=None, volatility_curves=None): """ :param expiries: The expiries :param volatility_curves: The volatility curves """ self.expiries = expiries self.volatility_curves = volatility_curves
def json_params(self): params = [ 'expiries', 'volatility_curves', ] return params
[docs] class ForwardRatePoint(MarketDataType):
[docs] def __init__(self, day_count_fraction=None, discount_factor=None, fixing_date=None, forward_rate=None, maturity_date=None, value_date=None): """ :param day_count_fraction: The day count fraction :param discount_factor: The discount factor :param fixing_date: The fixing date :param forward_rate: The forward rate :param maturity_date: The maturity date :param value_date: The value date """ self.day_count_fraction = day_count_fraction self.discount_factor = discount_factor self.fixing_date = fixing_date self.forward_rate = forward_rate self.maturity_date = maturity_date self.value_date = value_date
def json_params(self): params = [ 'day_count_fraction', 'discount_factor', 'fixing_date', 'forward_rate', 'maturity_date', 'value_date', ] return params
[docs] class VolCurvePoint(MarketDataType):
[docs] def __init__(self, atmf_vol=None, call_vol=None, expiry=None, maturity=None, put_vol=None): """ :param atmf_vol: The atmf vol :param call_vol: The call vol :param expiry: The expiry :param maturity: The maturity :param put_vol: The put vol """ self.atmf_vol = atmf_vol self.call_vol = call_vol self.expiry = expiry self.maturity = maturity self.put_vol = put_vol
def json_params(self): params = [ 'atmf_vol', 'call_vol', 'expiry', 'maturity', 'put_vol', ] return params
[docs] class EquityVolSurfacePoint(MarketDataType):
[docs] def __init__(self, ask_vol=None, bid_vol=None, close_vol=None, strike=None, vol=None): """ :param ask_vol: The ask vol :param bid_vol: The bid vol :param close_vol: The close vol :param strike: The strike :param vol: The vol """ self.ask_vol = ask_vol self.bid_vol = bid_vol self.close_vol = close_vol self.strike = strike self.vol = vol
def json_params(self): params = [ 'ask_vol', 'bid_vol', 'close_vol', 'strike', 'vol', ] return params
[docs] class FxVolSurfacePoint(MarketDataType):
[docs] def __init__(self, ask_vol=None, bid_vol=None, strike=None, vol=None): """ :param ask_vol: The ask vol :param bid_vol: The bid vol :param strike: The strike :param vol: The vol """ self.ask_vol = ask_vol self.bid_vol = bid_vol self.strike = strike self.vol = vol
def json_params(self): params = [ 'ask_vol', 'bid_vol', 'strike', 'vol', ] return params
[docs] class MarketData(MarketDataType):
[docs] def __init__(self, provider_id=None): """ :param provider_id: The provider id """ self.provider_id = provider_id
def json_params(self): params = [ 'provider_id', ] return params
[docs] class FxStockGraphSettings(MarketDataType):
[docs] def __init__(self, date_format=None, end_selection_date=None, label_step=None, start_selection_date=None): """ :param date_format: The date format :param end_selection_date: The end selection date :param label_step: The label step :param start_selection_date: The start selection date """ self.date_format = date_format self.end_selection_date = end_selection_date self.label_step = label_step self.start_selection_date = start_selection_date
def json_params(self): params = [ 'date_format', 'end_selection_date', 'label_step', 'start_selection_date', ] return params
[docs] class FxData(MarketData):
[docs] def __init__(self, close=None, date=None, fixing_type=None, fx_pair=None, open=None, provider_id=None, high=None, low=None): """ :param close: The close :param date: The date :param fixing_type: The fixing type :param fx_cross_id: The fx cross id :param open: The open :param provider_id: The provider id :param high: The high :param low: The low """ self.close = close self.high = high self.low = low self.date = date self.fixing_type = fixing_type self.fx_pair = fx_pair self.open = open super(FxData, self).__init__( provider_id=provider_id)
def json_params(self): params = [ 'close', 'date', 'fixing_type', 'fx_pair', 'open', 'high', 'low' ] params += super(FxData, self).json_params() return params
[docs] class RateAsset(MarketData):
[docs] def __init__(self, business_day_convention=None, currency=None, currency_calendar=None, day_count_convention=None, end_to_end=None, fixing_calendar=None, fixing_to_value_date_offset=None, index_curve=None, name=None, provider_id=None, rate_fixings=None, rate_tenor=None, reference_date=None, type=None): """ :param business_day_convention: The business day convention :param currency: The currency :param currency_calendar: The currency calendar :param day_count_convention: The day count convention :param end_to_end: The end to end :param fixing_calendar: The fixing calendar :param fixing_to_value_date_offset: The fixing to value date offset :param index_curve: The index curve :param name: The name :param provider_id: The provider id :param rate_fixings: The rate fixings :param rate_tenor: The rate tenor :param reference_date: The reference date :param type: The type """ self.business_day_convention = business_day_convention self.currency = currency self.currency_calendar = currency_calendar self.day_count_convention = day_count_convention self.end_to_end = end_to_end self.fixing_calendar = fixing_calendar self.fixing_to_value_date_offset = fixing_to_value_date_offset self.index_curve = index_curve self.name = name self.rate_fixings = rate_fixings self.rate_tenor = rate_tenor self.reference_date = reference_date self.type = type super(RateAsset, self).__init__( provider_id=provider_id)
def json_params(self): params = [ 'business_day_convention', 'currency', 'currency_calendar', 'day_count_convention', 'end_to_end', 'fixing_calendar', 'fixing_to_value_date_offset', 'index_curve', 'name', 'rate_fixings', 'rate_tenor', 'reference_date', 'type', ] params += super(RateAsset, self).json_params() return params
[docs] class Asset(MarketData):
[docs] def __init__(self, provider_id=None, reference_date=None): """ :param provider_id: The provider id :param reference_date: The reference date """ self.reference_date = reference_date super(Asset, self).__init__( provider_id=provider_id)
def json_params(self): params = [ 'reference_date', ] params += super(Asset, self).json_params() return params
[docs] class SwaptionVolCube(MarketData):
[docs] def __init__(self, alphas=None, benchmark_forward_swap_rates=None, benchmark_option_maturities=None, benchmark_swap_tenors=None, betas=None, nus=None, provider_id=None, rate_asset_id=None, reference_date=None, rhos=None, shifts=None): """ :param alphas: The alphas :param benchmark_forward_swap_rates: The benchmark forward swap rates :param benchmark_option_maturities: The benchmark option maturities :param benchmark_swap_tenors: The benchmark swap tenors :param betas: The betas :param nus: The nus :param provider_id: The provider id :param rate_asset_id: The rate asset id :param reference_date: The reference date :param rhos: The rhos :param shifts: The shifts """ self.alphas = alphas self.benchmark_forward_swap_rates = benchmark_forward_swap_rates self.benchmark_option_maturities = benchmark_option_maturities self.benchmark_swap_tenors = benchmark_swap_tenors self.betas = betas self.nus = nus self.rate_asset_id = rate_asset_id self.reference_date = reference_date self.rhos = rhos self.shifts = shifts super(SwaptionVolCube, self).__init__( provider_id=provider_id)
def json_params(self): params = [ 'alphas', 'benchmark_forward_swap_rates', 'benchmark_option_maturities', 'benchmark_swap_tenors', 'betas', 'nus', 'rate_asset_id', 'reference_date', 'rhos', 'shifts', ] params += super(SwaptionVolCube, self).json_params() return params
[docs] class CreditSwaptionVolCubeData(MarketData):
[docs] def __init__(self, credit_index_identifier=None, reference_date=None, option_expiration_date=None, swap_expiration_date=None, strike_spread=None, strike_price=None, vol=None, provider_id=None): """ :param credit_index_identifier: The underlying credit index identifier :param reference_date: The reference_date :param option_expiration_date: The option expiration date :param swap_expiration_date: The swap expiration date :param strike_spread: The strike spread :param strike_spread: The strike price :param vol: The vol """ self.credit_index_identifier = credit_index_identifier self.reference_date = reference_date self.option_expiration_date = option_expiration_date self.swap_expiration_date = swap_expiration_date self.strike_spread = strike_spread self.strike_price = strike_price self.vol = vol super(CreditSwaptionVolCubeData, self).__init__(provider_id=provider_id)
def json_params(self): params = [ 'credit_index_identifier', 'reference_date', 'option_expiration_date', 'swap_expiration_date', 'strike_spread', 'strike_price', 'vol', ] params += super(CreditSwaptionVolCubeData, self).json_params() return params
[docs] class VolatilitySurfaceSvi(MarketData): class StrikeType(IntEnum): LogarithmicSpot = 3 Normalized = 2 Logarithmic = 1 Absolute = 0
[docs] def __init__(self, benchmark_fwd_factors=None, benchmark_maturities=None, call_wings=None, provider_id=None, put_wings=None, reference_date=None, skews=None, smiles=None, spot_ref=None, strike_type=None, vols=None): """ :param benchmark_fwd_factors: The benchmark fwd factors :param benchmark_maturities: The benchmark maturities :param call_wings: The call wings :param provider_id: The provider id :param put_wings: The put wings :param reference_date: The reference date :param skews: The skews :param smiles: The smiles :param spot_ref: The spot ref :param strike_type: The strike type :param vols: The vols """ self.benchmark_fwd_factors = benchmark_fwd_factors self.benchmark_maturities = benchmark_maturities self.call_wings = call_wings self.put_wings = put_wings self.reference_date = reference_date self.skews = skews self.smiles = smiles self.spot_ref = spot_ref self.strike_type = strike_type self.vols = vols super(VolatilitySurfaceSvi, self).__init__( provider_id=provider_id)
def json_params(self): params = [ 'benchmark_fwd_factors', 'benchmark_maturities', 'call_wings', 'put_wings', 'reference_date', 'skews', 'smiles', 'spot_ref', 'strike_type', 'vols', ] params += super(VolatilitySurfaceSvi, self).json_params() return params
[docs] class VolCurve(MarketData):
[docs] def __init__(self, provider_id=None, maturities=None, reference_date=None, vols=None, spot_ref=None): """ :param provider_id: The provider id :param maturities: The benchmark maturities :param reference_date: The reference date :param vols: The vols :param spot_ref: The spot ref. spot_ref is used for vol surface construction only (i.e. to convert the supplied vol grid into z-space). It is distinct from equity_vol_surface_spot_model on the MarketDataOverride, which controls how the vol surface slides when a spot override is supplied. When both a spot override and a vol grid override are present, equity_vol_surface_spot_model only makes a difference if the spot_ref embedded in the vol grid differs from the spot override. """ self.maturities = maturities self.reference_date = reference_date self.vols = vols self.spot_ref = spot_ref super(VolCurve, self).__init__( provider_id=provider_id)
def json_params(self): params = [ 'maturities', 'reference_date', 'vols', 'spot_ref', ] params += super(VolCurve, self).json_params() return params
[docs] class VolGrid(MarketData): class StrikeType(IntEnum): PercentForward = 2 PercentSpot = 1 Absolute = 0
[docs] def __init__(self, provider_id=None, reference_date=None, maturities=None, strike_type=None, strikes=None, vols=None, use_spline=None, spot_ref=None): """ :param provider_id: The provider id :param reference_date: The reference date :param maturities: The benchmark maturities :param strike_type: The strike type :param strikes: The strikes :param vols: The vols :param use_spline: The use spline flag :param spot_ref: The spot ref. spot_ref is used for vol surface construction only (i.e. to convert the supplied vol grid into z-space). It is distinct from equity_vol_surface_spot_model on the MarketDataOverride, which controls how the vol surface slides when a spot override is supplied. When both a spot override and a vol grid override are present, equity_vol_surface_spot_model only makes a difference if the spot_ref embedded in the vol grid differs from the spot override. """ self.reference_date = reference_date self.maturities = maturities self.strike_type = strike_type self.strikes = strikes self.vols = vols self.use_spline = use_spline self.spot_ref = spot_ref super(VolGrid, self).__init__( provider_id=provider_id)
def json_params(self): params = [ 'reference_date', 'maturities', 'strike_type', 'strikes', 'vols', 'use_spline', 'spot_ref' ] params += super(VolGrid, self).json_params() return params
[docs] class BondInfo(MarketData):
[docs] def __init__(self, business_day_convention=None, calendar_id=None, call_provision=None, callable_conversion_condition=None, conversion_condition=None, country=None, coupon_frequency=None, coupon_rate=None, coupon_rates=None, coupon_type=None, currency=None, dated_date=None, day_count_convention=None, description=None, dilution_conversion_condition=None, dividend_protection_conversion_condition=None, end_to_end=None, equity_asset_currency=None, equity_asset_id=None, exchanges=None, figi=None, first_coupon_date=None, is_benchmark_bond=None, is_callable=None, is_convertible=None, is_inflation_protected=None, is_perpetual=None, is_putable=None, is_sinkable=None, is_valid=None, isin=None, issue_date=None, issuer=None, mandatory_conversion_condition=None, market=None, maturity_date=None, name=None, original_issue_amount=None, par_value=None, penultimate_coupon_date=None, provider_id=None, put_provision=None, puttable_conversion_condition=None, quoted_clean=None, quotation_base=None, quotation_method=None, redemption_rate=None, reuters_issuer_id=None, reuters_issuer_name=None, reuters_issuer_org_id=None, reuters_ticker=None, ric=None, settlement_lag=None, sub_type=None, type=None, bond_coupons=None, **kwargs): """ :param business_day_convention: The business day convention :param calendar_id: The calendar id :param call_provision: The call provision :param callable_conversion_condition: The callable conversion condition :param conversion_condition: The conversion condition :param country: The country :param coupon_frequency: The coupon frequency :param coupon_rate: The coupon rate :param coupon_rates: The coupon rates :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 description: The description :param dilution_conversion_condition: The dilution conversion condition :param dividend_protection_conversion_condition: The dividend protection conversion condition :param end_to_end: The end to end :param equity_asset_currency: The equity asset currency :param equity_asset_id: The equity asset id :param exchanges: The exchanges :param figi: The FIGI :param first_coupon_date: The first coupon date :param is_benchmark_bond: The is benchmark bond :param is_callable: The is callable :param is_convertible: The is convertible :param is_inflation_protected: The is inflation protected :param is_perpetual: The is perpetual :param is_putable: The is putable :param is_sinkable: The is sinkable :param is_valid: The is valid :param isin: The isin :param issue_date: The issue date :param issuer: The issuer :param mandatory_conversion_condition: The mandatory conversion condition :param market: The market :param maturity_date: The maturity date :param name: The name :param original_issue_amount: The original issue amount :param par_value: The par value :param penultimate_coupon_date: The penultimate coupon date :param provider_id: The provider id :param put_provision: The put provision :param puttable_conversion_condition: The puttable conversion condition :param quoted_clean: The quoted clean :param quotation_base: The quotation base :param quotation_method: The quotation method :param redemption_rate: The redemption rate :param reuters_issuer_id: The reuters issuer id :param reuters_issuer_name: The reuters issuer name :param reuters_issuer_org_id: The reuters issuer org id :param reuters_ticker: The reuters ticker :param ric: The ric :param settlement_lag: The settlement lag :param sub_type: The sub type :param type: The type :param bond_coupons: bond coupons """ self.business_day_convention = business_day_convention self.calendar_id = calendar_id self.call_provision = call_provision self.callable_conversion_condition = callable_conversion_condition self.conversion_condition = conversion_condition self.country = country self.coupon_frequency = coupon_frequency self.coupon_rate = coupon_rate self.coupon_rates = coupon_rates self.coupon_type = coupon_type self.currency = currency self.dated_date = dated_date self.day_count_convention = day_count_convention self.description = description self.dilution_conversion_condition = dilution_conversion_condition self.dividend_protection_conversion_condition = dividend_protection_conversion_condition self.end_to_end = end_to_end self.equity_asset_currency = equity_asset_currency self.equity_asset_id = equity_asset_id self.exchanges = exchanges self.figi = figi, self.first_coupon_date = first_coupon_date self.is_benchmark_bond = is_benchmark_bond self.is_callable = is_callable self.is_convertible = is_convertible self.is_inflation_protected = is_inflation_protected self.is_perpetual = is_perpetual self.is_putable = is_putable self.is_sinkable = is_sinkable self.is_valid = is_valid self.isin = isin self.issue_date = issue_date self.issuer = issuer self.mandatory_conversion_condition = mandatory_conversion_condition self.market = market self.maturity_date = maturity_date self.name = name self.original_issue_amount = original_issue_amount self.par_value = par_value self.penultimate_coupon_date = penultimate_coupon_date self.put_provision = put_provision self.puttable_conversion_condition = puttable_conversion_condition self.quoted_clean = quoted_clean self.quotation_base = quotation_base self.quotation_method = quotation_method self.redemption_rate = redemption_rate self.reuters_issuer_id = reuters_issuer_id self.reuters_issuer_name = reuters_issuer_name self.reuters_issuer_org_id = reuters_issuer_org_id self.reuters_ticker = reuters_ticker self.ric = ric self.settlement_lag = settlement_lag self.sub_type = sub_type self.type = type self.bond_coupons = bond_coupons super(BondInfo, self).__init__( provider_id=provider_id)
def json_params(self): params = [ 'business_day_convention', 'calendar_id', 'call_provision', 'callable_conversion_condition', 'conversion_condition', 'country', 'coupon_frequency', 'coupon_rate', 'coupon_rates', 'coupon_type', 'currency', 'dated_date', 'day_count_convention', 'description', 'dilution_conversion_condition', 'dividend_protection_conversion_condition', 'end_to_end', 'equity_asset_currency', 'equity_asset_id', 'exchanges', 'figi', 'first_coupon_date', 'is_benchmark_bond', 'is_callable', 'is_convertible', 'is_inflation_protected', 'is_perpetual', 'is_putable', 'is_sinkable', 'is_valid', 'isin', 'issue_date', 'issuer', 'mandatory_conversion_condition', 'market', 'maturity_date', 'name', 'original_issue_amount', 'par_value', 'penultimate_coupon_date', 'put_provision', 'puttable_conversion_condition', 'quoted_clean', 'quotation_base', 'quotation_method', 'redemption_rate', 'reuters_issuer_id', 'reuters_issuer_name', 'reuters_issuer_org_id', 'reuters_ticker', 'ric', 'settlement_lag', 'sub_type', 'type', 'bond_coupons' ] params += super(BondInfo, self).json_params() return params
[docs] class BorrowCurve(MarketData):
[docs] def __init__(self, asset_name=None, discount_factors=None, extrapolate=True, maturities=None, provider_id=None, value_date=None): """ :param asset_name: The asset name :param discount_factors: The discount factors :param extrapolate: The extrapolate :param maturities: The maturities :param provider_id: The provider id :param value_date: The value date """ self.asset_name = asset_name self.discount_factors = discount_factors self.extrapolate = extrapolate self.maturities = maturities self.value_date = value_date super(BorrowCurve, self).__init__( provider_id=provider_id)
def json_params(self): params = [ 'asset_name', 'discount_factors', 'extrapolate', 'maturities', 'value_date', ] params += super(BorrowCurve, self).json_params() return params
[docs] class VolSurfaceSpotModelDefinition(MarketDataType): """Beta-adjusted ATMF spot model inputs for an equity volatility index. The API fixes the model type; no model enum is exposed. Upload requests apply their authorized provider to every row and populate provenance on the server. """
[docs] def __init__(self, asset=None, reference_date=None, model_id=None, tenors=None, betas_up=None, betas_dn=None): """ :param asset: InstrumentIdentifier resolved to an internal volatility-index ID. :param reference_date: datetime.datetime at midnight, without timezone conversion. :param model_id: Nonblank model identifier used by the equity scenario. :param tenors: Nonempty tenor strings yielding positive, strictly increasing maturities. :param betas_up: Finite coefficients for positive relative equity spot shocks, one per tenor. Beta times the signed relative shock is the absolute decimal ATMF volatility change. :param betas_dn: Coefficients for negative shocks, with the same units and tenor alignment. Negative and zero coefficients are allowed in both lists. """ self.asset = asset self.reference_date = reference_date self.model_id = model_id self.tenors = tenors self.betas_up = betas_up self.betas_dn = betas_dn
def json_params(self): return ['asset', 'reference_date', 'model_id', 'tenors', 'betas_up', 'betas_dn']
[docs] class BorrowCurveData(MarketData):
[docs] def __init__(self, identifier=None, discount_factors=None, maturities=None, provider_id=None, value_date=None, tenors=None, rates=None, use_zero_rates=None): """ :param identifier: The identifier :param discount_factors: The discount factors :param maturities: The maturities :param provider_id: The provider id :param value_date: The value date :param tenors: The tenors :param rates: The rates :param use_zero_rates: The use zero rates flag """ self.identifier = identifier self.discount_factors = discount_factors self.maturities = maturities self.value_date = value_date self.tenors = tenors self.rates = rates self.use_zero_rates = use_zero_rates super(BorrowCurveData, self).__init__( provider_id=provider_id)
def json_params(self): params = [ 'identifier', 'discount_factors', 'maturities', 'value_date', 'tenors', 'rates', 'use_zero_rates', ] params += super(BorrowCurveData, self).json_params() return params
[docs] class DiscountCurve(MarketData):
[docs] def __init__(self, currency=None, curve_name=None, discount_factors=None, extrapolate=True, maturities=None, provider_id=None, value_date=None): """ :param currency: The currency :param curve name: The curve name :param discount_factors: The discount factors :param extrapolate: The extrapolate :param maturities: The maturities :param provider_id: The provider id :param value_date: The value date """ self.currency = currency self.curve_name = curve_name self.discount_factors = discount_factors self.extrapolate = extrapolate self.maturities = maturities self.value_date = value_date super(DiscountCurve, self).__init__( provider_id=provider_id)
def json_params(self): params = [ 'currency', 'curve_name', 'discount_factors', 'extrapolate', 'maturities', 'value_date', ] params += super(DiscountCurve, self).json_params() return params
[docs] class Dividend(MarketData): class Type(IntEnum): Extraordinary = 1 Scrip = 2 Regular = 0
[docs] def __init__(self, asset_id=None, reference_date=None, all_in_rate=None, cash_dividend=None, confirmed=None, currency=None, declared_date=None, dividend_type=None, dividend_yield=None, ex_date=None, index_component_asset_id=None, pay_date=None, provider_id=None, record_date=None, type=None, withholding_tax_rate=None): """ :param asset_id: The asset identifier :param reference_date: the reference date :param all_in_rate: The all in rate :param cash_dividend: The cash dividend :param confirmed: The confirmed :param currency: The currency :param declared_date: The declared date :param dividend_type: The dividend type :param dividend_yield: The dividend yield :param ex_date: The ex date :param pay_date: The pay date :param provider_id: The provider id :param record_date: The record date :param type: The type """ self.asset_id = asset_id self.reference_date = reference_date self.all_in_rate = all_in_rate self.cash_dividend = cash_dividend self.confirmed = confirmed self.currency = currency self.declared_date = declared_date self.dividend_type = dividend_type self.dividend_yield = dividend_yield self.ex_date = ex_date self.index_component_asset_id = index_component_asset_id self.pay_date = pay_date self.record_date = record_date self.type = type self.withholding_tax_rate = withholding_tax_rate super(Dividend, self).__init__( provider_id=provider_id)
def json_params(self): params = [ 'asset_id', 'reference_date', 'all_in_rate', 'cash_dividend', 'confirmed', 'currency', 'declared_date', 'dividend_type', 'dividend_yield', 'ex_date', 'index_component_asset_id', 'pay_date', 'record_date', 'type', 'withholding_tax_rate' ] params += super(Dividend, self).json_params() return params
[docs] class SurvivalCurveError(MarketDataError):
[docs] def __init__(self, currency=None, debt_type=None, default_type=None, issuer_id=None, issuer_name=None, message=None, reference_date=None): """ :param currency: The currency :param debt_type: The debt type :param default_type: The default type :param issuer_id: The issuer id :param issuer_name: The issuer name :param message: The message :param reference_date: The reference date """ self.currency = currency self.debt_type = debt_type self.default_type = default_type self.issuer_id = issuer_id self.issuer_name = issuer_name super(SurvivalCurveError, self).__init__( message=message, reference_date=reference_date)
def json_params(self): params = [ 'currency', 'debt_type', 'default_type', 'issuer_id', 'issuer_name', ] params += super(SurvivalCurveError, self).json_params() return params
[docs] class EquityVolSurfaceError(MarketDataError):
[docs] def __init__(self, asset_id=None, asset_ric=None, message=None, reference_date=None): """ :param asset_id: The asset id :param asset_ric: The asset ric :param message: The message :param reference_date: The reference date """ self.asset_id = asset_id self.asset_ric = asset_ric super(EquityVolSurfaceError, self).__init__( message=message, reference_date=reference_date)
def json_params(self): params = [ 'asset_id', 'asset_ric', ] params += super(EquityVolSurfaceError, self).json_params() return params
[docs] class FxCrossError(MarketDataError):
[docs] def __init__(self, fx_cross_id=None, message=None, reference_date=None): """ :param fx_cross_id: The fx cross id :param message: The message :param reference_date: The reference date """ self.fx_cross_id = fx_cross_id super(FxCrossError, self).__init__( message=message, reference_date=reference_date)
def json_params(self): params = [ 'fx_cross_id', ] params += super(FxCrossError, self).json_params() return params
[docs] class EquityAssetError(MarketDataError):
[docs] def __init__(self, asset_id=None, asset_ric=None, message=None, reference_date=None): """ :param asset_id: The asset id :param asset_ric: The asset ric :param message: The message :param reference_date: The reference date """ self.asset_id = asset_id self.asset_ric = asset_ric super(EquityAssetError, self).__init__( message=message, reference_date=reference_date)
def json_params(self): params = [ 'asset_id', 'asset_ric', ] params += super(EquityAssetError, self).json_params() return params
[docs] class CmdtyVolSurfaceError(MarketDataError):
[docs] def __init__(self, commodity_id=None, commodity_name=None, message=None, reference_date=None): """ :param commodity_id: The commodity id :param commodity_name: The commodity name :param message: The message :param reference_date: The reference date """ self.commodity_id = commodity_id self.commodity_name = commodity_name super(CmdtyVolSurfaceError, self).__init__( message=message, reference_date=reference_date)
def json_params(self): params = [ 'commodity_id', 'commodity_name', ] params += super(CmdtyVolSurfaceError, self).json_params() return params
[docs] class BondYieldCurveError(MarketDataError):
[docs] def __init__(self, currency=None, issuer_id=None, issuer_name=None, debt_type=None, message=None, reference_date=None): """ :param currency: The currency :param issuer_id: The issuer id :param issuer_name: The issuer name :param message: The message :param reference_date: The reference date """ self.currency = currency self.issuer_id = issuer_id self.issuer_name = issuer_name self.debt_type = debt_type super(BondYieldCurveError, self).__init__( message=message, reference_date=reference_date)
def json_params(self): params = [ 'currency', 'issuer_id', 'issuer_name', 'debt_type' ] params += super(BondYieldCurveError, self).json_params() return params
[docs] class BondYieldCurve(MarketData):
[docs] def __init__(self, currency=None, discount_factors=None, extrapolate=True, issuer_identifier=None, issuer_id=None, maturities=None, provider_id=None, seniority=None, reference_bond_yield_curve=None, reference_date=None, bond_identifier=None): """ :param currency: The currency :param discount_factors: The discount factors :param extrapolate: The extrapolate :param issuer_identifier: The issuer identifier :param maturities: The maturities :param provider_id: The provider id :param reference_bond_yield_curve: The reference bond yield curve :param reference_date: The reference date :param seniority: The seniority """ self.currency = currency self.discount_factors = discount_factors self.extrapolate = extrapolate self.issuer_identifier = issuer_identifier self.issuer_id = issuer_id self.maturities = maturities self.seniority = seniority self.reference_bond_yield_curve = reference_bond_yield_curve self.reference_date = reference_date self.bond_identifier = bond_identifier super(BondYieldCurve, self).__init__( provider_id=provider_id)
def json_params(self): params = [ 'currency', 'discount_factors', 'extrapolate', 'issuer_identifier', 'issuer_id', 'maturities', 'seniority', 'reference_bond_yield_curve', 'reference_date', 'bond_identifier' ] params += super(BondYieldCurve, self).json_params() return params
[docs] class BondYieldCurveExternal(BondYieldCurve): # backwards compatibility pass
[docs] class IndexComponentData(MarketData):
[docs] def __init__(self, date=None, index_identifier=None, reference_etf=None, shares=None, stock_identifier=None, weight=None, index_price=None, divisor=None, provider_id=None, constituent_spot=None, notes=None): """ :param date: The date :param index_identifier: The index identifier :param reference_etf: The reference etf identifier :param shares: The shares :param stock_identifier: The stock ric :param weight: The weight :param index_price: The index price :param divisor: The index divisor """ self.date = date self.index_identifier = index_identifier self.reference_etf = reference_etf self.shares = shares self.stock_identifier = stock_identifier self.weight = weight self.index_price = index_price self.divisor = divisor self.provider_id = provider_id self.constituent_spot = constituent_spot self.notes = notes super(IndexComponentData, self).__init__()
def json_params(self): params = [ 'date', 'index_identifier', 'reference_etf', 'shares', 'stock_identifier', 'weight', 'index_price', 'divisor', 'provider_id', 'notes' ] params += super(IndexComponentData, self).json_params() return params
[docs] class MarketDataForEnv:
[docs] def __init__(self, market_date=None, ric=None, bbg_code=None, uploaded_by=None, market_data_environment_name=None, rolled=None, uploaded_date_time=None): """ :param market_date: The market date :param ric: The stock RIC :param bbg_code: The Bloomberg code :param uploaded_by: The user who uploaded the data :param market_data_environment_name: The name of the market data environment :param rolled: Indicates if the data has been rolled :param uploaded_date_time: The timestamp when the data was uploaded """ self.market_date = market_date self.ric = ric self.bbg_code = bbg_code self.uploaded_by = uploaded_by self.market_data_environment_name = market_data_environment_name self.rolled = rolled self.uploaded_date_time = uploaded_date_time
def json_params(self): params = [ 'market_date', 'ric', 'bbg_code', 'uploaded_by', 'market_data_environment_name', 'rolled', 'uploaded_date_time' ] return params
[docs] class ConvenienceYieldCurve(MarketData):
[docs] def __init__(self, commodity_id=None, discount_factors=None, extrapolate=True, maturities=None, provider_id=None, value_date=None): """ :param commodity_id: The commodity id :param discount_factors: The discount factors :param extrapolate: The extrapolate :param maturities: The maturities :param provider_id: The provider id :param value_date: The value date """ self.commodity_id = commodity_id self.discount_factors = discount_factors self.extrapolate = extrapolate self.maturities = maturities self.value_date = value_date super(ConvenienceYieldCurve, self).__init__( provider_id=provider_id)
def json_params(self): params = [ 'commodity_id', 'discount_factors', 'extrapolate', 'maturities', 'value_date', ] params += super(ConvenienceYieldCurve, self).json_params() return params
[docs] class RecoveryRateError(MarketDataError):
[docs] def __init__(self, bond_id=None, issuer_id=None, issuer_name=None, debt_type=None, message=None, reference_date=None): """ :param id: The id :param message: The message :param reference_date: The reference date """ self.bond_id = bond_id self.issuer_id = issuer_id self.issuer_name = issuer_name self.debt_type = debt_type super(RecoveryRateError, self).__init__( message=message, reference_date=reference_date)
def json_params(self): params = [ 'bond_id', 'issuer_id', 'issuer_name', 'debt_type', ] params += super(RecoveryRateError, self).json_params() return params
[docs] class BondFuturesData(MarketData):
[docs] def __init__(self, ask=None, bbg_code=None, bid=None, close=None, currency=None, date=None, expiration_date=None, high=None, low=None, provider_id=None, ric=None, settle=None, volume=None): """ :param ask: The ask :param bbg_code: The bbg code :param bid: The bid :param close: The close :param currency: The currency :param date: The date :param expiration_date: The expiration date :param high: The high :param low: The low :param provider_id: The provider id :param ric: The ric :param settle: The settle :param volume: The volume """ self.ask = ask self.bbg_code = bbg_code self.bid = bid self.close = close self.currency = currency self.date = date self.expiration_date = expiration_date self.high = high self.low = low self.ric = ric self.settle = settle self.volume = volume super(BondFuturesData, self).__init__( provider_id=provider_id)
def json_params(self): params = [ 'ask', 'bbg_code', 'bid', 'close', 'currency', 'date', 'expiration_date', 'high', 'low', 'ric', 'settle', 'volume', ] params += super(BondFuturesData, self).json_params() return params
[docs] class FxVolSurfaceError(MarketDataError):
[docs] def __init__(self, fx_cross_id=None, message=None, reference_date=None): """ :param fx_cross_id: The fx cross id :param message: The message :param reference_date: The reference date """ self.fx_cross_id = fx_cross_id super(FxVolSurfaceError, self).__init__( message=message, reference_date=reference_date)
def json_params(self): params = [ 'fx_cross_id', ] params += super(FxVolSurfaceError, self).json_params() return params
[docs] class BondData(MarketData):
[docs] def __init__(self, bond_id=None, close=None, contributor=None, currency=None, date=None, high=None, low=None, open=None, liquidity_score=None, provider_id=None, **kwargs): """ :param bond_id: The bond id :param close: The close :param contributor: The contributor :param currency: The currency :param date: The date :param high: The high :param low: The low :param open: The open :param provider_id: The provider id """ self.bond_id = bond_id self.close = close self.contributor = contributor self.currency = currency self.date = date self.high = high self.low = low self.open = open self.liquidity_score = liquidity_score super(BondData, self).__init__( provider_id=provider_id)
def json_params(self): params = [ 'bond_id', 'close', 'contributor', 'currency', 'date', 'high', 'low', 'open', 'liquidity_score' ] params += super(BondData, self).json_params() return params
[docs] class BondDataExternal(MarketData): class BondPriceFittingMode(IntEnum): FitCreditSpread = 0, FitVolSurface = 1
[docs] def __init__(self, bond_identifier=None, currency=None, traded_price=None, date=None, is_percentage_of_par=None, is_currency_per_bond_unit=None, fitting_mode=None): """ :param bond_identifier: The bond identifier :param currency: The currency :param traded_price: The traded_price :param date: The date :param is_percentage_of_par: The is_percentage_of_par :param is_currency_per_bond_unit: The currency_per_bond_unit :param fitting_mode: The bond price fitting mode """ self.bond_identifier = bond_identifier self.currency = currency self.traded_price = traded_price self.date = date self.is_percentage_of_par = is_percentage_of_par self.is_currency_per_bond_unit = is_currency_per_bond_unit self.fitting_mode = fitting_mode super(BondDataExternal, self).__init__( provider_id="")
def json_params(self): params = [ 'bond_identifier', 'currency', 'traded_price', 'date', 'is_percentage_of_par', 'is_currency_per_bond_unit', 'fitting_mode' ] params += super(BondDataExternal, self).json_params() return params
[docs] class BondIssuerCreditSpreadData(MarketData):
[docs] def __init__(self, bond_identifier=None, date=None, spread=None): """ :param bond_identifier: The bond identifier :param date: The date :param spread: The spread """ self.bond_identifier = bond_identifier self.date = date self.spread = spread super(BondIssuerCreditSpreadData, self).__init__(provider_id="")
def json_params(self): params = [ 'bond_identifier', 'date', 'spread', ] params += super(BondIssuerCreditSpreadData, self).json_params() return params
[docs] class CdsData(MarketData):
[docs] def __init__(self, issuer_identifier=None, issuer_id=None, currency=None, seniority=None, doc_clause=None, tenor=None, traded_spread=None, pts_upfront=None, date=None, running_coupon=None, assumed_recovery=None, liquidity_score=None, **kwargs): """ :param issuer_identifier: The issuer identifier :param currency: The currency :param seniority: The seniority :param doc_clause: The doc clause :param tenor: The tenor :param traded_spread: The traded spread :param pts_upfront: The points upfront :param date: The date :param running_coupon: The running coupon :param assumed_recovery: The assumed recovery rate :param liquidity_score: The liquidity score """ self.issuer_identifier = issuer_identifier, self.issuer_id = issuer_id, self.currency = currency, self.seniority = seniority, self.doc_clause = doc_clause, self.tenor = tenor, self.traded_spread = traded_spread, self.pts_upfront = pts_upfront, self.date = date, self.running_coupon = running_coupon, self.assumed_recovery = assumed_recovery, self.liquidity_score = liquidity_score, super(CdsData, self).__init__(provider_id="")
def json_params(self): params = [ 'issuer_identifier', 'issuer_id', 'currency', 'seniority', 'doc_clause', 'tenor', 'traded_spread', 'pts_upfront', 'date', 'running_coupon', 'assumed_recovery', 'liquidity_score' ] params += super(CdsData, self).json_params() return params
[docs] class EquityVolIndexError(MarketDataError):
[docs] def __init__(self, eq_vol_index_id=None, eq_vol_index_name=None, eq_vol_index_ric=None, message=None, reference_date=None): """ :param eq_vol_index_id: The eq vol index id :param eq_vol_index_name: The eq vol index name :param eq_vol_index_ric: The eq vol index ric :param message: The message :param reference_date: The reference date """ self.eq_vol_index_id = eq_vol_index_id self.eq_vol_index_name = eq_vol_index_name self.eq_vol_index_ric = eq_vol_index_ric super(EquityVolIndexError, self).__init__( message=message, reference_date=reference_date)
def json_params(self): params = [ 'eq_vol_index_id', 'eq_vol_index_name', 'eq_vol_index_ric', ] params += super(EquityVolIndexError, self).json_params() return params
[docs] class SwaptionVolCubeError(MarketDataError):
[docs] def __init__(self, message=None, rate_asset_id=None, reference_date=None): """ :param message: The message :param rate_asset_id: The rate asset id :param reference_date: The reference date """ self.rate_asset_id = rate_asset_id super(SwaptionVolCubeError, self).__init__( message=message, reference_date=reference_date)
def json_params(self): params = [ 'rate_asset_id', ] params += super(SwaptionVolCubeError, self).json_params() return params
[docs] class SurvivalCurve(MarketData):
[docs] def __init__(self, currency=None, debt_type=None, default_type=None, extrapolate=True, issuer_id=None, issuer_identifier=None, maturities=None, provider_id=None, reference_date=None, survival_probabilities=None): """ :param currency: The currency :param debt_type: The debt type :param default_type: The default type :param extrapolate: The extrapolate :param issuer_id: The issuer id :param maturities: The maturities :param provider_id: The provider id :param reference_date: The reference date :param survival_probabilities: The survival probabilities """ self.currency = currency self.debt_type = debt_type self.default_type = default_type self.extrapolate = extrapolate self.issuer_id = issuer_id self.issuer_identifier = issuer_identifier self.maturities = maturities self.reference_date = reference_date self.survival_probabilities = survival_probabilities super(SurvivalCurve, self).__init__( provider_id=provider_id)
def json_params(self): params = [ 'currency', 'debt_type', 'default_type', 'extrapolate', 'issuer_id', 'issuer_identifier', 'maturities', 'reference_date', 'survival_probabilities', ] params += super(SurvivalCurve, self).json_params() return params
[docs] class SurvivalCurveExternal(SurvivalCurve): # backwards compatibility pass
[docs] class FuturesData(MarketData):
[docs] def __init__(self, ask=None, bid=None, close=None, currency=None, date=None, expiration_date=None, high=None, low=None, identifier=None, settle=None, volume=None, provider_id=None): """ :param ask: The ask :param bid: The bid :param close: The close :param currency: The currency :param date: The date :param expiration_date: The expiration date :param high: The high :param low: The low :param identifier: The identifier :param settle: The settle :param volume: The volume :param provider_id: The provider id """ self.ask = ask self.bid = bid self.close = close self.currency = currency self.date = date self.expiration_date = expiration_date self.high = high self.low = low self.identifier = identifier self.settle = settle self.volume = volume super(FuturesData, self).__init__( provider_id=provider_id)
def json_params(self): params = [ 'ask', 'bid', 'close', 'currency', 'date', 'expiration_date', 'high', 'low', 'identifier', 'settle', 'volume', ] return params
[docs] class CmdtyFuturesData(FuturesData): pass
[docs] class StockData(MarketData):
[docs] def __init__(self, close=None, currency=None, date=None, high=None, identifier=None, low=None, open=None, provider_id=None, split_factor=None, volume=None): """ :param close: The close :param currency: The currency :param date: The date :param high: The high :param identifier: The identifier :param low: The low :param open: The open :param provider_id: The provider id :param split_factor: The split factor :param volume: The volume """ self.close = close self.currency = currency self.date = date self.high = high self.identifier = identifier self.low = low self.open = open self.split_factor = split_factor self.volume = volume super(StockData, self).__init__( provider_id=provider_id)
def json_params(self): params = [ 'close', 'currency', 'date', 'high', 'identifier', 'low', 'open', 'split_factor', 'volume', ] params += super(StockData, self).json_params() return params
[docs] class DividendIndexFixing(MarketData):
[docs] def __init__(self, dividend_index_id=None, close=None, date=None, fixing_type=None, provider_id=None): """ :param dividend_index_id: The dividend index id :param close: The close :param date: The date :param fixing_type: The fixing type :param provider_id: The provider id """ self.dividend_index_id = dividend_index_id self.close = close self.date = date self.fixing_type = fixing_type super(DividendIndexFixing, self).__init__( provider_id=provider_id)
def json_params(self): params = [ 'dividend_index_id', 'close', 'date', 'fixing_type' ] params += super(DividendIndexFixing, self).json_params() return params
[docs] class EtfPremium(MarketData):
[docs] def __init__(self, date=None, identifier=None, premium=None, provider_id=None): """ :param date: The date :param identifier: The identifier :param premium: The premium :param provider_id: The provider id """ self.date = date self.identifier = identifier self.premium = premium super(EtfPremium, self).__init__(provider_id=provider_id)
def json_params(self): params = [ 'date', 'identifier', 'premium', ] params += super(EtfPremium, self).json_params() return params
[docs] class DiscountCurveError(MarketDataError):
[docs] def __init__(self, currency=None, message=None, reference_date=None): """ :param currency: The currency :param message: The message :param reference_date: The reference date """ self.currency = currency super(DiscountCurveError, self).__init__( message=message, reference_date=reference_date)
def json_params(self): params = [ 'currency', ] params += super(DiscountCurveError, self).json_params() return params
[docs] class CommodityError(MarketDataError):
[docs] def __init__(self, commodity_id=None, commodity_name=None, message=None, reference_date=None): """ :param commodity_id: The commodity id :param commodity_name: The commodity name :param message: The message :param reference_date: The reference date """ self.commodity_id = commodity_id self.commodity_name = commodity_name super(CommodityError, self).__init__( message=message, reference_date=reference_date)
def json_params(self): params = [ 'commodity_id', 'commodity_name', ] params += super(CommodityError, self).json_params() return params
[docs] class Equity(Asset):
[docs] def __init__(self, borrow_curve=None, dividends=None, fixings=None, futures_date=None, futures_price=None, fx_cross_map=None, holiday_calendar=None, name=None, provider_id=None, reference_date=None, roll_fixing=None, settlement_lag=None, yield_curve=None, index_premium=None): """ :param borrow_curve: The borrow curve :param dividends: The dividends :param fixings: The fixings :param futures_date: The futures date :param futures_price: The futures price :param fx_cross_map: The fx cross map :param holiday_calendar: The holiday calendar :param name: The name :param provider_id: The provider id :param reference_date: The reference date :param roll_fixing: The roll fixing :param settlement_lag: The settlement lag :param yield_curve: The yield curve :param index_premium: The index premium """ self.borrow_curve = borrow_curve self.dividends = dividends self.fixings = fixings self.futures_date = futures_date self.futures_price = futures_price self.fx_cross_map = fx_cross_map self.holiday_calendar = holiday_calendar self.name = name self.roll_fixing = roll_fixing self.settlement_lag = settlement_lag self.yield_curve = yield_curve self.index_premium = index_premium super(Equity, self).__init__( provider_id=provider_id, reference_date=reference_date)
def json_params(self): params = [ 'borrow_curve', 'dividends', 'fixings', 'futures_date', 'futures_price', 'fx_cross_map', 'holiday_calendar', 'name', 'roll_fixing', 'settlement_lag', 'yield_curve', 'index_premium' ] params += super(Equity, self).json_params() return params
[docs] class CmdtyVolSurface(VolatilitySurfaceSvi): class SpotModel(IntEnum): StickyDelta = 1 StickyStrike = 0 StickySmileRatio = 2
[docs] def __init__(self, benchmark_fwd_factors=None, benchmark_maturities=None, call_wings=None, commodity_id=None, provider_id=None, put_wings=None, reference_date=None, skews=None, smiles=None, spot_ref=None, strike_type=None, vols=None): """ :param benchmark_fwd_factors: The benchmark fwd factors :param benchmark_maturities: The benchmark maturities :param call_wings: The call wings :param commodity_id: The commodity id :param provider_id: The provider id :param put_wings: The put wings :param reference_date: The reference date :param skews: The skews :param smiles: The smiles :param spot_ref: The spot ref :param strike_type: The strike type :param vols: The vols """ self.commodity_id = commodity_id super(CmdtyVolSurface, self).__init__( benchmark_fwd_factors=benchmark_fwd_factors, benchmark_maturities=benchmark_maturities, call_wings=call_wings, provider_id=provider_id, put_wings=put_wings, reference_date=reference_date, skews=skews, smiles=smiles, spot_ref=spot_ref, strike_type=strike_type, vols=vols)
def json_params(self): params = [ 'commodity_id', ] params += super(CmdtyVolSurface, self).json_params() return params
[docs] class EquityVolSurface(MarketData): class SpotModel(IntEnum): StickyDelta = 1 StickyStrike = 0 StickySmileRatio = 2 class StrikeType(IntEnum): LogarithmicSpot = 3 Normalized = 2 Logarithmic = 1 Absolute = 0
[docs] def __init__(self, asset_name=None, benchmark_fwd_factors=None, benchmark_maturities=None, provider_id=None, reference_date=None, spot_ref=None): """ :param asset_name: The asset name :param benchmark_fwd_factors: The benchmark fwd factors :param benchmark_maturities: The benchmark maturities :param provider_id: The provider id :param reference_date: The reference date :param spot_ref: The spot ref """ self.asset_name = asset_name self.benchmark_fwd_factors = benchmark_fwd_factors self.benchmark_maturities = benchmark_maturities self.reference_date = reference_date self.spot_ref = spot_ref super(EquityVolSurface, self).__init__(provider_id=provider_id)
def json_params(self): params = [ 'asset_name', 'benchmark_fwd_factors', 'benchmark_maturities', 'reference_date', 'spot_ref' ] params += super(EquityVolSurface, self).json_params() return params
[docs] class EquityVolSurfaceSvi(EquityVolSurface):
[docs] def __init__(self, asset_name=None, benchmark_fwd_factors=None, benchmark_maturities=None, call_wings=None, provider_id=None, put_wings=None, reference_date=None, skews=None, smiles=None, spot_ref=None, vols=None): """ :param asset_name: The asset name :param benchmark_fwd_factors: The benchmark fwd factors :param benchmark_maturities: The benchmark maturities :param call_wings: The call wings :param provider_id: The provider id :param put_wings: The put wings :param reference_date: The reference date :param skews: The skews :param smiles: The smiles :param spot_ref: The spot ref :param vols: The vols """ self.call_wings = call_wings self.put_wings = put_wings self.skews = skews self.smiles = smiles self.vols = vols super(EquityVolSurfaceSvi, self).__init__( asset_name=asset_name, benchmark_fwd_factors=benchmark_fwd_factors, benchmark_maturities=benchmark_maturities, provider_id=provider_id, reference_date=reference_date, spot_ref=spot_ref)
def json_params(self): params = [ 'call_wings', 'put_wings', 'skews', 'smiles', 'vols' ] params += super(EquityVolSurfaceSvi, self).json_params() return params
[docs] class EquityVolSurfaceSpline(EquityVolSurface):
[docs] def __init__(self, asset_name=None, benchmark_fwd_factors=None, benchmark_maturities=None, provider_id=None, reference_date=None, strike_grid=None, spot_ref=None, var_grid=None): """ :param asset_name: The asset name :param benchmark_fwd_factors: The benchmark fwd factors :param benchmark_maturities: The benchmark maturities :param provider_id: The provider id :param reference_date: The reference date :param strike_grid: The strike grid :param spot_ref: The spot ref :param var_grid: The variance grid """ self.strike_grid = strike_grid self.var_grid = var_grid super(EquityVolSurfaceSpline, self).__init__( asset_name=asset_name, benchmark_fwd_factors=benchmark_fwd_factors, benchmark_maturities=benchmark_maturities, provider_id=provider_id, reference_date=reference_date, spot_ref=spot_ref)
def json_params(self): params = [ 'var_grid', 'strike_grid', ] params += super(EquityVolSurfaceSpline, self).json_params() return params
[docs] class EquityVolIndexVolSurface(VolatilitySurfaceSvi): class SpotModel(IntEnum): StickyDelta = 1 StickyStrike = 0
[docs] def __init__(self, eq_vol_index_id=None, benchmark_fwd_factors=None, benchmark_maturities=None, call_wings=None, provider_id=None, put_wings=None, reference_date=None, skews=None, smiles=None, spot_ref=None, strike_type=None, vols=None): """ :param eq_vol_index_id: The vol index id :param benchmark_fwd_factors: The benchmark fwd factors :param benchmark_maturities: The benchmark maturities :param call_wings: The call wings :param provider_id: The provider id :param put_wings: The put wings :param reference_date: The reference date :param skews: The skews :param smiles: The smiles :param spot_ref: The spot ref :param strike_type: The strike type :param vols: The vols """ self.eq_vol_index_id = eq_vol_index_id super(EquityVolIndexVolSurface, self).__init__( benchmark_fwd_factors=benchmark_fwd_factors, benchmark_maturities=benchmark_maturities, call_wings=call_wings, provider_id=provider_id, put_wings=put_wings, reference_date=reference_date, skews=skews, smiles=smiles, spot_ref=spot_ref, strike_type=strike_type, vols=vols)
def json_params(self): params = [ 'eq_vol_index_id', ] params += super(EquityVolIndexVolSurface, self).json_params() return params
[docs] class EquityVolOfVarCurve(VolCurve): """Equity volatility-of-variance term curve used by analytic volatility swaps. The identifier is the underlying equity/index (e.g. ``ric(".SPX")``). Maturities are increasing positive calendar-day offsets from reference_date. Vols are corresponding positive decimal values (0.40 means 40%). Uploads select the destination at request level; provider_id records the source when reading. These are not the ordinary EquityVolCurve inputs. """
[docs] def __init__(self, eq_vol_of_var_index_id=None, reference_date=None, maturities=None, vols=None, provider_id=None): self.eq_vol_of_var_index_id = eq_vol_of_var_index_id super().__init__(provider_id=provider_id, maturities=maturities, reference_date=reference_date, vols=vols)
def json_params(self): return ['eq_vol_of_var_index_id'] + super().json_params()
[docs] class EquityVolCurve(VolCurve):
[docs] def __init__(self, provider_id=None, asset_id=None, maturities=None, reference_date=None, vols=None): """ :param provider_id: The provider id :param asset_id: The asset id :param maturities: The benchmark maturities :param reference_date: The reference date :param vols: The vols """ self.asset_id = asset_id super(EquityVolCurve, self).__init__( provider_id=provider_id, maturities=maturities, reference_date=reference_date, vols=vols)
def json_params(self): params = [ 'asset_id', ] params += super(EquityVolCurve, self).json_params() return params
[docs] class EquityVolGrid(VolGrid):
[docs] def __init__(self, provider_id=None, asset_id=None, reference_date=None, maturities=None, strike_type=None, strikes=None, vols=None, use_spline=None, spot_ref=None): """ :param provider_id: The provider id :param asset_id: The asset id :param reference_date: The reference date :param maturities: The benchmark maturities :param strike_type: The strike type :param strikes: The strikes :param vols: The vols :param use_spline: The use spline flag :param spot_ref: The spot ref. spot_ref is used for vol surface construction only (i.e. to convert the supplied vol grid into z-space). It is distinct from equity_vol_surface_spot_model on the MarketDataOverride, which controls how the vol surface slides when a spot override is supplied. When both a spot override and a vol grid override are present, equity_vol_surface_spot_model only makes a difference if the spot_ref embedded in the vol grid differs from the spot override. """ self.asset_id = asset_id super(EquityVolGrid, self).__init__( provider_id=provider_id, reference_date=reference_date, maturities=maturities, strike_type=strike_type, strikes=strikes, vols=vols, use_spline=use_spline, spot_ref=spot_ref)
@staticmethod def FromFlatVol(asset_id, reference_date, vol): return EquityVolGrid( asset_id=asset_id, reference_date=reference_date, maturities=[365], strike_type=VolGrid.StrikeType.PercentForward, strikes=[[100.0]], vols=[[vol]]) @staticmethod def FromVolCurve(asset_id, reference_date, maturities, vols): return EquityVolGrid( asset_id=asset_id, reference_date=reference_date, maturities=maturities, strike_type=VolGrid.StrikeType.PercentForward, strikes=[[100.0] for _ in maturities], vols=[[vol] for vol in vols]) def json_params(self): params = [ 'asset_id', ] params += super(EquityVolGrid, self).json_params() return params
[docs] class EqVolSurfaceBump(MarketDataType):
[docs] def __init__(self, maturities=None, tenors=None, vol_bumps=None, vol_bump=None, use_proportional_vol_bumps=None, bumped_vol_floor=None): """ :param maturities: The maturities :param tenors: The tenors :param vol_bumps: vol bumps for each maturity/tenor :param use_proportional_vol_bumps: The use_proportional_vol_bumps flag :param bumped_vol_floor: The bumped_vol_floor flag """ self.maturities = maturities self.tenors = tenors self.vol_bumps = vol_bumps self.vol_bump = vol_bump self.use_proportional_vol_bumps = use_proportional_vol_bumps self.bumped_vol_floor = bumped_vol_floor
def json_params(self): params = [ 'maturities', 'tenors', 'vol_bumps', 'vol_bump', 'use_proportional_vol_bumps', 'bumped_vol_floor' ] return params
[docs] class EqVolIndexVolSurfaceBump(MarketDataType):
[docs] def __init__(self, vol_bump=None, use_proportional_vol_bumps=None, use_parallel_shift=None, bumped_vol_floor=None): """ :param vol_bump: The parallel vol bump :param use_proportional_vol_bumps: True to use proportional vol bumps (i.e. a bump of 0.1 means 30% -> 33%; otherwise 30% -> 31%) :param use_parallel_shift: True to use parallel shifts :param bumped_vol_floor: ATMF vol will never be bumped lower than this """ self.vol_bump = vol_bump self.use_proportional_vol_bumps = use_proportional_vol_bumps self.use_parallel_shift = use_parallel_shift self.bumped_vol_floor = bumped_vol_floor
def json_params(self): params = [ 'vol_bump', 'use_proportional_vol_bumps', 'use_parallel_shift', 'bumped_vol_floor' ] return params
[docs] class EquityVolIndexSpreadCurveBump(MarketDataType):
[docs] def __init__(self, maturities=None, spread_bumps=None): """ :param maturities: List of maturities :param spread_bumps: List of spread bumps """ self.maturities = maturities self.spread_bumps = spread_bumps
def json_params(self): params = [ 'maturities', 'spread_bumps' ] return params
[docs] class EquityBump(MarketDataType):
[docs] def __init__(self, spot_bump=None, discount_curve_bump=None, borrow_curve_bump=None, dividend_bump=None, asset_id=None): """ :param spot_bump: Spot bump (float) :param discount_curve_bump: Discount curve bump (DiscountCurveBump instance) :param borrow_curve_bump: Borrow curve bump (DiscountCurveBump instance) :param dividend_bump: Dividend bump (DividendBump instance) :param asset_id: Asset identifier (string) """ self.spot_bump = spot_bump self.discount_curve_bump = discount_curve_bump self.borrow_curve_bump = borrow_curve_bump self.dividend_bump = dividend_bump self.asset_id = asset_id
def json_params(self): params = [ 'spot_bump', 'discount_curve_bump', 'borrow_curve_bump', 'dividend_bump', 'asset_id' ] return params
[docs] class EquityVolIndexBump(MarketDataType):
[docs] def __init__(self, equity_bump=None, equity_vol_surface_bump=None, spread_curve_bump=None, spot_bump=None, use_proportional_vol_bumps=None): """ :param equity_bump: Equity bump :param vol_surface_bump: Vol surface bump :param spread_curve_bump: Spread curve bump :param spot_bump: Spot bump :param use_proportional_vol_bumps: The use_proportional_vol_bumps flag """ self.equity_bump = equity_bump self.equity_vol_surface_bump = equity_vol_surface_bump self.spread_curve_bump = spread_curve_bump self.spot_bump = spot_bump self.use_proportional_vol_bumps = use_proportional_vol_bumps
def json_params(self): params = [ 'equity_bump', 'equity_vol_surface_bump', 'spread_curve_bump', 'spot_bump', 'use_proportional_vol_bumps' ] return params
[docs] class FxVolSurface(VolatilitySurfaceSvi): class SpotModel(IntEnum): StickyDelta = 1 StickyStrike = 0
[docs] def __init__(self, benchmark_fwd_factors=None, benchmark_maturities=None, call_wings=None, fx_pair=None, is_quoted_fx_vol=None, provider_id=None, put_wings=None, reference_date=None, skews=None, smiles=None, spot_ref=None, strike_type=None, vols=None): """ :param benchmark_fwd_factors: The benchmark fwd factors :param benchmark_maturities: The benchmark maturities :param call_wings: The call wings :param fx_pair: The fx pair :param is_quoted_fx_vol: The is quoted fx vol :param provider_id: The provider id :param put_wings: The put wings :param reference_date: The reference date :param skews: The skews :param smiles: The smiles :param spot_ref: The spot ref :param strike_type: The strike type :param vols: The vols """ self.fx_pair = fx_pair self.is_quoted_fx_vol = is_quoted_fx_vol super(FxVolSurface, self).__init__( benchmark_fwd_factors=benchmark_fwd_factors, benchmark_maturities=benchmark_maturities, call_wings=call_wings, provider_id=provider_id, put_wings=put_wings, reference_date=reference_date, skews=skews, smiles=smiles, spot_ref=spot_ref, strike_type=strike_type, vols=vols)
def json_params(self): params = [ 'fx_pair', 'is_quoted_fx_vol', ] params += super(FxVolSurface, self).json_params() return params
[docs] class Commodity(Asset):
[docs] def __init__(self, commodity_id=None, convenience_yield_curve=None, discount_curve=None, fixings=None, futures_date=None, futures_price=None, provider_id=None, reference_date=None, roll_fixing=None, settlement_calendar=None, settlement_lag=None): """ :param commodity_id: The commodity id :param convenience_yield_curve: The convenience yield curve :param discount_curve: The discount curve :param fixings: The fixings :param futures_date: The futures date :param futures_price: The futures price :param provider_id: The provider id :param reference_date: The reference date :param roll_fixing: The roll fixing :param settlement_calendar: The settlement calendar :param settlement_lag: The settlement lag """ self.commodity_id = commodity_id self.convenience_yield_curve = convenience_yield_curve self.discount_curve = discount_curve self.fixings = fixings self.futures_date = futures_date self.futures_price = futures_price self.roll_fixing = roll_fixing self.settlement_calendar = settlement_calendar self.settlement_lag = settlement_lag super(Commodity, self).__init__( provider_id=provider_id, reference_date=reference_date)
def json_params(self): params = [ 'commodity_id', 'convenience_yield_curve', 'discount_curve', 'fixings', 'futures_date', 'futures_price', 'roll_fixing', 'settlement_calendar', 'settlement_lag', ] params += super(Commodity, self).json_params() return params
[docs] class FxCross(Asset):
[docs] def __init__(self, domestic_discount_curve=None, fixings_by_source=None, foreign_discount_curve=None, fx_pair=None, high_fixings_by_source=None, is_quoted_fx_cross=None, low_fixings_by_source=None, provider_id=None, reference_date=None, roll_fixing=None, settlement=None, spot=None): """ :param domestic_discount_curve: The domestic discount curve :param fixings_by_source: The fixings by source :param foreign_discount_curve: The foreign discount curve :param fx_pair: The fx pair :param high_fixings_by_source: The high fixings by source :param is_quoted_fx_cross: The is quoted fx cross :param low_fixings_by_source: The low fixings by source :param provider_id: The provider id :param reference_date: The reference date :param roll_fixing: The roll fixing :param settlement: The settlement :param spot: The spot """ self.domestic_discount_curve = domestic_discount_curve self.fixings_by_source = fixings_by_source self.foreign_discount_curve = foreign_discount_curve self.fx_pair = fx_pair self.high_fixings_by_source = high_fixings_by_source self.is_quoted_fx_cross = is_quoted_fx_cross self.low_fixings_by_source = low_fixings_by_source self.roll_fixing = roll_fixing self.settlement = settlement self.spot = spot super(FxCross, self).__init__( provider_id=provider_id, reference_date=reference_date)
def json_params(self): params = [ 'domestic_discount_curve', 'fixings_by_source', 'foreign_discount_curve', 'fx_pair', 'high_fixings_by_source', 'is_quoted_fx_cross', 'low_fixings_by_source', 'roll_fixing', 'settlement', 'spot', ] params += super(FxCross, self).json_params() return params
[docs] class FxVolGrid(MarketData):
[docs] def __init__(self, fx_pair=None, reference_date=None, tenors=None, deltas=None, vols=None, provider_id=None, spot_ref=None): """ :param fx_pair: The fx pair :param reference_date: The reference date :param tenors: The tenors :param deltas: The deltas :param vols: vols :param provider_id: The provider id :param spot_ref: The spot ref. spot_ref is used for vol surface construction only (i.e. to convert the supplied vol grid into z-space). It is distinct from equity_vol_surface_spot_model on the MarketDataOverride, which controls how the vol surface slides when a spot override is supplied. When both a spot override and a vol grid override are present, equity_vol_surface_spot_model only makes a difference if the spot_ref embedded in the vol grid differs from the spot override. """ self.fx_pair = fx_pair self.reference_date = reference_date self.tenors = tenors self.deltas = deltas self.vols = vols self.spot_ref = spot_ref super(FxVolGrid, self).__init__( provider_id=provider_id)
def json_params(self): params = [ 'fx_pair', 'reference_date', 'tenors', 'deltas', 'vols', 'spot_ref', ] params += super(FxVolGrid, self).json_params() return params
[docs] class EquityVolIndex(Asset):
[docs] def __init__(self, annualisation_factor=None, days_to_maturity=None, eq_asset_id=None, eq_vol_index_id=None, equity=None, equity_vol_surface=None, fixings=None, log_spot_step_size=None, max_log_spot=None, min_log_spot=None, name=None, provider_id=None, reference_date=None): """ :param annualisation_factor: The annualisation factor :param days_to_maturity: The days to maturity :param eq_asset_id: The eq asset id :param eq_vol_index_id: The eq vol index id :param equity: The equity :param equity_vol_surface: The equity vol surface :param fixings: The fixings :param log_spot_step_size: The log spot step size :param max_log_spot: The max log spot :param min_log_spot: The min log spot :param name: The name :param provider_id: The provider id :param reference_date: The reference date """ self.annualisation_factor = annualisation_factor self.days_to_maturity = days_to_maturity self.eq_asset_id = eq_asset_id self.eq_vol_index_id = eq_vol_index_id self.equity = equity self.equity_vol_surface = equity_vol_surface self.fixings = fixings self.log_spot_step_size = log_spot_step_size self.max_log_spot = max_log_spot self.min_log_spot = min_log_spot self.name = name super(EquityVolIndex, self).__init__( provider_id=provider_id, reference_date=reference_date)
def json_params(self): params = [ 'annualisation_factor', 'days_to_maturity', 'eq_asset_id', 'eq_vol_index_id', 'equity', 'equity_vol_surface', 'fixings', 'log_spot_step_size', 'max_log_spot', 'min_log_spot', 'name', ] params += super(EquityVolIndex, self).json_params() return params
[docs] class DividendIndexVolSurface(VolatilitySurfaceSvi):
[docs] def __init__(self, dividend_index_id=None, benchmark_fwd_factors=None, benchmark_maturities=None, call_wings=None, provider_id=None, put_wings=None, reference_date=None, skews=None, smiles=None, spot_ref=None, strike_type=None, vols=None, futures_code=None): """ :param dividend_index_id: The asset name :param benchmark_fwd_factors: The benchmark fwd factors :param benchmark_maturities: The benchmark maturities :param call_wings: The call wings :param provider_id: The provider id :param put_wings: The put wings :param reference_date: The reference date :param skews: The skews :param smiles: The smiles :param spot_ref: The spot ref :param strike_type: The strike type :param vols: The vols :param futures_code: the futures code """ self.dividend_index_id = dividend_index_id self.futures_code = futures_code super(DividendIndexVolSurface, self).__init__( benchmark_fwd_factors=benchmark_fwd_factors, benchmark_maturities=benchmark_maturities, call_wings=call_wings, provider_id=provider_id, put_wings=put_wings, reference_date=reference_date, skews=skews, smiles=smiles, spot_ref=spot_ref, strike_type=strike_type, vols=vols)
def json_params(self): params = [ 'dividend_index_id', 'futures_code' ] params += super(DividendIndexVolSurface, self).json_params() return params
[docs] class EntityCustomData(MarketData):
[docs] def __init__(self, issuer_identifier=None, instrument_identifier=None, country_of_risk=None, credit_rating=None, region_of_risk=None, sector=None, provider_id=None): """ :param issuer_identifier: The entity issuer identifier :param instrument_identifier: The instrument identifier :param country_of_risk: The country of risk :param credit_rating: The credit rating :param region_of_risk: The region of risk :param sector: The sector """ self.issuer_identifier = issuer_identifier self.instrument_identifier = instrument_identifier self.country_of_risk = country_of_risk self.credit_rating = credit_rating self.region_of_risk = region_of_risk self.sector = sector super(EntityCustomData, self).__init__( provider_id=provider_id)
def json_params(self): params = [ 'issuer_identifier', 'instrument_identifier', 'country_of_risk', 'credit_rating', 'region_of_risk', 'sector', ] params += super(EntityCustomData, self).json_params() return params
[docs] class AndersenBuffumParameters(MarketData):
[docs] def __init__(self, andersen_buffum_alpha=None, andersen_buffum_benchmark_spot=None, asset_name=None, reference_date=None, provider_id=None): """ :param andersen_buffum_alpha: The andersen buffum alpha :param andersen_buffum_benchmark_spot: The andersen buffum benchmark spot :param asset_name: The asset name :param reference_date: The reference date :param provider_id: The provider id """ self.andersen_buffum_alpha = andersen_buffum_alpha self.andersen_buffum_benchmark_spot = andersen_buffum_benchmark_spot self.asset_name = asset_name self.reference_date = reference_date self.provider_id = provider_id super(AndersenBuffumParameters, self).__init__( provider_id=provider_id)
def json_params(self): params = [ 'andersen_buffum_alpha', 'andersen_buffum_benchmark_spot', 'asset_name', 'reference_date', ] params += super(AndersenBuffumParameters, self).json_params() return params
[docs] class CorrelationData(MarketData):
[docs] def __init__(self, correlation=None, date=None, provider_id=None): """ :param date: The date :param correlation: The correlation """ self.correlation = correlation self.date = date super(CorrelationData, self).__init__(provider_id=provider_id)
def json_params(self): params = [ 'correlation', 'date' ] params += super(CorrelationData, self).json_params() return params
[docs] class EquityFxCorrelationData(CorrelationData):
[docs] def __init__(self, equity_identifier=None, currency=None, correlation=None, date=None, provider_id=None): """ :param equity_identifier: the equity identifier :param currency: the contract currency :param date: The date :param correlation: The correlation """ self.equity_identifier = equity_identifier self.currency = currency self.correlation = correlation super(EquityFxCorrelationData, self).__init__(correlation=correlation, date=date, provider_id=provider_id)
def json_params(self): params = [ 'equity_identifier', 'currency' ] params += super(EquityFxCorrelationData, self).json_params() return params
[docs] class EquityFxCorrelationDescriptor(MarketDataType):
[docs] def __init__(self, equity_identifier=None, currency=None): """ :param equity_identifier: the equity identifier :param currency: the contract currency """ self.equity_identifier = equity_identifier self.currency = currency
def json_params(self): params = [ 'equity_identifier', 'currency' ] return params
[docs] class EquityDividendCorrelationData(MarketData):
[docs] def __init__(self, equity_asset_identifier=None, dividend_asset_identifier=None, correlation=None, provider_id=None): """ :param equity_asset_identifier: The equity asset identifier :param dividend_asset_identifier: The dividend asset identifier :param correlation: The correlation """ self.equity_asset_identifier = equity_asset_identifier self.dividend_asset_identifier = dividend_asset_identifier self.correlation = correlation super(EquityDividendCorrelationData, self).__init__( provider_id=provider_id)
def json_params(self): params = [ 'equity_asset_identifier', 'dividend_asset_identifier', 'correlation', ] params += super(EquityDividendCorrelationData, self).json_params() return params
[docs] class EquityEquityCorrelationData(CorrelationData):
[docs] def __init__(self, asset1_identifier=None, asset2_identifier=None, correlation=None, date=None, provider_id=None): """ :param asset1_identifier: The equity asset 1 identifier :param asset2_identifier: The equity asset 2 identifier :param correlation: The correlation :param date: The date :param provider_id: The provider id """ self.asset1_identifier = asset1_identifier self.asset2_identifier = asset2_identifier super(EquityEquityCorrelationData, self).__init__( correlation=correlation, date=date, provider_id=provider_id)
def json_params(self): params = [ 'asset1_identifier', 'asset2_identifier', ] params += super(EquityEquityCorrelationData, self).json_params() return params
[docs] class EquityEquityCorrelationDescriptor(MarketDataType):
[docs] def __init__(self, asset1_identifier=None, asset2_identifier=None): """ :param asset1_identifier: The equity asset 1 identifier :param asset2_identifier: The equity asset 2 identifier """ self.asset1_identifier = asset1_identifier self.asset2_identifier = asset2_identifier
def json_params(self): params = [ 'asset1_identifier', 'asset2_identifier', ] return params
[docs] class EquityIrCorrelationData(MarketData):
[docs] def __init__(self, equity_identifier=None, ir_instrument_identifier=None, correlation=None, provider_id=None): """ :param equity_identifier: The equity asset identifier :param ir_instrument_identifier: The ir instrument identifier :param correlation: The correlation """ self.equity_identifier = equity_identifier self.ir_instrument_identifier = ir_instrument_identifier self.correlation = correlation super(EquityIrCorrelationData, self).__init__( provider_id=provider_id)
def json_params(self): params = [ 'equity_identifier', 'ir_instrument_identifier', 'correlation', ] params += super(EquityIrCorrelationData, self).json_params() return params
[docs] class FxIrCorrelationData(MarketData):
[docs] def __init__(self, fx_pair=None, ir_instrument_identifier=None, correlation=None, provider_id=None): """ :param fx_pair: The fx pair :param ir_instrument_identifier: The ir instrument identifier :param correlation: The correlation """ self.fx_pair = fx_pair self.ir_instrument_identifier = ir_instrument_identifier self.correlation = correlation super(FxIrCorrelationData, self).__init__( provider_id=provider_id)
def json_params(self): params = [ 'fx_pair', 'ir_instrument_identifier', 'correlation', ] params += super(FxIrCorrelationData, self).json_params() return params
[docs] class ProbabilityOfDefaultData(MarketData):
[docs] def __init__(self, probability_of_default=None, asset_id=None, date=None, provider_id=None): """ :param probability_of_default: The probability of default :param asset_id: The asset id :param date: The market date """ self.probability_of_default = probability_of_default self.asset_id = asset_id self.date = date super(ProbabilityOfDefaultData, self).__init__( provider_id=provider_id)
def json_params(self): params = [ 'probability_of_default', 'asset_id', 'date' ] params += super(ProbabilityOfDefaultData, self).json_params() return params
[docs] class AmortisationRateData(MarketData):
[docs] def __init__(self, amortisation_rate=None, asset_id=None, date=None, provider_id=None): """ :param amortisation_rate: The amortisation rate :param date: The market date :param asset_id: The asset id """ self.amortisation_rate = amortisation_rate self.date = date self.asset_id = asset_id super(AmortisationRateData, self).__init__( provider_id=provider_id)
def json_params(self): params = [ 'amortisation_rate', 'date', 'asset_id' ] params += super(AmortisationRateData, self).json_params() return params
[docs] class RecoveryRateData(MarketData):
[docs] def __init__(self, rate=None, reference_bond_id=None, issuer_id=None, date=None, provider_id=None): """ :param rate: The recovery rate :param reference_bond_id: The reference bond id :param issuer_id: The issuer id :param date: The market date """ self.rate = rate self.reference_bond_id = reference_bond_id self.issuer_id = issuer_id self.date = date super(RecoveryRateData, self).__init__( provider_id=provider_id)
def json_params(self): params = [ 'rate', 'reference_bond_id', 'issuer_id', 'date' ] params += super(RecoveryRateData, self).json_params() return params