Data

Data#

BasketConfig

Wrapper for discretionary strategy inputs.

ContractGroup

A class representing data common to a group of instruments.

CustomDataset

A class representing a Economic series

CustomDatasetGroup

A class representing custom datasets.

EconomicSeries

A class representing a Economic series

Symbology

Domain in which a Symbol value resides.

sigtech.framework.instruments.custom_dataset.custom_dataset(schema: str = None, identifiers: Optional[list[sigtech.framework.infra.data_adapter.identifier.Identifier]] = None, fields: Optional[list[str]] = None, data_source: Optional[DataSource] = None, domain: Optional[str] = None, symbology: Optional[str] = 'internal_id', method=None, filter: Optional[FilterExpression] = None, limit: Optional[int] = None, **kwargs)

Return the history timeseries for a custom dataset.

Parameters:
  • schema – Schema identifier (optional).

  • identifiers – List of instrument names (optional).

  • fields – List of fields (optional).

  • data_source – Data source (optional).

  • domain – Domain (optional).

  • symbology – Symbology (default is internal_id).

  • method – Physical access method (optional).

  • filter – Filter expression (optional).

  • limit – Limit value (optional).

Returns:

pandas DataFrame.

sigtech.framework.utils.session_data.session_data_parser(session_data: DataFrame, index: DatetimeIndex, trading_sessions: Union[str, list[str], bool] = True, business_days: DatetimeIndex = None) ndarray

Takes session data and a datetime index and produces a boolean array to allow filtering of a time series by just the points in the desired trading session(s). Eg: data[session_data_parser(session_data, data.index)]

Parameters:
  • session_datainstrument.group().session_data() for some instrument

  • index – A timezone-aware UTC pandas DatetimeIndex - eg, instrument.intraday_history().index

  • trading_sessions – one or more trading session names, from instument.intraday_trading_sessions() or True to default to [‘Trading’, ‘Morning Trading’, ‘Afternoon Trading’, ‘Evening Trading’, ‘Open (to next day)’]

  • business_days – a daily DatetimeIndex representing the good business days. If supplied, will filter by these dates only. eg, instrument.history_schedule().data_ts()

Returns:

np.ndarray

sigtech.framework.utils.session_data.sessions_df(session_data: DataFrame) DataFrame

Returns a dataframe of session open/close times per day

Parameters:

session_datainstrument.group().session_data() for some instrument

sigtech.framework.utils.session_data.sessions_open_close(session_data: DataFrame, d: date, step_interpolate: bool = False) dict

Get a dictionary of session name to tuple (open datetime, close datetime) given session data and a particular date. If a session crosses midnight, the given date will line up with the closing time. Returned datetimes will be timezone aware, in local time zone.

Parameters:
  • session_datainstrument.group().session_data() for some instrument

  • d – date to query for

  • step_interpolate – if True use session entries closest to input - relevant for the wings