How do i get the latest market price for instrument Apple

How do i get the latest market price for instrument Apple, i.e during market trading hours. via get data and get time series.

Best Answer

  • aramyan.h
    Answer ✓

    I would suggest using get_history for historical data. Please not that you can combine the pricing and fundamental data fields in a single get_history request:

    rd.get_history(
    universe=["AAPL.O"],
    fields=["BID", "ASK", 'TR.RevenueMean'],
    )

    screenshot-2023-10-23-at-193742.png

    Best regards,

    Haykaz

Answers

  • Hi @ken03 ,


    You can use refinitiv data libraries to get the pricing data, including the market prices. Please find examples of using get_data and get_history function in our GitHub repo:

    Example.DataLibrary.Python/Examples/1-Access at main · LSEG-API-Samples/Example.DataLibrary.Python (github.com)


    Hope this helps and please let me know should you have any further questions.


    Best regards,

    Haykaz

  • Hi Haykaz,

    There is a start date and an end date, i am wondering say if i am in the middle of the trading day and want the most current prices instead of 1 day before how should i set the end date? is it 1?



  • Hi @ken03 ,


    If you are looking into intraday data, you can use get_history function with a more granular interval parameter (Supported values: tick, tas, taq, minute, 1min, 5min, 10min, 30min, 60min, hourly, 1h, daily, 1d, 1D, 7D, 7d, weekly, 1W, monthly, 1M, quarterly, 3M, 6M, yearly, 1Y). Below is an example with tick level granularity:

    df  = rd.get_history("AAPL.O", fields =['TRDPRC_1', 'BID', 'ASK'],  interval = 'tick', count = 1000)


    screenshot-2023-10-23-at-153859.png

    You can also resample the output with a different frequency, using, eg:

    df.ohlc("5s")


    Best regards,

    Haykaz

  • Haykaz i notice that the timestamp format which i pull from get_history and get_data is different, in that get_data has a yz at the end of the time. I am trying to combine the time series data with fundamental data