I have a list of RICS for which I would like to acquire the historic closing prices. They have various 'Instrument Type Code's (OPF, ORD, ELN, DEPOSITSHS, ADR, UNT, DEBENT, PREFERRED, SENIOR, CEF, ETFB, CUM, MMF, ETFE and ETFC).
Basically I'm looking for the Date & OHLC for each of the RICS. I understand that not all of the RICS would have OHL because of the type of security, but all of the RICS should likely have a "CLOSE" and corresponding date.
Using the get_data() in Python, I get a majority of the dates and OHLC. I do not get daily Date, Close for the OPF(Open Ended Mutual Funds).
ts = pd.DataFrame() chunk_size = 50 for i in range(0, len(RICS), chunk_size): rics = RICS[i : i + chunk_size] df, err = ek.get_data(rics, ['TR.CLOSEPRICE.date','TR.CLOSEPRICE', 'TR.HIGHPRICE','TR.LOWPRICE', 'TR.OPENPRICE','TR.ACCUMULATEDVOLUME'], {'SDate':'-13Y', 'EDate':'0D'}) ts = ts.append(df, sort=False) ts
In Eikon Excel, I'd used this formula to match the Date and CLOSE of the OPF types with other instrument types...If RIC Instrument Type Code is "OPF" =RHistory("TPINX.O","NAV.Value","START:2013-05-27 INTERVAL:1D",,"SORT:DESC"), Otherwise, =RHistory("IBM",".Close","START:2013-05-27 INTERVAL:1D",,"SORT:DESC")
I'm looking to replicate this in Python for all the RICS.
I tried using get_timeseries(), but I get a "Backend error. 500 Internal Server Error". and "raise RDPError(server_response["ErrorCode"], error_message)"
data = pd.DataFrame() chunk_size = 50 for i in range(0, len(RICS), chunk_size): rics = RICS[i : i + chunk_size] df, err = ek.get_timeseries(RICS, fields='CLOSE', start_date='2018-02-12', end_date='2018-02-28', interval='daily') data = data.append(df, sort=False) data
Any help on this?
Thanks