Dear All,
I am trying to obtain historic daily CLOSE share prices with get_timeseries() in Python for the last 5 years. I am aware of the rics per request limitation, which is why I split it into portions of about 20.
I realised that the code does not give me the full time frame I specified, see data.info() return below limiting the return to 2019. However, when trying out single rics, e.g. AAPL it does seem to work.
I would appreciate some guidance on how to overcome this problem - thank you!
Dominic.
This is the code I use:
import eikon as ek
import cufflinks as cf
import configparser as cp
cf.set_config_file(offline=True)
ek.set_app_key('XXX')
rics = ['CNP.N', 'BA.N', 'LIN.N', 'WY.N', 'MCD.N', 'HD.N', 'AIG.N', 'COST.OQ', 'DIS.N', 'TRV.N', 'BBWI.N', 'LOW.N', 'SYY.N', 'MAS.N', 'CL.N', 'UNH.N', 'LLY.N', 'NWL.OQ', 'WMB.N', 'TXN.OQ']
data = ek.get_timeseries(rics,
start_date='2017-01-03',
end_date='2021-12-31',
fields='CLOSE',
interval='daily')
data.info()
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 150 entries, 2019-02-22 to 2021-12-31
Data columns (total 20 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 CNP.N 150 non-null Float64
1 BA.N 150 non-null Float64
2 LIN.N 150 non-null Float64
3 WY.N 150 non-null Float64
4 MCD.N 150 non-null Float64
5 HD.N 150 non-null Float64
6 AIG.N 150 non-null Float64
7 COST.OQ 150 non-null Float64
8 DIS.N 150 non-null Float64
9 TRV.N 150 non-null Float64
10 BBWI.N 150 non-null Float64
11 LOW.N 150 non-null Float64
12 SYY.N 150 non-null Float64
13 MAS.N 150 non-null Float64
14 CL.N 150 non-null Float64
15 UNH.N 150 non-null Float64
16 LLY.N 150 non-null Float64
17 NWL.OQ 150 non-null Float64
18 WMB.N 150 non-null Float64
19 TXN.OQ 150 non-null Float64
dtypes: Float64(20)
memory usage: 27.5 KB