menu
Data

Map Symbology with Security Master

error

Warning

Security Master is a Beta service and APIs are subject to change. Please contact GS Data Services if you are interested in finding out more.

A Security Master provides financial product reference data and is a foundational building block of any quantitative financial analytics engine. The core component of Goldman Sachs' Security Master is symbology, the data necessary to map from one identifier to another. Clients can retrieve this data via the GS Quant SDK.

info

Note

A subscription is needed to use the Security Master referenced in this guide. For further information, please contact GS Data Services.

Compatibility

Before running the examples in this guide, set source to be Security Master Service (defaults to Asset Service):

from gs_quant.markets.securities import SecurityMaster, SecurityMasterSource

SecurityMaster.set_source(SecurityMasterSource.SECURITY_MASTER)

Method availability varies by source:

MethodAsset ServiceSecurity Master
get_assetXX
get_identifiersX
get_all_identifiersX

Querying

You can look up a security using any of the identifier types in Security Master (e.g. ric, bbid, cusip, sedol). Identifiers that refer to the same security will be returned, subject to licensing.

Milestoning

Identifiers are milestoned, such that the history of each identifier for a given security can be viewed. By default, data that is currently valid will be retrieved. However, users can specify an "as of" date to see identifier values that were in effect on a past date. (Other fields such as asset type and descriptive tags are not milestoned.)

info

Note

Examples require an initialized GsSession. Please refer to Sessions for details.

Get By Identifier

import datetime
from gs_quant.markets.securities import SecurityIdentifier, SecurityMaster

security = SecurityMaster.get_asset('GS UN', SecurityIdentifier.BBID, as_of=datetime.date(2021, 1, 5))
print(security)
print(security.get_identifiers())

Output:

{
    "name": "GOLDMAN SACHS GROUP INC (New York Stock)",
    "type": "Single Stock",
    "currency": "USD",
    "tags": [],
    "id": "GSPD901026E154",
    "assetClass": "Equity",
    "company": {
        "name": "Goldman Sachs Group Inc/The",
        "identifiers": {
            "gsCompanyId": 25998
        }
    },
    "product": {
        "name": "GOLDMAN SACHS GROUP INC",
        "identifiers": {
            "gsid": 901026
        }
    },
    "exchange": {
        "name": "New York Stock",
        "identifiers": {
            "gsExchangeId": 154
        }
    }
}

Output for identifiers at point in time (specified by the as_of parameter):

{
    "cusip": "38141G10",
    "ric": "GS",
    "isin": "US38141G1040",
    "ticker": "GS",
    "sedol": "2407966",
    "bbid": "GS UN"
}

Field Selection

If you want to ensure the response only contains the fields that you are interested in, you can use the fields parameter. Example:

import datetime
from gs_quant.markets.securities import SecurityIdentifier, SecurityMaster

fields = ['id', 'name', 'type', 'assetClass']
security = SecurityMaster.get_asset('GS UN', SecurityIdentifier.BBID, as_of=datetime.date(2021, 1, 5), fields=fields)
print(security)

Output:

{
    "name": "GOLDMAN SACHS GROUP INC (New York Stock)",
    "type": "Single Stock",
    "id": "GSPD901026E154",
    "assetClass": "Equity"
}

Bulk Identifier Queries

You can retrieve identifier history for multiple assets at a time. For example:

import datetime
from gs_quant.markets.securities import SecurityIdentifier, SecurityMaster

ids = ['CTLP UW', 'TSLA UW', 'FB UW']
as_of = datetime.datetime(2021, 6, 5)  # as-of-date used to map input IDs to assets
start = datetime.datetime(2000, 1, 5)  # get identifier entries with update time after this time
end = as_of  # get identifier entries with update time before this time
identifiers = SecurityMaster.get_identifiers(ids, SecurityIdentifier.BBID, as_of=as_of, start=start, end=end)
print(identifiers['CTLP UW'])

Output (note the ric and ticker changes for this asset):

[
  {
    "startDate": "2021-01-01",
    "endDate": "2021-04-18",
    "value": "USAT",
    "updateTime": "2021-04-18T18:36:18.443Z",
    "type": "ticker"
  },
  {
    "startDate": "2021-04-19",
    "endDate": "9999-99-99",
    "value": "CTLP",
    "updateTime": "2021-04-18T18:36:18.443Z",
    "type": "ticker"
  },
  {
    "startDate": "2021-01-01",
    "endDate": "2021-04-17",
    "type": "ric",
    "value": "USAT.OQ",
    "updateTime": "2021-04-18T14:54:47.406Z"
  },
  {
    "startDate": "2021-04-19",
    "endDate": "9999-99-99",
    "type": "ric",
    "value": "CTLP.OQ",
    "updateTime": "2021-04-19T00:20:57.3Z"
  }
]

To get identifiers for all assets that you are subscribed to:

import datetime
from gs_quant.markets.securities import AssetType, SecurityMaster
from gs_quant.target.common import AssetClass

as_of = datetime.datetime(2021, 5, 1)
identifiers = SecurityMaster.get_all_identifiers(AssetClass.Equity, [AssetType.STOCK], as_of=as_of)