How do you get the S&P500 list of stock symbols from refinitiv.

CAn someone show me how to make a request to get a list of s&p500 stocks? I can't seem to find this anywhere. What can I do do make a request? Is there a simple get request endpoint?

I want to feed the results into this request to get all csv order book data:

json_blob = {
        "ExtractionRequest": {
            "@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.TickHistoryMarketDepthExtractionRequest",
            "IdentifierList": {
                "@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.InstrumentIdentifierList",
                "InstrumentIdentifiers": [{
                    "Identifier": f"{ticker}",
                    "IdentifierType": "Ric",
                }],
                "ValidationOptions": {
                    "AllowHistoricalInstruments": "true"
                },
                "UseUserPreferencesForValidationOptions": "false",
            },
            "Condition": {
                "View": "RawMarketByPrice",
                "MessageTimeStampIn": "GmtUtc",
                "ReportDateRangeType": "Range",
                "DisplaySourceRIC": "true",
                "DateRangeTimeZone": "UTC",
                "QueryStartDate": query_start_date,
                "QueryEndDate": query_end_date,
            },
        }
    }
    post_url = URL_BASE + "/Extractions/ExtractRaw"
    response = post_request_with_auth(post_url, refinitiv_auth_token, json_blob)

    job_id = response.json()["JobId"]
    logger.info("Starting CSV download...")

    response = requests.get(
        URL_BASE + f"/Extractions/RawExtractionResults('{job_id}')/$value",
        headers = {"Authorization": f"Token {refinitiv_auth_token}"},
        stream = True
    )
    response.raise_for_status()

job_id = response.json()["JobId"]
logger.info("Starting CSV download...")

response = requests.get(
    URL_BASE + f"/Extractions/RawExtractionResults('{job_id}')/$value",
    headers = {"Authorization": f"Token {refinitiv_auth_token}"},
    stream = True
)
response.raise_for_status()

Find more posts tagged with

Sort by:
1 - 1 of 11

    @Jwan622

    Thank you for reaching out to us.

    You can use the TermsAndConditionsExtractionRequest to get a list of RICs in the S&P500. The chain RIC of the S&P500 is 0#.SPX. Therefore, the request message looks like this:

    {
    "ExtractionRequest": {
    "@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.TermsAndConditionsExtractionRequest",
    "ContentFieldNames": [
    "RIC"
    ],
    "IdentifierList": {
    "@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.InstrumentIdentifierList",
    "InstrumentIdentifiers": [
    { "Identifier": "0#.SPX", "IdentifierType": "ChainRIC" }
    ]
    }
    }
    }

    The Python code is:

    import requests
    import json

    url = "https://selectapi.datascope.refinitiv.com/RestApi/v1/Extractions/ExtractWithNotes"

    payload = json.dumps({
    "ExtractionRequest": {
    "@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.TermsAndConditionsExtractionRequest",
    "ContentFieldNames": [
    "RIC"
    ],
    "IdentifierList": {
    "@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.InstrumentIdentifierList",
    "InstrumentIdentifiers": [
    {
    "Identifier": "0#.SPX",
    "IdentifierType": "ChainRIC"
    }
    ]
    }
    }
    })
    headers = {
    'Prefer': 'respond-async',
    'Content-Type': 'application/json',
    'Authorization': 'Token <Token>'
    }

    response = requests.request("POST", url, headers=headers, data=payload)

    print(response.text)

    The output is:

     "Contents": [
    {
    "IdentifierType": "ChainRIC",
    "Identifier": "0#.SPX",
    "RIC": ".SPX"
    },
    {
    "IdentifierType": "ChainRIC",
    "Identifier": "0#.SPX",
    "RIC": "A.N"
    },
    {
    "IdentifierType": "ChainRIC",
    "Identifier": "0#.SPX",
    "RIC": "AAPL.OQ"
    },
    {
    "IdentifierType": "ChainRIC",
    "Identifier": "0#.SPX",
    "RIC": "ABBV.N"
    },
    {
    "IdentifierType": "ChainRIC",
    "Identifier": "0#.SPX",
    "RIC": "ABNB.OQ"
    },

    it works with my token, thank you very much

    Hello @Jwan622

    Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?

    If so please can you click the 'Yes' button on the appropriate reply? This will guide all community members who have a similar question.
    Thanks,

    AHS

    I got the data back:"@odata.context":"https://selectapi.datascope.refinitiv.com/RestApi/v1/$metadata#DataScope.Select.Api.Extractions.ExtractionRequests.ExtractionResult","Contents":[{"IdentifierType":"ChainRIC","Identifier":"0#.SPX","RIC":".SPX"},{"IdentifierType":"ChainRIC","Identifier":"0#.SPX","RIC":"A.N"},{"IdentifierType":"ChainRIC","Identifier":"0#.SPX","RIC":"AAPL.OQ"},{"IdentifierType":"ChainRIC","Identifier":"0#.SPX","RIC":"ABBV.N"},{"IdentifierType":"ChainRIC","Identifier":"0#.SPX","RIC":"ABNB.OQ"},{"IdentifierType":"ChainRIC","Identifier":"0#.SPX","RIC":"ABT.N"},{"IdentifierType":"ChainRIC","Identifier":"0#.SPX","RIC":"ACGL.OQ"},{"IdentifierType":"ChainRIC","Identifier":"0#.SPX","RIC":"ACN.N"When making an extraction request from this API:

        json_blob = {        "ExtractionRequest": {            "@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.TickHistoryMarketDepthExtractionRequest",            "IdentifierList": {                "@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.InstrumentIdentifierList",                "InstrumentIdentifiers": [{                    "Identifier": f"{ticker}",                    "IdentifierType": "Ric",                }],                "ValidationOptions": {                    "AllowHistoricalInstruments": "true"                },                "UseUserPreferencesForValidationOptions": "false",            },            "Condition": {                "View": "RawMarketByPrice",                "MessageTimeStampIn": "GmtUtc",                "ReportDateRangeType": "Range",                "DisplaySourceRIC": "true",                "DateRangeTimeZone": "UTC",                "QueryStartDate": query_start_date,                "QueryEndDate": query_end_date,            },        }    }    post_url = URL_BASE + "/Extractions/ExtractRaw"    response = post_request_with_auth(post_url, refinitiv_auth_token, json_blob)
    

    The ticker in the identifier field doesn't work. It only accepts a ticker like AAPL and then an exchange. Is that correct? Where can I see docs for the TickHistoryMarketDepth endpoint? What do I pass as the Identifier? I notice if I swap out the exchanges for "ARC", "NY2", "NTV" and "BZX" it works… but where is this documented?