SIGMaster#

class sigtech.framework.instruments.sig_master.SIGMaster

SIGMaster using FrameworkObject

internal_ids: list[str]
internal_ids_tradable_index: int
internal_ids_fungible_index: int
internal_ids_company_index: int
tradable_primary_keys: Optional[list]
fungible_primary_keys: Optional[list]
company_primary_keys: list[str]
market_date_column: str
timestamp_column: str
tombstone_column: str
tombstone_value: int
primary_key: list[str]
COMPANY_INTERNAL_ID = 'SIG.COMPANY_INTERNAL_ID'
FUNGIBLE_INTERNAL_ID = 'SIG.FUNGIBLE_INTERNAL_ID'
TRADABLE_INTERNAL_ID = 'SIG.TRADABLE_INTERNAL_ID'
add_custom_history(history: pandas.core.series.Series, field: str = 'LastPrice', data_point: Optional[sigtech.framework.infra.data_adapter.common.DataPoint] = None)

Add custom history data for this object. If multiple, conflicting custom histories are added only the last addition will be returned from history.

Parameters
  • historypd.Series of custom history with index as tz-naive, pd.DatetimeIndex dates.

  • field – Name of history field to overwrite.

  • data_point – Optional DataPoint to specify timing of custom history.

after_history_func()
property allowed_clean_sparse_fields

List of fields that are allowed to have na values on clean history.

property asset_description: str

String representing the underlying asset, or None if no assets exist.

property available_data_points: Optional[list[sigtech.framework.infra.data_adapter.common.DataPoint]]

Available data points for this object.

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

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

property base_name

Primary name used to identify the object.

cache_history(fields: list, data_point: sigtech.framework.infra.data_adapter.common.DataPoint, start_dt: Optional[datetime.datetime] = None, end_dt: Optional[datetime.datetime] = None, **kwargs)

Ensure history data is cached

property cache_name: str

Cache name of this object.

calendar_schedule() sigtech.framework.schedules.schedule.Schedule

A calendar schedule - a schedule that is corresponding to a history schedule, but without min and max dates set.

Returns

Calendar schedule instance for the instrument

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.

data_available(d: Optional[datetime.date] = None) bool

Method to indicate if pricing data is available for a given date.

Parameters

d – Date of interest (optional), if not provided it will take as of date of the environment.

data_df(data_point: Optional[sigtech.framework.infra.data_adapter.common.DataPoint] = None, multi_index: bool = False, drop_nan_cols: bool = False, pretty_print=False) pandas.core.frame.DataFrame

Return a DataFrame containing all data available for this object.

Parameters
  • data_point – Optional data point used to load the object history.

  • multi_index – If set to True, rows are uniquely indexed by a multi index (if applicable). Default is False.

  • drop_nan_cols – If set to True, all-NaN columns are dropped. Default is False.

  • pretty_print – If set to True, formatting is added to columns names and data values. Rates will be represented as percentage number instead of decimal number (e.g. 3.5 instead of 0.035).

Returns

pandas DataFrame.

data_dict()

Return the object attributes in a dict.

property data_format

Return the data format associated with sparse history, i.e. ROWISE or COLUMNAR.

property data_point

Field used when retrieving history.

property data_source

Data provider of the instrument.

property data_source_all: Optional[list[str]]

Available data points for this object.

data_validation(sparse_series)

Additional data checks can be implemented in sub classes here.

property default_data_point

Default data point for this object.

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.

filter(value: Union[str, list[str]], column: str = 'ISSUE_NAME', op: str = '==') sigtech.framework.instruments.sig_master.SIGMaster

Useful for filtering using specific op codes for a particular column. Use filter_like(…) for text/str like filtering.

Parameters
  • value – Value or list or values to filter.

  • column – Column to filter on (defaults to ISSUE_NAME), use obj.get('SIG MASTER').info() to show valid columns.

  • op – Operator used during filtering, valid values are ‘<’, ‘<=’, ‘==’, ‘!=’, ‘>=’, ‘>’, ‘in’, ‘not in’.

Returns

A new filtered SIGMaster FrameworkObject.

filter_as_of(as_of=None) sigtech.framework.instruments.sig_master.SIGMaster

SIGMaster is a Point in Time (PIT) set of data records e.g. all corporate events for all companies.

