Need Help with Python Code for Time and Sales

SamGarcia
SamGarcia LSEG
edited June 4 in TRTH

Hi Team,

Hoping for your assistance in providing the Python Code for the following REST API:

POST
https://selectapi.datascope.refinitiv.com/RestApi/v1/Extractions/ExtractRaw

 

{
  "ExtractionRequest": {
    "@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.TickHistoryTimeAndSalesExtractionRequest",    "ContentFieldNames": [
      "Trade - Price",
      "Trade - Volume",
      "Trade - Exchange Time",
      "Trade - Qualifiers"
    ],

    "IdentifierList": {
      "@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.InstrumentIdentifierList",  
      "InstrumentIdentifiers": [
        { "Identifier": "EDc1", "IdentifierType": "Ric" }
      ],

      "ValidationOptions": {"AllowHistoricalInstruments": true}

    },
    "Condition": {
      "MessageTimeStampIn": "GmtUtc",
      "ApplyCorrectionsAndCancellations": false,
      "ReportDateRangeType": "Range",
      "QueryStartDate": "2018-05-08T00:00:00.000Z",
      "QueryEndDate": "2018-05-08T23:59:59.999Z",
      "DisplaySourceRIC": true

    }

  }

}

Regards,

Sam Garcia

Answers

  • Hello @SamGarcia

    Your JSON request is valid and is able to extract the time and sales data. What do you need help with?

    #RIC,Alias Underlying RIC,Domain,Date-Time,GMT Offset,Type,Price,Volume,Qualifiers,Exch Time
    EDc1,EDK8,Market Price,2018-05-08T04:52:05.306426694Z,-5,Trade,97.625,749,^[ACT_TP_1];BBO[MKT_ST_IND];BID  [AGGRS_SID1],04:52:05.299000000
    EDc1,EDK8,Market Price,2018-05-08T05:11:34.546484146Z,-5,Trade,97.625,1,"  [ACT_TP_1];BBO[MKT_ST_IND];ASK  [AGGRS_SID1]",05:11:34.537000000
    EDc1,EDK8,Market Price,2018-05-08T05:16:22.572264299Z,-5,Trade,97.6275,1,^[ACT_TP_1];BBO[MKT_ST_IND];BID  [AGGRS_SID1],05:16:22.566000000
    ...
    

    If you are looking for the Python code for this request, then please check out this article.

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @SamGarcia

    We provide the Postman collection example.

    Postman can generate the Python snippet code for a request message. Please refer to this Generate code for a REST API call using Postman in just a few clicks article.