Error when trying to pull data via api in python

Options
yifei
yifei Newcomer
edited December 2024 in TRTH

Hello,

I am trying to query intraday bar data in python, but my queries take a long time an results in an error. Could you please let me know where I am doing wrong? My code is copied below

image.png image.png


image.png

I got the following error message:

image.png

Thank you!!

Yifei

Answers

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @yifei

    Thank you for reaching out to us.

    According to the Notes, it looks like to be a permission issue. Please contact the Tick History support team directly via MyAccount to verify permission.

  • yifei
    yifei Newcomer

    To follow up on the question. The permission error goes away when I query by RIC instead of by ISIN (see pic below). However, this brings up a few other issues:

    • The returned object _jResp does not have a "Contents” attribute unlike what was suggested in the sample code. So it’s not clear to me how to access the extracted data.
    • The query takes a very long time to run. For a single instrument over five days at one-minute frequency, it took one minute and 40 seconds. Am I not doing this correctly or is there a way to get this to run faster? At the current speed, it is almost impossible to work with large data volumes.
    • If all my identifiers are in ISIN or CUSIP, how do I convert them into RIC?

    Query:

    image.png

    notes:

    image.png
  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @yifei

    The Tick History ExtractRaw endpoint returns data in a file.

    You need to use the JobID to retrieve a file from the following endpoint.

    https://selectapi.datascope.refinitiv.com/RestApi/v1/Extractions/RawExtractionResults('<JobID>')/$value
    

    For more information, please refer to the Retrieve data - HTTP request section on the REST API Tutorial 6: On Demand intraday bars extraction tutorial.