Please tell me the contents of the following csv file introduced in this book and the EIKON API Code to get the same data. This book does not describe how to obtain the data, but instead provides EIKON data as a sample file. With "get_timeseries" I couldn't reproduce the exact same data.
data = ek.get_timeseries(['AAPL.O', 'MSFT.O', 'INTC.O', 'AMZN.O', 'GS.N',' SPY', '.SPX', '.VIX', 'EUR=', 'XAU=', 'GDX', 'GLD'], ['CLOSE'], '2010-1-1','2020-10-1') data
ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
@Takeshi.Matsuda You should be aware of the API limits - you can find these in this document. You will notice that the get_timeseries API call has a limit of '3,000 data points (rows) for interday intervals and 50,000 data points for intraday intervals. This limit applies to the whole request, whatever the number of requested instrument.'
Please try this code which iterates across the instrument list to get the correct data without truncation due to limits.
import eikon as ek import pandas as pd import numpy as np instruments = ['AAPL.O', 'MSFT.O', 'INTC.O', 'AMZN.O', 'GS.N',' SPY', '.SPX', '.VIX', 'EUR=', 'JPY=', 'GDX', 'GLD'] s = '2010-01-01' e = '2020-10-1' inv = 'daily' data1 = pd.DataFrame() for i in instruments: df1 = ek.get_timeseries(i, # RICs fields=['CLOSE'], # fields to be retrieved start_date=s, # start time end_date=e, # end time interval=inv) df1.rename(columns = {'CLOSE': i}, inplace = True) if len(data1): data1 = pd.concat([data1, df1], axis=1) else: data1 = df1 data1
I hope this can help.
The result is what I want !
Thank you for providing the code quickly and accurately.
How do you get around the restrictions? Are you narrowing down the data to be acquired each time (that is, dividing the data)?
@Takeshi.Matsuda If you look at the code you will see that we are iterating over each RIC (for i in instruments:) - so each RIC is being requested in its own API call, thereby having its own limit of 3000 rows. Then we are just concatenating each of these to our desired dataframe so we end up with the complete dataframe you see at the end.
Hi @Takeshi.Matsuda,
Regarding the second issue:
- ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
Could you detail which version of eikon lib you are using ?