Setting the as_of allows you to time travel to see available data records at that point in time. All subsequent records are removed. This allows us to realistically back-test strategies. The use of stable time agnostic SIG IDs supports data integrity e.g. other IDs may move/change.

  • SIG tradable ID column shown using obj.get(‘SIG MASTER’)._tradable_internal_id_column().

  • SIG fungible ID column shown using obj.get(‘SIG MASTER’)._fungible_internal_id_column().

  • SIG company ID column shown using obj.get(‘SIG MASTER’)._company_internal_id_column().

By default, filter_as_of is called on SIGMaster data load, and set to the configured env as_of date.

Parameters

as_of – str or datetime-like value to time travel to e.g. ‘2015-01-02’.

Returns

A new filtered SIGMaster FrameworkObject.

Raises

ValueError: when you try to time travel to a future date from the current SIGMaster as_of date.

filter_company(internal_id: str) sigtech.framework.instruments.sig_master.SIGMaster

Return all records matching the time invariant SIG.COMPANY_INTERNAL_ID column value.

Parameters

internal_id – SIG company internal_id.

Returns

A new filtered SIGMaster FrameworkObject.

filter_exchange_tickers(exchange_tickers: Sequence = None) sigtech.framework.instruments.sig_master.SIGMaster

The EXCHANGE_TICKER column indicates the exchange ticker for each stock at a specific venue. Useful to daisy chain to lookup stocks, e.g. obj.get(‘SIG MASTER’).filter_operating_mic(…).filter_exchange_tickers(…)

Parameters

exchange_tickers – Sequence of exchange tickers to filter on. Use obj.get(‘SIG MASTER’).show_filter_values(column=’EXCHANGE_TICKER’) to see valid values.

Returns

A new filtered SIGMaster FrameworkObject.

filter_fungible(internal_id: str) sigtech.framework.instruments.sig_master.SIGMaster

Return all records matching the time invariant SIG.FUNGIBLE_INTERNAL_ID column value.

Parameters

internal_id – SIG fungible internal_id.

Returns

A new filtered SIGMaster FrameworkObject.

filter_isna(column: str = 'ISSUE_NAME') sigtech.framework.instruments.sig_master.SIGMaster

Useful for filtering rows to where the column value is null/None/NaN or otherwise empty.

Parameters

column – Column name to filter (defaults to ISSUE_NAME). Use sig.obj.get('SIG MASTER').info() to show valid columns.

Returns

A new filtered SIGMaster object.

filter_like(like: str, column: str = 'ISSUE_NAME', negate: bool = False) sigtech.framework.instruments.sig_master.SIGMaster

Useful for text/str like filtering. Use filter(…) for specific value filtering

Wraps the pandas dataframe filter method: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.filter.html, e.g. df.filter(like=’value’, axis=0).

Parameters
  • like – value to filter on (case-sensitive) e.g. ‘BERKSHIRE HATHAWAY’.

  • column – column to filter on (defaults to ISSUE_NAME), use obj.get('SIG MASTER').info() to show valid columns.

  • negate – boolean not operation if passed as True e.g. value is NOT like.

Returns

A new filtered SIGMaster FrameworkObject.

filter_notna(column: str = 'ISSUE_NAME') sigtech.framework.instruments.sig_master.SIGMaster

Useful for filtering rows to where the column value is not null/None/NaN or otherwise empty.

Parameters

column – Column name to filter (defaults to ISSUE_NAME). Use sig.obj.get('SIG MASTER').info() to show valid columns.

Returns

A new filtered SIGMaster object.

filter_operating_mic(operating_mics: Sequence = None) sigtech.framework.instruments.sig_master.SIGMaster

The OPERATING_MIC column indicates the ISO10383 operating mic where the stock is traded. See https://www.iso20022.org/market-identifier-codes.

Parameters

operating_mics – Sequence of operating mics to filter on. Use obj.get(‘SIG MASTER’).show_filter_values(column=’OPERATING_MIC’) to see valid values.

Returns

A new filtered SIGMaster FrameworkObject.

filter_primary_fungible() sigtech.framework.instruments.sig_master.SIGMaster

The PRIMARY_FUNGIBLE column indicates whether stock is the primary fungible for a company.

Returns

A new filtered SIGMaster FrameworkObject.

