How to filter trade date for CompositeExtractionRequest

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
    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

  • @Gurpreet do you idea how to provide filter based on date in the extraction request ?
  • @Jirapongse thanks! i tried to use "QueryStartDate": "2022-07-01T00:00:00.000Z", "QueryEndDate": "2022-07-06T00:00:00.000Z" but the python code is failing ..i dont know the date format is issue here ?

  • @rahul.deshmukh

    Please share the request that you are using in Python.

    What is the error message?

  • @Jirapongse sorry i was using the Query date in the CompositeExtractionRequest...actually the problem is i am saving the data at the same time in our database table so i want to have the same field provided in the extraction request...in your extraction request the fields are different...Is it not possible to use any other date rather than trade date to get the response on the CompositeextractionRequest for the fields which i am using ?
  • @Jirapongse any idea on using the same Composite extraction request to fetch the data for certain dates ? Because if we use different extraction request with different fields, we have to change the entire implementation structure
  • @rahul.deshmukh

    The Composite extraction request doesn't support date parameters so we can not specify dates in the Composite extraction request.