Use screener with get_timeseries?

Hi all,

I am trying to get time series data on close price for a given country.

dt=ek.get_timeseries(rics='SCREEN(U(IN(Equity(active,public,primary))/*UNV:Public*/), IN(TR.ExchangeCountryCode, "NZ"))', fields='CLOSE', start_date="2016-03-01", end_date = "2017-03-01", interval = "monthly")

But it's not working, it gives an error saying something like

eikon.eikonError.EikonError: Error code -1 | SCREEN(U(IN(Equity(active,public,primary))/*UNV:Public*/), IN(TR.ExchangeCountryCode, "NZ")): Invalid RIC | 

Is the SCREEN command only works with get_data?

Is there a way to get data for all stocks from a given country?

Thanks in advance!

Best Answer

  • Hi @zzhao

    Is the SCREEN command only works with get_data?

    You cannot use SCREENER with get_timeseries.

    You can use it with get_data to build a RIC list first then pass this RIC list in your get_timeseries API call.

    Here is the sample:

    df,e = ek.get_data('SCREEN(U(IN(Equity(active,public,primary))), IN(TR.ExchangeCountryCode, "NZ"))', 'TR.RIC')
    ric_list = df['RIC'].tolist()

    dt=ek.get_timeseries(rics=ric_list, fields='CLOSE', start_date="2016-03-01",
                         end_date = "2017-03-01", interval = "monthly")
    dt

    Is there a way to get data for all stocks from a given country?

    You can use the SCREENER app to define a SCREENER formula which contains only country criteria.

    Then follow the sample process to get the RIC list and retrieve data accordingly.

Answers