Search…
Custom data sources
This page introduces the concept of custom data sources and explores the ways in which they can be defined and utilised on the SigTech platform. It shows you how to:
  • Construct your environment
  • Query available data sources
  • Set a data source
  • Compare data sources

Environment

1
import sigtech.framework as sig
2
sig.de_init()
3
sig.init()
Copied!
During the configuration of your research environment, a range of parameters can be used to set and define its features and behaviour.
The following command lists the first ten environment configuration parameters:
Input
Output
1
sorted(sig.env().config)[:10]
Copied!
1
['ALLOWED_DAY_CA_DATA_GAP',
2
'ALLOWED_MISSING_CA_DATA',
3
'CASH_OVERRIDES',
4
'CUSTOM_DATA_SOURCE_CONFIG',
5
'DATAFRAME_SERVICE_ACTIVE',
6
'DATAFRAME_SERVICE_FACTORY',
7
'DATA_ADAPTERS',
8
'DATA_SERVICE_DATA_FILE',
9
'DATA_SERVICE_RECORD_TO_FILE',
10
'DISABLE_T_COST_NETTING']
Copied!
Learn more: on configuration parameters, see Environment setup.
Custom data sources can be set by assigning values to the CUSTOM_DATA_SOURCE_CONFIG parameter.
1
sig.config.CUSTOM_DATA_SOURCE_CONFIG
Copied!
No custom data sources are set by default. This can be confirmed by running the following command:
1
sig.env()[sig.config.CUSTOM_DATA_SOURCE_CONFIG]
Copied!

View available sources

Whilst custom data sources can be specified for any type of tradable instrument, our example uses FX spot data to demonstrate this functionality.
The following command retrieves an FX pair:
1
fx = sig.obj.get('EURUSD CURNCY')
Copied!
To determine the default data source for this instrument:
Input
Output
1
fx_data_source
Copied!
1
'ICE_SUPER_DERIVATIVES'
Copied!
To list the data sources available for an instrument, use data_source_all. The results generated by this command will depend on your current data entitlements. To access additional data, please contact our sales team at [email protected]
Input
Output
1
fx.data_source_all
Copied!
1
['ICE_SUPER_DERIVATIVES', 'CLS', 'QUANDL.FXCM', 'REFINITIV', 'CBOE']
Copied!

Change source

Before resetting the data source it is necessary to de-initialize and re-initialize the environment:
1
sig.de_init()
2
sig.init()
Copied!
The following code block selects objects whose internal id is of the form '[A-Z]{6} CURNCY' and changes their data source to 'REFINITIV':
1
sig.env()[sig.config.CUSTOM_DATA_SOURCE_CONFIG] = [
2
('[A-Z]{6} CURNCY', 'REFINITIV'),
3
]
Copied!
To confirm this change, retrieve the FX pair and querying its data source:
Input
Output
1
fx_refinitiv = sig.obj.get('EURUSD CURNCY')
2
fx_refinitiv.data_source
Copied!
1
'REFINITIV'
Copied!
To display the group to which the object belongs, use the following command:
Input
Output
1
fx.refinitiv.group()
Copied!
1
REFINITIV FXFIX GROUP <class 'sigtech.framework.instruments.fixes.FXFixGroup'>[139644524666064]
Copied!
To tabulate the first five available data points within the instrument’s history, use both the history() and head() functions:
Input
Output
1
fx_refinitiv.history().head()
Copied!
1
trading_datetime
2
2000-01-31 01:00:00+00:00 0.97970
3
2000-01-31 02:00:00+00:00 0.97875
4
2000-01-31 03:00:00+00:00 0.97955
5
2000-01-31 04:00:00+00:00 0.98080
6
2000-01-31 05:00:00+00:00 0.98050
7
Name: (LastPrice, EURUSD CURNCY), dtype: float64
Copied!
We can also compare currencies available from different data sources:
Input
Output
1
sig.FXFixGroup.get_names()
Copied!
1
['CBOE FXFIX GROUP',
2
'CLS FXFIX GROUP',
3
'ICE TERMSTRUCTURE FXFIX GROUP',
4
'QUANDL FXFIX GROUP',
5
'REFINITIV FXFIX GROUP']
Copied!
To view currencies available from Refinitiv but unavailable from ICE:
Input
Output
1
ice_ccys = sig.obj.get('ICE TERMSTRUCTURE FXFIX GROUP').query_instrument_names()
2
refinitiv_ccys = sig.obj.get('REFINITIV FXFIX GROUP').query_instrument_names()
3
additional_ccys = [ccy for ccy in refinitiv_ccys if ccy not in ice_ccys]
4
additional_ccys
Copied!
1
['AUDJPY CURNCY',
2
'AUDNZD CURNCY',
3
'CADJPY CURNCY',
4
'EURAUD CURNCY',
5
'EURCAD CURNCY',
6
'EURCHF CURNCY',
7
'EURDKK CURNCY',
8
'EURGBP CURNCY',
9
'EURHUF CURNCY',
10
'EURJPY CURNCY',
11
'EURNOK CURNCY',
12
'EURRUB CURNCY',
13
'EURSEK CURNCY',
14
'GBPAUD CURNCY',
15
'GBPCAD CURNCY',
16
'GBPCHF CURNCY',
17
'GBPJPY CURNCY']
Copied!
Confirm that AUDJPY is unavailable from ICE by querying the data sources associated with the currency pair:
Input
Output
1
sig.obj.get('AUDJPY CURNCY').data_source_all
Copied!
1
['CLS', 'QUANDL.FXCM', 'REFINITIV', 'CBOE']
Copied!
Reverting to ICE renders this pair unavailable:
1
sig.de_init()
2
sig.init()
Copied!
Absent a set source, all available sources for an instance are cycled through. Production of a history series will depend on entitlements:
Input
Output
1
fx = sig.obj.get('EURUSD CURNCY')
2
fx.history().head()
Copied!
1
trading_datetime
2
2015-08-31 21:05:00+00:00 86.2320
3
2015-08-31 21:20:00+00:00 86.2170
4
2015-08-31 21:30:00+00:00 86.2505
5
2015-08-31 21:35:00+00:00 86.2885
6
2015-08-31 21:45:00+00:00 86.2586
7
Name: TWAP, dtype: float64
Copied!
In this case, ICE_SUPER_DERIVATIVES is our data source:
Input
Output
1
fx.data_source
Copied!
1
'ICE_SUPER_DERIVATIVES'
Copied!