Hi! My question relates to minimising my total number of API calls by applying functions to time series data on the server side.
I understand that the 'get_timeseries' method in the python Eikon module - as of this version - can only return a limited number of fields. But it is possible to query time series via the 'get_data' method using a construction like:
exp = 'MSFT.O' fields = ['TR.TotalReturn.Date','TR.TotalReturn'] params = {"SDate":"2018-10-01","EDate":"2018-10-17","Frq":"D","CH":"Fd"} manual_ts = ek.get_data(exp,fields,params)
Now, what if I want to apply an aggregate-style function to my time series, and just return a single value? In excel, you would use a formula like this:
=TR($B14,"AVG(TR.FwdPe)","Period=FY1 Frq=M SDate=0D EDate=-10AY")
This returns the average Forward Price/Earnings over the last 10 years.
How would I implement this in the python API? I've tried something like this, but to no avail:
ek.get_data('MSFT.O',['AVG(TR.FwdPe)'],{"SDate":"2018-10-01","EDate":"2018-10-17","Frq":"D"})