menu
Data

Entitites

An Entityis an object which stores information representing a real world object in the Marquee universe. These objects are representative of common resources such as an Asset or Country. Entities are associated with many datasets in Marquee, such as our Equity Implied Volatility dataset that is keyed off an Asset. Entities can be used in conjunction with a DataCoordinate to obtain a data series associated with that entity.

Entity Types

Below is an overview of the various Entity sub-classes used in GS Quant.

Entity TypeDescriptionPrimary ID
AssetSecurity or observable instrumentMarquee Asset ID
CountryISO 3166 countriesISO 3166-2
SubdivisionISO 3166 subdivsions of countriesISO 3166-2

Fetching Entities

Each Entity sub-class can be used to fetch their respective sub-class using various identifiers.

info

Note

Examples require an initialized GsSession and relevant identifier licenses. Please refer to Sessions for details.

from gs_quant.entities.entity import Country, Subdivision
from gs_quant.markets.securities import Asset, AssetIdentifier


us: Country = Country.get('US', Country.Identifier.MARQUEE_ID)
gb: Country = Country.get('United Kingdom', Country.Identifier.NAME)
spx: Asset = Asset.get('SPX', AssetIdentifier.BLOOMBERG_ID)
new_york: Subdivision = Subdivision.get('US-NY', Subdivision.Identifier.MARQUEE_ID)

Output:

<gs_quant.entities.entity.Country object at 0x000001D413790448>
<gs_quant.entities.entity.Country object at 0x000001D4137972C8>
<gs_quant.markets.securities.Index object at 0x000001D413614508>
<gs_quant.entities.entity.Subdivision object at 0x000001D4137902C8>

Each sub-class has additional information about the Entity which can be retrieved. In this case, the Country and Subdivision entities referencing the United Kingdom and New York State respectively.

print(f'GB - Region: {gb.get_region()}')
print(f'GB - ISO 3166 Alpha-3: {gb.get_alpha3()}')
print(f'GB - ISO 3166 Country Code: {gb.get_country_code()}\n')

print(f'New York - Name: {new_york.get_name()}')

Output:

GB - Region: Europe
GB - ISO 3166 Alpha-3: GBR
GB - ISO 3166 Country Code: 826

New York - Name: New York

Using Entities to Resolve a DataCoordinate

Entity objects can be utlized to resolve a DataCoordinate to fetch a unique series in the Marquee Data Platform without having to specify a Dataset ID.

import datetime as dt

from gs_quant.data import DataDimension, DataCoordinate, DataMeasure

dimensions = {
    DataDimension.TENOR: '1m',
    DataDimension.STRIKE_REFERENCE: 'spot',
    DataDimension.RELATIVE_STRIKE: .8
}

coordinate: DataCoordinate = spx.get_data_coordinate(measure=DataMeasure.IMPLIED_VOLATILITY,
                                                     dimensions=dimensions,
                                                     frequency=DataFrequency.DAILY)

coordinate.get_series(start=dt.date(2020, 1, 1), end=dt.date(2020, 1, 8))

Output:

2020-01-02    0.300644
2020-01-03    0.315498
2020-01-06    0.311003
2020-01-07    0.306926
2020-01-08    0.308256
dtype: float64

Related Content


Certain solutions and Institutional Services described herein are provided via our Marquee platform. The Marquee platform is for institutional and professional clients only. This site is for informational purposes only and does not constitute an offer to provide the Marquee platform services described, nor an offer to sell, or the solicitation of an offer to buy, any security. Some of the services and products described herein may not be available in certain jurisdictions or to certain types of clients. Please contact your Goldman Sachs sales representative with any questions. Any data or market information presented on the site is solely for illustrative purposes. There is no representation that any transaction can or could have been effected on such terms or at such prices. Please see https://www.goldmansachs.com/disclaimer/sec-div-disclaimers-for-electronic-comms.html for additional information.
Transaction Banking services are offered by Goldman Sachs Bank USA (“GS Bank”). GS Bank is a New York State chartered bank, a member of the Federal Reserve System and a Member FDIC.
GS DAP™ is owned and operated by Goldman Sachs. This site is for informational purposes only and does not constitute an offer to provide, or the solicitation of an offer to provide access to or use of GS DAP™. Any subsequent commitment by Goldman Sachs to provide access to and / or use of GS DAP™ would be subject to various conditions, including, amongst others, (i) satisfactory determination and legal review of the structure of any potential product or activity, (ii) receipt of all internal and external approvals (including potentially regulatory approvals); (iii) execution of any relevant documentation in a form satisfactory to Goldman Sachs; and (iv) completion of any relevant system / technology / platform build or adaptation required or desired to support the structure of any potential product or activity.
Mosaic is a service mark of Goldman Sachs & Co. LLC. This service is made available in the United States by Goldman Sachs & Co. LLC and outside of the United States by Goldman Sachs International, or its local affiliates in accordance with applicable law and regulations. Goldman Sachs International and Goldman Sachs & Co. LLC are the distributors of the Goldman Sachs Funds. Depending upon the jurisdiction in which you are located, transactions in non-Goldman Sachs money market funds are affected by either Goldman Sachs & Co. LLC, a member of FINRA, SIPC and NYSE, or Goldman Sachs International. For additional information contact your Goldman Sachs representative. Goldman Sachs & Co. LLC, Goldman Sachs International, Goldman Sachs Liquidity Solutions, Goldman Sachs Asset Management, L.P., and the Goldman Sachs funds available through Goldman Sachs Liquidity Solutions and other affiliated entities, are under the common control of the Goldman Sachs Group, Inc.
© 2024 Goldman Sachs. All rights reserved.