How to filter trade date for CompositeExtractionRequest

rahul.deshmukh
rahul.deshmukh Contributor

Hallo All,

I have below CompositeExtractionRequest where i want to fetch the response on specific date based on trade date. So i want to get the data from 01.07.2022, 02.07.2022 and 06.07.2022 and i want to filter this with trade date. How to specify this filter in the extraction request ?


requestHeaders = {
    "Prefer": "respond-async",
    "Content-Type": "application/json",
    "Authorization": "token " + token
}

requestBody = {
    "ExtractionRequest": {
        "@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.CompositeExtractionRequest",
        "ContentFieldNames": [
            "ISIN","RIC","Trade Date","Market MIC","Market Segment MIC","Average Volume - 30 Days","Average Volume - 90 Days","Close on Close Volatility - 90 Days","Dollar Daily Value Average - 30 Days","Outstanding Shares - Issue Shares Amount","Contributor Code","Ask Price","Bid Price"
        ],
        "IdentifierList": {
            "@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.InstrumentIdentifierList",
            "InstrumentIdentifiers":
                dc
        ,
        "ValidationOptions": {
                "AllowInactiveInstruments": "false"
            },
            "UseUserPreferencesForValidationOptions": "false"
        },
        "Condition": {
            "ScalableCurrency": "true"
        }
    }
}

Best Answer

  • Jirapongse
    Jirapongse ✭✭✭✭✭
    Answer ✓

    @rahul.deshmukh

    You can not specify the query date in the CompositeExtractionRequest, as shown in the REST API Reference Tree.

    1657270367767.png

    To get Trade on the specific dates, you need to use other requests, such as

    PriceHistoryExtractionRequest which supports the QueryStartDate and QueryEndDate parameters.

    1657270748147.png

    For example, the request looks like this:

    {
    "ExtractionRequest": {
    "@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.PriceHistoryExtractionRequest",
    "ContentFieldNames": [
    "File Code",
    "RIC",
    "Trade Date",
    "Last Trade Price",
    "Official Close Price",
    "Universal Close Price",
    "High Price",
    "Low Price",
    "Open Price",
    "Turnover",
    "Volume"
    ],
    "IdentifierList": {
    "@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.InstrumentIdentifierList",
    "InstrumentIdentifiers": [
    {
    "Identifier": "ALVG.DE",
    "IdentifierType": "Ric"
    },
    {
    "Identifier": "IBM.N",
    "IdentifierType": "Ric"
    },
    {
    "Identifier": "DE000A168205",
    "IdentifierType": "Isin"
    }
    ],
    "ValidationOptions": {
    "AllowHistoricalInstruments": true
    },
    "UseUserPreferencesForValidationOptions": false
    },
    "Condition": {
    "AdjustedPrices": true,
    "QueryStartDate": "2022-07-01T00:00:00.000Z",
    "QueryEndDate": "2022-07-06T00:00:00.000Z"
    }
    }
    }

    The output is:

    {
        "@odata.context": "https://selectapi.datascope.refinitiv.com/RestApi/v1/$metadata#DataScope.Select.Api.Extractions.ExtractionRequests.ExtractionResult",
        "Contents": [
            {
                "IdentifierType": "Ric",
                "Identifier": "ALVG.DE",
                "File Code": "62",
                "RIC": "ALVG.DE",
                "Trade Date": "2022-07-01",
                "Last Trade Price": null,
                "Official Close Price": 182,
                "Universal Close Price": 182,
                "High Price": 183.46,
                "Low Price": 179.18,
                "Open Price": 179.42,
                "Turnover": 148841435.98,
                "Volume": null
            },
            {
                "IdentifierType": "Ric",
                "Identifier": "ALVG.DE",
                "File Code": "62",
                "RIC": "ALVG.DE",
                "Trade Date": "2022-07-04",
                "Last Trade Price": null,
                "Official Close Price": 183.02,
                "Universal Close Price": 183.02,
                "High Price": 184.36,
                "Low Price": 182.48,
                "Open Price": 182.92,
                "Turnover": 92968189.64,
                "Volume": null
            },

    You can use the HTTP GET method with the Extractions/GetValidContentFieldTypes(ReportTemplateType=DataScope.Select.Api.Extractions.ReportTemplates.ReportTemplateTypes'PriceHistory') endpoint to see all available fields in the PriceHistoryExtractionRequest .

Answers