FXOTCOptionsGroup#

class sigtech.framework.instruments.option_groups.FXOTCOptionsGroup

A class representing OTC FX option groups.

over-under convention: - number of ‘over’ units needed to buy/per 1 ‘under’ unit.

over: str
under: str
delta_spot_type: str
delta_forward_type: str
get_option_group_dependencies(t: datetime.time, tz: datetime.tzinfo, valuation_currency: str, start_dt: datetime.datetime, end_dt: datetime.datetime, greek_calculation_dependencies: bool = False) list[sigtech.framework.internal.infra.mu.graph.registry.factory.Dependency]

Dependencies at the option group level

convert_maturity_tenor_to_delivery_date(reference_date, maturity_tenor)

Convert a maturity tenor identifier to a delivery date.

Parameters
  • reference_date – Reference dats.

  • maturity_tenor – Maturity tenor identifier.

Returns

datetime date.

discount_curves(data_dates, data_point=None)

Discount curves used for the options discounting.

Parameters
  • data_dates – List of dates.

  • data_point – Input data point (optional).

Returns

Discount curves.

discount_curve(data_date, data_point=None)

Discount curve used for the options discounting.

Parameters
  • data_date – Input date.

  • data_point – Input data point (optional).

Returns

Discount curve.

forward_prices(data_dates, maturity, **kwargs)

Maturity-corresponding future (or more generally next future at or after maturity) quote as seen on data_dates.

Parameters
  • data_dates – List of input dates.

  • maturity – Input maturity.

Returns

List of future quotes.

spot_values(data_dates, data_point=None)

Spot values at points in time.

Parameters
  • data_dates – Input dates.

  • data_point – Data point (optional).

Returns

List of spot values.

static curves_series(currency, data_point=None, data_dates=None)

Curve series at points in time.

Parameters
  • currency – Currency identifier.

  • data_dates – Input dates.

  • data_point – Data point (optional).

Returns

Curve series.

strike_from_delta(option_type, delta_strike, quote_date, maturity_date, data_based=False, delta_type=None, data_point=None, vol_handle=None)

Option strike from delta.

Parameters
  • option_type – Type of option.

  • delta_strike – Delta strike.

  • quote_date – Quote date.

  • maturity_date – Maturity date.

  • data_based – Compute strike from data (optional, default to False).

  • delta_type – Type of delta (optional).

  • data_point – Data point (optional).

  • vol_handle – Vol surface series (optional).

Returns

Option strike.

delta_vol_from_strike(option_type, strike, quote_date, maturity_date, vol=None, data_based=False, delta_type=None, data_point=None, vol_handle=None)

Given strike, find option delta such that when the volatility interpolated on the delta axis is used in Black formula, if gives delta within given tolerance (fixed at 0.01), and bounded by 0.99 (as the maximal delta stored in the surface is 0.95 anyway). If data_based is set to True, strike interpolation is used to get volatility.

vol_from_strike(option_type, strike, quote_date, maturity_date, interpolation_mode='Delta', mode='mid', data_point=None, vol_handle=None)

Compute volatility from strike.

Parameters
  • option_type – Type of option.

  • strike – Quote strike.

  • quote_date – Quote date.

  • maturity_date – Maturity date.

  • interpolation_mode – Interpolation mode (optional, default is 'Delta').

  • mode – Mode (optional, default is 'mid').

  • data_point – Data point (optional).

  • vol_handle – Volatility timeseries (optional).

Returns

Volatility value.

atm_from_type(option_type, quote_dt, maturity_date, atm_type)

ATM strike value from option parameters.

Parameters
  • option_type – Type of option.

  • quote_dt – Quote date.

  • maturity_date – Maturity date.

  • atm_type – ATM quote type (e.g. 'SPOT' or 'FWD').

Returns

Strike value.

convert_delta(option_type, delta, quote_date, maturity_date, vol, to_delta_type, from_delta_type=None, to_option_type=None, data_point=None)

Delta conversion.

