Upgrade from Eikon -> Workspace. Learn about programming differences.

For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
1 0 0 1

Code to get timeseries data

Hi, what is the code to get rolling history for an equity ric. I want 30 days history for MSFT.O. I copied and pasted the below code from the Eikon API document, but it is not working.


req = ek.get_timeseries(["MSFT.O"], start_date = get_date_from_today(150), end_date = get_date_from_today(100), interval="daily")

eikoneikon-data-apipythonrefinitiv-dataplatform-eikonworkspaceworkspace-data-api
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.

1 Answer

· Write an Answer
Upvotes
Accepted
18.2k 21 13 21

Hi @patturaja.muruga

You can try this code:


ahs.jpg (88.7 KiB)
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.

Thanks. But getting this error message

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-21-801a780b8b4c> in <module>
----> 1 req = ek.get_timeseries(["MSFT.O"],start_date = get_date_from_today(150), end_date = get_date_from_today(100), interval="daily")

<ipython-input-20-a9c30f6f9d8a> in get_date_from_today(offset)
      1 from datetime import date, timedelta
      2 def get_date_from_today(offset):
----> 3     return (datetime.today()- timedelta(days=offset))

AttributeError: module 'datetime' has no attribute 'today'

sorry, it should be import datetime(not date)

Pattu avatar image Pattu chavalit-jintamalit

Thanks a lot! It works now. But i need 30 days of history, when i put start_date = get_date_from_today(30) and end_date = get_date_from_today(0), it takes 30 calendar days and gives just 21 days history. What i need is 30 days of working days history. Is it possible to get it.

Show more comments

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.