Hi Team,
Can you advise what script can we use in Python Eikon API to get the Historical 1 minute interval data between 15:30 – 17:30 CET for the last 90 days.
Sample RICs
ADSGn.DE
AIRG.DE
ALVG.DE
BASFn.DE
BMWG.DE
Hi @dianne.palmario and @kenley.macandog123,
Here's the code
import eikon as ekimport pandas as pdimport datetimeek.set_app_key('####YOUR_APP_KEY####')rics = ['ADSGn.DE','AIRG.DE','ALVG.DE','BASFn.DE','BMWG.DE']df_list = []today = datetime.datetime.today()start_date = today - datetime.timedelta(90)# looping to get the data of 30 days in each callwhile start_date < today: end_date = start_date + datetime.timedelta(days=30) df = ek.get_timeseries(rics, start_date=start_date, end_date=end_date,interval='minute') df_list.append(df) start_date = end_date + datetime.timedelta(days=1) result = pd.concat(df_list)#display(result)# filter the time intervaldf_duration = result.iloc[(result.index.time >= datetime.time(14, 30))&(result.index.time <= datetime.time(16, 30))]display(df_duration)
Hope this helps and please let me know in case you have any further questions.
Hi @kenley.macandog123 ,
Is this what you're looking for?
First, to get the Historical 1-minute interval data in the last 90 days. However, as there's a limit of an API call in Eikon, so please check this Eikon Data API Usage and Limits Guideline and adjust the start_date, and end_date to not exceed the Eikon Limits.
import eikon as ekimport datetimefrom datetime import timeek.set_app_key('####YOUR_APP_KEY####')df = ek.get_timeseries(['ADSGn.DE','AIRG.DE','ALVG.DE','BASFn.DE','BMWG.DE'], start_date=datetime.timedelta(-90), end_date=datetime.timedelta(0), interval='minute')display(df)
Then after you get the data of the last 90 days, you can filter only the time you're interested, to confirm the timezone of data returned, you may check with the Content team by raising the ticket via MyRefinitiv.
Hi @kenley.macandog123 and @dianne.palmario ,
as mentioned in this thread that
get_timeseries method of Eikon Data APIs library always returns timestamps in GMT.
You may find another way to do the time conversion, in this case, I'm using the time range you used
df1 = df.iloc[(df.index.time >= datetime.time(14, 30))&(df.index.time <= datetime.time(16, 30))]display(df1)
However, as the data returned is less than latest 90 days due to the Eikon API call limit, you need to call a get_timeseries function in loops with the parts of latest 90 days and then merge the data together.
@raksina.samasiri
Can you please provide a script that calls a get_timeseries function in loops with the parts of latest 90 days? Like how the script would look like so that we can see more than the latest 90 days limitation?
thx a lot for the script, a nice way to solve the problem.
I appreciate it a lot.
Regards,
Silvio