Parameters
  • option_type – Type of option.

  • delta – Input delta.

  • quote_date – Quote date.

  • maturity_date – Maturity date.

  • vol – Annualised volatility.

  • to_delta_type – Target type of delta.

  • from_delta_type – Source type of delta (optional).

  • to_option_type – Target option type (optional).

  • data_point – Data point (optional).

Returns

Converted delta.

is_foreign_premium()

Returns true if the option premium is paid in ‘under’ currency, i.e. option quote currency is different from the pair quote currency. In this case the delta is premium adjusted.

get_option(option_type: str, strike: Union[float, str], start_date: datetime.date, maturity: Union[datetime.date, str], strike_type: str = 'Price', exercise_type='European', target_maturity_weekday: Optional[str] = None, is_imm_maturity: Optional[bool] = None, strike_date: Optional[Union[datetime.date, datetime.datetime]] = None, **kwargs)

The nearest option available for a given type of option, strike and start+maturity date.

Parameters
  • option_type'Call' or 'Put'.

  • strike – Strike of option in either price or delta terms, or ATM offset, e.g. 'ATM+5%'

  • start_date – Strike date of the option, unless strike_date is passed. Start of the history.

  • maturity – Maturity date of the option or maturity tenor key such as '3M'.

  • strike_type'Price', 'Delta' or 'Premium' (defaults to price). Could also be ATM type - one of 'SPOT', 'FWD', or 'DN'

  • exercise_type'European' or 'American' (defaults to ‘European’).

  • target_maturity_weekday – Weekday used for target maturity (optional).

  • is_imm_maturity – Flag for usage of IMM dates (optional).

  • strike_date – Strike date of the option. If None (default), start_date is used (optional).

Returns

The nearest option available given the inputs.

static get_group(pair: str) sigtech.framework.instruments.option_groups.FXOTCOptionsGroup

Creates an FX OTC OPTION GROUP on-the-fly for a given currency pair. Method is agnostic to convention, i.e. AUDUSD and USDAUD will return the same group.

Parameters

pair – Convention-agnostic currency pair to generate OTC option group for.

Returns

OTC option group created on-the-fly for given FX pair.

property available_data_points

Data points available for this instrument.

available_data_providers(entitled_only=True) Optional[List[str]]

Available data providers for this object. Bool to return entitled providers only

property cache_name: str

Cache name of this object.

property class_name

Class name of this object.

property class_short_name

Short name of the object class.

clear_cached_data()

Clear all the cached data of the object.

clone_object(params=None)

Return a clone of the object with amended parameters.

Parameters

params – Optional dictionary of parameters to override.

Returns

New object.

compute_dependencies(root_dependency: Optional[sigtech.framework.internal.infra.mu.graph.registry.factory.Dependency] = None)

Compute these dependencies - triggers MDS requests

static convert_dtypes(clz)

Class decorator to convert classes’ BaseType into variable annotations (PEP-526), and to generate __aliases__ based on BaseType.db_name when required.

convert_maturity_tenor_to_date(reference_date: datetime.date, maturity_tenor: str, **kwargs) datetime.date

Convert a maturity tenor identifier to a date.

Parameters
  • reference_date – Reference dats.

  • maturity_tenor – Maturity tenor identifier.

Returns

datetime date.

data_dict()

Return the object attributes in a dict.

property data_source: str

Field used when retrieving history.

property default_data_point

Default data points for this instrument.

dependencies(input_dependency: Optional[sigtech.framework.internal.infra.mu.graph.registry.factory.Dependency] = None, valuation_currency: Optional[str] = None, use_start: bool = True) list[sigtech.framework.internal.infra.mu.graph.registry.factory.Dependency]

Returns a list of Dependency

Parameters
  • input_dependency – A Dependency object representing the root of the dependency tree to be returned.

  • valuation_currency – If supplied, include the dependencies required to output the data in this currency.

  • use_start – If False, return only dependencies required to calculate an earliest start date - self.start_date will be None in this case.

Returns

List of Dependency objects representing the current level in the dependency tree.

property dependency_type

Should return GraphNodeType. Return None to autodetect based on result of dependencies()

property env: sigtech.framework.config.config.ConfiguredEnvironment

Return the configured environment.

