How to use Python to get a stock's 5-minute K-line history from the Ekion API?

Best Answer

  • Hi @yuyang

    Please try this code:

    #pip install refinitiv.dataplatform
    import refinitiv.dataplatform as rdp
    rdp.open_desktop_session('xxxxxxxxxxxxxx')
    df = rdp.get_historical_price_summaries(
            universe = 'TSLA.O',
            interval = rdp.Intervals.FIVE_MINUTES,
            start = '2021-02-20',
            end = '2021-02-21'     )
    df

    image

Answers

  • Thank you for your reply, but all our codes are based on Eikon (Import Eikon as EK), your method needs to install a new package, I would like to know whether Eikon's method can get 5 minutes of historical data?

  • Hi @yuyang

    The ek.get_timeseries does not support 5 Minutes data.


    You can run help(ek.get_timeseries) to see the description

    interval: string
    Data interval.
    Possible values: 'tick', 'minute', 'hour', 'daily', 'weekly', 'monthly', 'quarterly', 'yearly' (Default 'daily')
    Default: 'daily'


    You may use ek to get minute data and drop 4 of every 5 records.

  • I use the method you provided (Ek.get_TimesSeries ()) to get the TSLA time-sharing data of a certain day, such as the historical time-sharing data of 2021-02-18. The data returned is from 0:00 to 01:00 and from 9:01 to 23:59 on the 18th. How can these data be distinguished between pre-market data, intra-market data and post-market data during that period?

  • Hi @yuyang

    image

    The time you see is in GMT and I believe that this is one trading day data.

    However, for the content question as to when is the pre-market, trading, post-market.

    For an authoritative answer to any content questions, the best resource is the Refinitiv Content Helpdesk.
    This forum is dedicated to things specific to the use of Eikon APIs.
    The moderators here do not have deep expertise in every type of content available through Eikon.
    The Refinitiv Content Helpdesk can be reached using Contact Us capability in your Eikon application.
    Or by calling the Helpdesk number in your country.
    Or at https://my.refinitiv.com/