filter_primary_tradable(value='Y') sigtech.framework.instruments.sig_master.SIGMaster

The PRIMARY_TRADABLE column indicates whether stock is the primary tradable for a particular fungible.

Parameters

value – Set to ‘Y’ for primary tradable, ‘N’ for not primary tradable.

Returns

A new filtered SIGMaster FrameworkObject.

filter_startswith(startswith: str, column: str = 'ISSUE_NAME', negate: bool = False) sigtech.framework.instruments.sig_master.SIGMaster

Useful for filtering the string prefix of a particular column. This method is case-sensitive. Use filter_like(…) for text/str like filtering

Parameters
  • startswith – value to filter on (case-sensitive) e.g. ‘BERKSHIRE’.

  • column – column to filter on (defaults to ISSUE_NAME), use obj.get('SIG MASTER').info() to show valid columns.

  • negate – boolean not operation if passed as True e.g. value does NOT start with.

Returns

A new filtered SIGMaster FrameworkObject.

filter_to_last_pit_record() sigtech.framework.instruments.sig_master.SIGMaster

SIGMaster is a Point in Time (PIT) set of data records. A new record is created for each tradable stock when a data point changes for it, e.g. TRBC data, ticker etc.

This filter removes historical records for all stocks, retaining only the current/most recent data points.

Returns

A new filtered SIGMaster FrameworkObject.

filter_tradable(internal_id: str) sigtech.framework.instruments.sig_master.SIGMaster

Return all records matching the time invariant SIG.TRADABLE_INTERNAL_ID column value.

Parameters

internal_id – SIG tradable internal_id.

Returns

A new filtered SIGMaster FrameworkObject.

filter_tradable_active(value: int = 1) sigtech.framework.instruments.sig_master.SIGMaster

The TRADABLE_ACTIVE column indicates whether stock is active/inactive, e.g. stocks may be deactivated due to de-listings.

Parameters

value – Set to 1 for active, 0 for inactive

Returns

A new filtered SIGMaster FrameworkObject.

finalize_for_comparison()

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

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

from_pandas(sig_master_dataframe: Optional[pandas.core.frame.DataFrame] = None) sigtech.framework.instruments.sig_master.SIGMaster

Load SIGMaster from a pandas DataFrame.

Parameters

sig_master_dataframe – pandas DataFrame.

Returns

SIGMaster object.

from_parquet(file_path: Optional[str] = None)

Load SIGMaster from a Parquet source.

Parameters

file_path – Path of the Parquet file.

Returns

SIGMaster object.

get_company_ids(lookup_values: Optional[Sequence[str]] = None, lookup_column: str = 'EXCHANGE_TICKER') dict

Filter values for issuing companies.

Parameters
  • lookup_values – Sequence of strings used for lookup (optional).

  • lookup_column – SIGMaster column used for lookup (optional).

Returns

dict.

get_fungible_ids(lookup_values: Optional[Sequence[str]] = None, lookup_column: str = 'EXCHANGE_TICKER') dict

Filter values for fungible stocks.

Parameters
  • lookup_values – Sequence of strings used for lookup (optional).

  • lookup_column – SIGMaster column used for lookup (optional).

Returns

dict.

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_tradable_ids(lookup_values: Optional[Sequence[str]] = None, lookup_column: str = 'EXCHANGE_TICKER') dict

Filter values for tradable stocks.

Parameters
  • lookup_values – Sequence of strings used for lookup (optional).

  • lookup_column – SIGMaster column used for lookup (optional).

Returns

dict.

get_universe_generator() sigtech.framework.instruments.sig_master.UniverseGenerator

Return a universe generator from SIGMaster to define universes over a data range. See UniverseGenerator for an example.

group() any

Group of this object.

has_preloaded_history(fields=None, data_point=None)

Check if the object has preloaded history.

help()

See SIG_single_stocks_SIGMaster_API.ipynb for a short introduction to the SIGMaster single stocks API, aimed at new users.

SIGMaster is point in time (PIT) data record:

  • Recording all historical stock events (mergers, name changes etc)

  • This allows time travel when back-testing.

  • Use sig_master.filter_as_of? for more details

Many useful built-in filters and views exist to allow easy SIGMaster browsing, navigation and universe filtering.

