Indices#

Learn more: Example notebooks

Environment#

Setting up your environment takes three steps:

  • Import the relevant internal and external libraries

  • Configure the environment parameters

  • Initialise the environment

import sigtech.framework as sig
from sigtech.framework.instruments.indices import IndexGroup

import seaborn as sns

sns.set(rc={'figure.figsize': (18, 6)})
sig.config.init();

Learn more: Setting up the environment

Indices#

To query the different indices available on the SigTech platform, use the following code block:

Input:

IndexGroup.get_names()

Output:

['ASX INDEX GROUP',
 'CAC INDEX GROUP',
 'CBOE INDEX GROUP',
 'DAX INDEX GROUP',
 'EURONEXT INDEX GROUP',
 'EUROSTOXX INDEX GROUP',
 'FTSE INDEX GROUP',
 'FTSE JSE INDEX GROUP',
 'FTSE ROME INDEX GROUP',
 'FTSE RUSSELL ASIA INDEX GROUP',
 'FTSE RUSSELL INDEX GROUP',
 'HANG SENG INDEX GROUP',
 'KOSPI2 INDEX GROUP',
 'MSCI INDEX GROUP',
 'NASDAQ INDEX GROUP',
 'NASDAQ OMX STOCKHOLM INDEX GROUP',
 'NIKKEI INDEX GROUP',
 'NSE INDEX GROUP',
 'RUSSELL INDEX GROUP',
 'S AND P CANADA INDEX GROUP',
 'S AND P INDEX GROUP',
 'SMI INDEX GROUP',
 'TWSE INDEX GROUP']

All instruments within the SigTech platform and a large range of other objects, such as contract groups, calendars, or strategies can be accessed through the platform’s object API. In practice, this means calling sig.obj.get(object_name)

Input:

sp_indices = sig.obj.get('S AND P INDEX GROUP')
sp_indices

Output:

S AND P INDEX GROUP <class 'sigtech.framework.instruments.indices.IndexGroup'>[4387612560]

As an example, the S&P index group object is created above using the method query_instrument_names. A list instrument names, in this case indices, contained within the group is returned:

Input:

sp_indices.query_instrument_names()

Output:

['NZSE10 INDEX', 'SPX INDEX', 'SPXSET INDEX', 'SPXT INDEX']

It is also possible to query the instrument objects within a group, using query_instruments:

Input:

sp_indices.query_instruments()

Output:

[NZSE10 INDEX <class 'sigtech.framework.instruments.indices.EquityIndex'>[5377318864],
 SPX INDEX <class 'sigtech.framework.instruments.indices.EquityIndex'>[5377318816],
 SPXSET INDEX <class 'sigtech.framework.instruments.indices.EquityIndex'>[5389968768],
 SPXT INDEX <class 'sigtech.framework.instruments.indices.EquityIndex'>[5389969008]]

An individual index is retrieved through the object API:

Input:

spx = sig.obj.get('SPX INDEX')
spx

Output:

SPX INDEX <class 'sigtech.framework.instruments.indices.EquityIndex'>[5377318816]

Accessing historical time series data is done through a call to the history method, common to all instruments

Input:

spx.history()

Output:

1963-12-31      75.020004
1964-01-01      75.020004
1964-01-02      75.429993
1964-01-03      75.500000
1964-01-04      75.500000
                 ...
2021-06-03    4192.851562
2021-06-04    4229.890625
2021-06-07    4226.519531
2021-06-08    4227.261719
2021-06-09    4227.261719
Name: (LastPrice, EOD, SPX INDEX), Length: 20136, dtype: float64
spx.history().plot(title='SPX Index Performance');

The method data_dict gives an overview of the static data related to an index:

Input:

spx.data_dict()

Output:

{'instrument_id': None,
 'data_source_all': [],
 'available_data_points': ['EOD'],
 'default_data_point': 'EOD',
 'price_factor': 1.0,
 'use_price_factor': True,
 'intraday_times': [],
 'intraday_tz_str': 'UTC',
 'currency': 'USD',
 'db_ticker': 'SPX',
 'db_sector': 'Index',
 'fixing_source': 'S AND P INDEX GROUP',
 'frequency': '1BD',
 'schedule_start': datetime.date(2013, 12, 31),
 'strategy_holidays': '',
 'db_history_end_date': datetime.date(9999, 12, 31),
 'total_return': False}