env_date_change(old_env_dt: datetime.datetime, new_env_dt: datetime.datetime, live_data_update=None)

Routine called after the environment date is changed.

Parameters
  • old_env_dt – Old datetime (tz aware).

  • new_env_dt – New datetime (tz aware).

  • live_data_update – Live streaming data associated with the environment date change.

exchange() Any

Exchange object where options are traded.

finalize_for_comparison()

Method to call to ensure all data dict values are finalized prior to doing object comparisons.

forward_price(data_date, maturity, **kwargs)

Maturity-corresponding future (or more generally next future at or after maturity) quote as seen on data_date.

Parameters
  • data_date – Input date.

  • maturity – Input maturity.

Returns

Future quote.

classmethod from_dictionary(dct: dict[str, Any], cache: bool = True, identifier: Optional[sigtech.framework.infra.data_adapter.identifier.Identifier] = None, env: Optional[sigtech.framework.config.config.ConfiguredEnvironment] = None, **kwargs)

Factory method to create object using data dictionary

classmethod from_underlying(underlying)

Return the object referenced by an underlying.

Parameters

underlying – Underlying identifier.

Returns

Object.

get_extra_fx_dependencies(valuation_currency: str, start_dt: datetime.datetime, end_dt: datetime.datetime, t: datetime.time, tz: datetime.tzinfo)

Extra dependencies for when the options are of a different currency to the strategy valuation currency

classmethod get_names(sort_by_group: Optional[bool] = False, include_db: Optional[bool] = True, include_local: Optional[bool] = True, include_children: Optional[bool] = False, ignore_unmapped: Optional[bool] = True) list[str]

Return an ordered list of object names associated with the class.

Parameters
  • sort_by_group – If set, the list is first ordered by sector/group, if applies, e.g. commodity or index futures (default is False).

  • include_db – If set, include objects available from the database (default is True).

  • include_local – If set, include objects available in the local environment (default is True).

  • include_children – If set, include objects available from child classes (default is False).

  • ignore_unmapped – If set, ignore errors due to unmapped database objects (default is True).

Returns

List of object names.

get_option_dependencies(start_date: datetime.date, maturity: Union[datetime.date, str], data_points: Optional[list[sigtech.framework.infra.data_adapter.common.DataPoint]] = None, **kwargs) list[sigtech.framework.internal.infra.mu.graph.registry.factory.Dependency]

Get Dependencies for the underlyings of an option with the given start and maturity dates

get_option_metrics(strike: float, maturity: str, start_date: datetime.date, end_date: Optional[datetime.date] = None, strike_type: str = 'Price', option_type: Optional[str] = None)

Function for computing series of PV and Greeks of daily rolling European option specified by the input parameters. In addition the function outputs strike (the price one regardless of the input format) and surface implied volatility for the input strike/maturity combination.

Parameters
  • strike – Price, delta strike or premium, depending on strike_type parameter

  • maturity – Option tenor maturity, e.g. '1M'

  • start_date – Start of the series

  • end_date – End of the series (environment asofdate used if omitted)

  • strike_type'Price' for price strike, 'Delta' for delta strike or 'Premium' for premium

  • option_type'Call' or 'Put' ('Call' by default, unless 'Delta' strike is negative)

Returns

get_vol_surface()

Object referenced by the vol surface name of the group.

get_vol_surface_series(data_dates, data_point=None)

Vol surface timeseries.

Parameters
  • data_dates – List of dates.

  • data_point – Data point (optional).

Returns

Vol surface timeseries.

property holidays: str

List of holiday calendars for this instrument.

property identifier: sigtech.framework.infra.data_adapter.identifier.Identifier

Return the object identifier.

info() dict

Return a dictionary with useful object information.

property input_parameters

Values of initial input parameters entered when creating the instance.

property internal_id

Ticker - i.e. part of name determining content of the class. For types with saved reference data - ticker will be self._ticker. For software types - ticker should be calculated.

property is_unmapped

Check if the object is not mapped.

property live_supported: bool

Flag for live supported objects.

property name