Basic filter usage:

  • sig_master.filter_primary_tradable()

  • sig_master.filter_operating_mic(operating_mics=[‘XNAS’, ‘XNYS’])

  • sig_master.filter_like(like=’BERKSHIRE HATHAWAY’, column=’ISSUE_NAME’)

Daisy chaining filters:

  • sig_master

  • .filter_primary_tradable()

  • .filter_operating_mic(operating_mics=[‘XNAS’, ‘XNYS’])

  • .filter_like(like=’BERKSHIRE HATHAWAY’, column=’ISSUE_NAME’)

Help functions:

  • sig_master.filter_operating_mic? : show docstr for a particular filter function

  • sig_master.show_filters() : show all filters with their docstr

  • sig_master.show_filter_values(column=’OPERATING_MIC’, dropna=True) : shows SIGMaster values for a column

  • sig_master.info() : wraps pandas .info()

  • sig_master.info_column_descriptions() : shows basic descriptions for each column

Pre-baked pandas dataframe views:

  • sig_master.to_pandas_trading_view() : useful for trading/exchange considerations

  • sig_master.to_pandas_data_model_view() : useful for viewing company/fungible/tradable relationships

  • sig_master.to_pandas_point_in_time_view() : useful for time travelling

Useful data model filter/views:

  • sig_master.filter_tradable(internal_id=’1002224.SINGLE_STOCK.TRADABLE’).to_pandas_trading_view()

  • sig_master.filter_fungible(internal_id=’1002203.SINGLE_STOCK’).to_pandas_trading_view()

  • sig_master.filter_company(internal_id=’1002011.COMPANY’).to_pandas_trading_view()

SIG building blocks integration:

  • sig_master.to_single_stock()

history() pandas.core.frame.DataFrame

Return SIGMaster time series.

history_dates()

Return all the dates we should have actual history values.

history_dates_actual()

Return all the dates we have actual history values.

history_dates_eventual()

Return all the dates we will eventually have history values.

history_df(fields: list[str] = None, data_point: sigtech.framework.infra.data_adapter.common.DataPoint = None, multicolumn: bool = None) deprecated

Return the object history dataframe.

Parameters
  • fields – list of fields. If not supplied, self.history_fields will be used

  • data_point – optional data point used to load the object history.

  • multicolumn – Deprecated input. This will be removed in future releases.

Returns

pd.DataFrame.

history_end_date() datetime.date

Eventual history end date, truncated to the as of date - the day on which history should end.

history_end_date_actual()

The last date we have an actual value for.

history_end_date_eventual() datetime.date

Last date for which data will be available - typically date.max if no end date set.

history_end_timestamp() pandas._libs.tslibs.timestamps.Timestamp
Returns

First timestamp for which data should be available

property history_fields: list[str]

The fields of history retrieved for this instrument.

history_schedule() sigtech.framework.schedules.schedule.Schedule

Object describing dates on which history is available and the corresponding delivery times.

Returns

History schedule instance for the instrument.

history_start_date() datetime.date

First date for which data should be available.

history_start_timestamp() pandas._libs.tslibs.timestamps.Timestamp
Returns

First timestamp for which data should be available

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

Return the object identifier.

info() None

Prints a concise summary of the SIGMaster’s internal DataFrame.

info_column_descriptions()

Shows description of SIG Master columns.

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.

intraday_history(field=None, period=None, start_dt=None, end_dt=None, daily_timeseries_time=None, daily_timeseries_tz=None, filter_by_trading_sessions=False, timezone=None, convert_yield_to_price=True)

Retrieve intraday history for this instrument as a Series.

Parameters
  • field – field name in self.intraday_history_fields.

  • period – a dtm.timedelta giving the desired periodicity of the data.

  • start_dt – optional tz-aware dtm.datetime giving a desired start point.

  • end_dt – optional tz-aware dtm.datetime giving a desired end point.

  • daily_timeseries_time – if supplied, the intraday data will be down-sampled to daily data snapped at this time.

  • daily_timeseries_tz – timezone for the above. Optional, if not supplied defaults to self.valuation_tzinfo

  • filter_by_trading_sessions – If False ``(default), return all available data. If ``True return data during the main trading session. If a string/list(string), return data during the trading session(s) of that name according to self.group().session_data(). See intraday_trading_sessions() for list of sessions.

  • timezone – set the timezone of the returned series to this value

  • convert_yield_to_price – applies yield to price conversion for yield quoted futures, e.g. AUD bond futures

