question

Upvotes
Accepted
19 2 3 6

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.

#technologyrefinitiv-data-libraries
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
Accepted
7.2k 18 2 8

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


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvote
7.2k 18 2 8

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

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
19 2 3 6

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?



icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

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

Upvotes
19 2 3 6

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

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.