Primary name by which the FrameworkObject is identified. If reference information (or e.g. corresponding time series) are stored in the DB, then this name will be used.

option_name(option_type, strike, maturity_date, **kwargs)

Option group name.

Parameters
  • option_type'Call' or 'Put'.

  • strike – Strike of option.

  • maturity_date – Maturity date of the option.

Returns

str.

print_dependencies(root_dependency: Optional[sigtech.framework.internal.infra.mu.graph.registry.factory.Dependency] = None, resolve_future_dependencies: bool = True, fields: Optional[list] = None)

Pretty print dependency tree :param root_dependency: starting dependency of the tree. :param resolve_future_dependencies: resolve future dependencies before printing. If ‘false’ nothing get printed. :param fields: additional fields to extract from dependencies object. Default fields are product_type, currency, frequency and data_source. To get the list of available fields for an object you can use the data_dict() method.

property product_type

Return the product_type property of this object.

property publication_delay: str

Publication delay of data for this group.

query_instrument_names() list[str]

Generic doc store query to retrieve names of objects meeting filter criteria. :return: List of object names meeting filter criteria.

query_instruments() list[sigtech.framework.internal.infra.objects.core.framework_object.FrameworkObject]

Generic doc store query to retrieve objects meeting filter criteria. :return: List of objects meeting filter criteria

round_to_strike(strike: float) float

Strike adjustment for display purposes.

Parameters

strike – Input strike.

Returns

Adjusted strike.

property sector

Sector used on BBG, or the class ID for SIG instruments.

session_data()

Returns the raw Copp-Clarke trading sessions data for this group

settlement_object() Any

Object referenced by the settlement ticker.

static sort_key_static(name)

Convert a name to the sort key as of Portfolio Presentation Guidelines for performance reasons.

Parameters

name – Input name.

Returns

Tuple (sort key, length of sort key, input name).

spot_series(data_point=None)

Timeseries of the underlying.

Parameters

data_point – Input data point (optional).

Returns

pandas Series.

spot_value(data_date, data_point=None)

Spot value at a point in time.

Parameters
  • data_date – Point in time.

  • data_point – Data point (optional).

Returns

Spot value.

strike_from_price(price: float, date: datetime.date, maturity, option_type: str, data_point=None)

Find a strike corresponding to a given price of an option.

Parameters
  • price – Target option price.

  • date – Pricing date.

  • maturity – Option maturity (could be a datetime.date or a tenor like '1Y').

  • option_type – Option type, 'Call' or 'Put'.

  • data_point – Data point (optional, e.g. 'EOD').

Returns

Strike value.

textual_representation()

Return a printable representation of this object.

property underlying_asset_description: str

Return a string representing the underlying asset.

validate()

Validation routine adding checks that will be run on object creation.

valuation_dt(d: datetime.date) datetime.datetime

Valuation dt - datetime for a given valuation date. Included so we can supply this to TradingManager.data_point_from_time

property valuation_time

Valuation time for the instrument group Included so we can supply this to TradingManager.data_point_from_time

property valuation_tzinfo

Valuation time zone for the instrument group Included so we can supply this to TradingManager.data_point_from_time

vol_from_delta_history(expiry: Union[datetime.date, str], delta: float, start_date: datetime.date, end_date: Optional[datetime.date] = None, data_point: Optional[sigtech.framework.infra.data_adapter.common.DataPoint] = None)

Get time series of volatility corresponding to the given delta.

Parameters
  • expiry – Option expiry - either date (e.g. dtm.date(2021,2,3) for fixed tenor case, or tenor string (e.g. '3M') for the rolling tenor case.

  • delta – Delta for which vol is requested. Decimal is expected, i.e. 25% input should be 0.25.

  • start_date – Start date of the time series.

  • end_date – (Optional) end date for the time series. If omitted - last day of vol surface, or last day before option expiry (if fixed) is used

  • data_point – (Optional) data point of the vol surface

Returns

pd.TimeSeries

underlying: str
exchange_code: str
cash_settled: Optional[bool]
settlement_ticker: str
contract_size: Optional[float]
data_source_all: Optional[list[str]]
instrument_id: Optional[int]