Returns

A (possibly sparse) pd.Series with a DateTimeIndex. Times should be tz-aware UTC.

intraday_history_df(fields=None, period=None, start_dt=None, end_dt=None, daily_timeseries_time=None, daily_timeseries_tz=None, filter_by_trading_sessions=False, timezone=None, convert_yield_to_price=True)

Retrieve intraday history for this instrument as a dataframe.

Parameters
  • fields – a list of field names all in self.intraday_history_fields.

  • period – a dtm.timedelta giving the desired periodicity of the data.

  • start_dt – optional tz-aware dtm.datetime giving a desired start point.

  • end_dt – optional tz-aware dtm.datetime giving a desired end point.

  • daily_timeseries_time – if supplied, the intraday data will be down-sampled to daily data snapped at this time.

  • daily_timeseries_tz – timezone for the above. Optional, if not supplied defaults to self.valuation_tzinfo

  • filter_by_trading_sessions – If False ``(default), return all available data. If ``True return data during the main trading session. If a string/list(string), return data during the trading session(s) of that name according to self.group().session_data()

  • timezone – set the timezone of the returned dataframe to this value

  • convert_yield_to_price – applies yield to price conversion for yield quoted futures, e.g. AUD bond futures

Returns

A (possibly sparse) pd.DataFrame with a DateTimeIndex. Times should be tz-unaware UTC.

property intraday_history_fields: list[str]

The intraday fields of history retrieved for this instrument.

intraday_trading_sessions()

Gets ths list of trading sessions available as per the Copp-Clarke session data for this product group

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.

property prime_history_field: str

The main history field returned by default.

property prime_intraday_history_field

The main intraday history field returned by default.

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 print_output

State of the print output flag.

property product_type

Return the product_type property of this object.

publication_delay() str

Publication delay of data for this instrument.

realign_history(series)

Realign history series to proper business days.

Parameters

series – Input series.

Returns

Realigned history series.

property sector

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

set_preloaded_history(data) None

Set the preloaded history of the object.

Parameters

data – History data.

set_sparse_history(data) None

Set the sparse history of the object.

Parameters

data – History data.

show_filter_values(column: str, dropna: bool = True) list

Shows SIGMaster values for a column.

Parameters
  • column – Input column.

  • dropna – Drop NaN values (default is True).

Returns

List of unique values.

show_filters()

Show all filters with their docstring.

property sig_master_dataframe

Underlying SIGMaster pandas DataFrame.

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).

property supplementary_fields: list[str]

Additional fields available for the group.

textual_representation()

Return a printable representation of this object.

to_pandas() pandas.core.frame.DataFrame

Save SIGMaster to a pandas DataFrame.

Returns

pandas DataFrame.

to_pandas_data_model_view() pandas.core.frame.DataFrame

Return a DataFrame for viewing company/fungible/tradable relationships.

to_pandas_point_in_time_view()

Return a DataFrame for time travelling considerations.

to_pandas_trading_view() pandas.core.frame.DataFrame

Return a DataFrame for trading/exchange considerations.

to_single_stock(tradable_internal_ids: Optional[Sequence[str]] = None, use_tradable_internal_id_as_result_key: bool = False) dict

Returns a dict of SingleStock instruments.

Parameters
  • tradable_internal_ids – Optional sequence of str, or the tradable internal ids for the current SIGMaster.

  • use_tradable_internal_id_as_result_key – If set to True, the tradable internal id is used as the result key, otherwise use EXCHANGE_TICKER and OPERATING_MIC.

Returns

dict of SingleStock objects.

trade_schedule() sigtech.framework.schedules.schedule.Schedule

Schedule giving trade dates + last time at which we can trade for that date (i.e. notice time for funds).

Returns

Trade schedule instance for the instrument

validate()

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

wait_for_live_data(period: Optional[Union[datetime.datetime, str]] = None)

Waits until live data is collected up to and including env.asofdatetime :param period: period of the live intraday data to wait for (defaults to 1 minute)

price_factor: Optional[float]
use_price_factor: Optional[bool]
intraday_times: Optional[list]
intraday_tz_str: Optional[str]
instrument_id: Optional[int]