How to get available fields in TickHistoryRaw report template type?

Hi,

We are using TIckHistory REST API v2, and when I try to get the available fields on TickHistoryRaw report template type by calling the following in C#, the 'availableFields' is empty

var availableFields = _extractionContext.GetValidContentFieldTypes(ReportTemplateTypes.TickHistoryRaw);

But I get a list available list (which is not empty) when using EndOfDayPricing report template type in above statement.

Do you know the reason for this?

Thanks.

Best Answer

  • Beera.Rajesh
    Answer ✓

    Hi, please refer to attached sample C# code for TRTH v2 RAW extraction.c-code.txt

    The Tick History Raw template doesn't have individually accessible fields that can be selected. They are essentially returned from the template in bulk.


    Tick History Raw will always have the following fields:
    #RIC,Domain,Date-Time,Type,MsgClass/FID number,UpdateType/Action,FID Name,FID Value,FID Enum String,PE Code,Template Number,Key/Msg Sequence Number,Number of FIDs

    You can also verify this in the DSS GUI as well by creating a Tick History Raw report and noting that there is no tab for fields.

    Thank you,

    Regards,
    Beera

Answers

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    I have tested it; the below code is running fine.

    ExtractionsContext extractionsContext =
    new ExtractionsContext(dssUri, dssUserName, dssUserPassword);
    string sessionToken = extractionsContext.SessionToken;
    Console.WriteLine("Returned session token: " + sessionToken);
    var availableFields = extractionsContext.GetValidContentFieldTypes(ReportTemplateTypes.TickHistoryRaw);
    foreach (var field in availableFields)
    {
    Console.WriteLine(field.Name);
    }

    It returns the list of content fields.

    Domain
    History End
    History Start
    Instrument ID
    Instrument ID Type
    Sample Data

    However, with this TickHistoryRaw, you cannot select which fields to include. They are all included in the output.



  • jirapongse.phuriphanvichai

    Thanks for the reply. I again used exactly the same code as above and I still get zero size 'availableFields' ! I get the token printed though, so it must be some thing else.

    As mentioned it works with other report types like EndOfDayPricing.

    Do you have any idea what might be wrong?

    Thanks.

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    What are the versions of ThomsonReuters.Dss.RestApi.Client.dll and ThomsonRetuers.Dss.Core.RestApi.Common.dll used by the application?

    I am using 11.1.527.

    image

  • @Jirapongse

    I am using the same version as you above.

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    Could you please check that your DSS account has a permission to use TRTH? You can login via DSS GUI at https://hosted.datascope.reuters.com/. Then, select Report Templates -> Create. You should see Tick History report templates when using Permissioned Template Filter.

    image

  • @Jirapongse

    I logged in to https://hosted.datascope.reuters.com but I cannot find any Report Templates button or menu anywhere!

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    From the DATASCOPE SELECT drop down, you should see Report Templates -> Create.

    image

  • @Jirapongse

    Thanks, I found it. And I can see TickHistory the 4 templates

  • Jirapongse
    Jirapongse ✭✭✭✭✭
    @mojtaba.danai

    Are they permissioned?

    Please use the following code the trace HTTP request and response and then share the output.

    ExtractionsContext extractionsContext =
    new ExtractionsContext(dssUri, dssUserName, dssUserPassword);

    extractionsContext.ResponseReceived += async (sender, args) => {
    Console.WriteLine("\nRequest: {0}\n", args.Request.RequestUri);
    Console.WriteLine("\nResponse Status Code: {0}\n", args.Response.StatusCode);
    Console.WriteLine(args.Response.Headers.ToString());
    if (args.Request.RequestUri.ToString().EndsWith("RequestToken")) return;
    var contents = await args.Response.Content.ReadAsStringAsync();
    Console.WriteLine("Content:\n {0}", contents);
    };

    string sessionToken = extractionsContext.SessionToken;
    var availableFields = extractionsContext.GetValidContentFieldTypes(ReportTemplateTypes.TickHistoryRaw);
    foreach (var field in availableFields)
    {
    Console.WriteLine(field.Name);
    }
    Console.WriteLine("Press Enter to exit");
    Console.ReadLine();
  • @Jirapongse

    7:45:32 AM: DownloadReutersMarketData Obtaining request token

    Request: https://hosted.datascopeapi.reuters.com/RestApi/v1/Authentication/RequestToken

    Response Status Code: OK

    Pragma: no-cache

    X-Client-Session-Id: c60073ae-fbfe-478f-bfdc-5897752e879d

    X-Request-Execution-Correlation-Id: e55ba480-b0b5-4a7a-b4c9-aa9932649260

    X-App-Id: Custom.RestApi

    X-App-Version: 11.1.558.64

    Cache-Control: no-cache

    Date: Wed, 06 Sep 2017 21:45:28 GMT

    Set-Cookie: DSSAPI-COOKIE=R3479498792; path=/

    Server: Microsoft-IIS/7.5

    Request: https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/GetValidContentFieldTypes(Re portTemplateType=ThomsonReuters.Dss.Api.Extractions.ReportTemplates.ReportTemplateTypes'TickHistoryR aw')

    Response Status Code: OK

    Pragma: no-cache X-Client-Session-Id: c60073ae-fbfe-478f-bfdc-5897752e879d

    X-Request-Execution-Correlation-Id: 1be68ca2-480b-4185-b4ee-982ffcd2f49e

    X-App-Id: Custom.RestApi

    X-App-Version: 11.1.558.64

    Cache-Control: no-cache

    Date: Wed, 06 Sep 2017 21:45:30 GMT

    Set-Cookie: DSSAPI-COOKIE=R2817038826; path=/

    Server: Microsoft-IIS/7.5

    Content: {"@odata.context":"https://hosted.datascopeapi.reuters.com/RestApi/v1/$metadata#ContentFieldTypes", "value":[]}

    Press Enter to exit

    I hope this helps to identify the issue. Looks like the content value is empty!

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    This could be a permission issue, if the content field is also empty for other TickHistory templates:

    extractionsContext.GetValidContentFieldTypes(ReportTemplateTypes.TickHistoryTimeAndSales);

    extractionsContext.GetValidContentFieldTypes(ReportTemplateTypes.TickHistoryMarketDepth);


    extractionsContext.GetValidContentFieldTypes(ReportTemplateTypes.TickHistoryIntradaySummaries);

    You can contact your TR's account team to verify the permission. Otherwise, please provide us with your DSS username. Then I can contact the DSS support team to verify it.

  • @Jirapongse

    We can get the available fields for other TickHistory templates you have mentioned above like TickHistoryTimeAndSales, TickHistoryMarketDepth and TickHistoryIntradaySummaries

    So I am not sure why we can get the available fields for TickHistoryRaw. Do you still think it is permission issue?

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    I see. I will contact TRTH support team to verify this issue.

  • I have worked on a example RIC <IBM.N> and extracted Tick History RAW on REST API:

    Step 1) POST

    {
    "ExtractionRequest": {
    "@odata.type": raw-extract-for-ibmn.txt"#ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.TickHistoryRawExtractionRequest",
    "ContentFieldNames": [],
    "IdentifierList": {
    "@odata.type": "#ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.InstrumentIdentifierList",
    "InstrumentIdentifiers": [ { "Identifier": "IBM.N", "IdentifierType": "Ric" } ],
    "ValidationOptions": null,
    "UseUserPreferencesForValidationOptions": false
    },
    "Condition": {
    "MessageTimeStampIn": "GmtUtc",
    "ReportDateRangeType": "Range",
    "QueryStartDate": "2017-09-02T00:00:00.000Z",
    "QueryEndDate": "2017-09-02T23:59:59.999Z",
    "DisplaySourceRIC": false
    }
    }
    }

    Step 2) GET , received :

    {
    "@odata.context":
    "https://hosted.datascopeapi.reuters.com/RestApi/v1/$metadata#RawExtractionResults/$entity",
    "JobId": "0x05dd01d18e4b2f86",
    "Notes": [
    "Extraction Services Version 11.1.37239 (5fcaa4f4395d), Built Aug 9 2017 15:35:02\nUser ID: 9008163\nExtraction ID: 2000000002147382\nSchedule: 0x05dd01d18e4b2f86 (ID = 0x0000000000000000)\nInput List (1 items): (ID = 0x05dd01d18e4b2f86) Created: 09/07/2017 11:12:32 Last Modified: 09/07/2017 11:12:32\nReport Template: _OnD_0x05dd01d18e4b2f86 (ID = 0x05dd01d1904b2f86) Created: 09/07/2017 11:12:06 Last Modified: 09/07/2017 11:12:06\nSchedule dispatched via message queue (0x05dd01d18e4b2f86), Data source identifier (FFFFE88D9F974A13851EB8293AF3FE7F)\nSchedule Time: 09/07/2017 11:12:07\nProcessing started at 09/07/2017 11:12:07\nProcessing completed successfully at 09/07/2017 11:12:35\nExtraction finished at 09/07/2017 11:12:35 UTC, with servers: tm04n01\nInstrument <RIC,IBM.N> expanded to 1 RIC: IBM.N.\nQuota Message: INFO: Tick History Cash Quota Count Before Extraction: 12681; Instruments Extracted: 1; Tick History Cash Quota Count After Extraction: 12681, 2536.2% of Limit; Tick History Cash Quota Limit: 500\nManifest: #RIC,Domain,Start,End,Status,Count\nManifest: IBM.N,Market Price,2017-09-02T00:04:02.707833621Z,2017-09-02T21:33:50.894840139Z,Active,5\n"
    ]
    }

    Step 3) GET , received results: Please refer to attachment "RAW extract for IBM.N


    Tick History RAW data is the data directly received from the exchange feeds with no manual intervention / normalization of data. Therefore the data reflects like the sample above (Unlike other templates where you see normalized field names).

    I would like to inform that if you perform a RAW extraction over the weekend it includes REFRESH message which will provide you with the complete list of fields available on that Exchange or Market. I have attached IBM.N RAW output file , please refer to FIDs under REFRESH message.

    You can also refer to Master Field List "FID Master list with descriptions" on <http://paz.thomsonreuters.com/portal/docs/doc_browse_page.cfm?bMode=edit&channelid=11047>, it provides the complete list of FIDs.

  • @Beera.Rajesh

    I have been using C# .Net code (as mentioned in the question text) to retrieve the available fields and the received list is empty for this template.