New posts are disabled while we improve the user experience.

You can browse the site, or for urgent issues, raise a query at MyAccount.

question

Upvotes
Accepted
23 11 18 24

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"
        }
    }
}
dss-rest-apidsstradedateon-demand-extraction
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

@Gurpreet do you idea how to provide filter based on date in the extraction request ?

1 Answer

· Write an Answer
Upvotes
Accepted
87.8k 294 53 79

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


1657270367767.png (38.7 KiB)
1657270748147.png (26.9 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

@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 ?
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.