Total return time series request

Is there a way to get a total return time series for a given equity (e.g., IBM)? I'm able to get the total return for an equity for a single day, but not every day between a start date and end date.

get_data("IBM=", fields = "TR.TotalReturn(Frq=D)")  <--- Gives me total return on the day you run it. 

I can see how this is done in Excel. E.g.,

=TR($D$5,"TR.TotalReturn1D.date;TR.TotalReturn1D","Frq=NA SDate=#1 EDate=#2  CH=Fd NULL=ZERO",,edate,sdate)

Best Answer

  • Jirapongse
    Jirapongse ✭✭✭✭✭
    Answer ✓

    You can specify SData, EDate, and other options from Excel to the parameters argument in Python. For example, the python code is:

    data_grid, err = ek.get_data(
    "IBM",
    fields = ['TR.TotalReturn1D.date','TR.TotalReturn1D'],
    parameters={'SDate':'2018-02-01','EDate':'2018-04-03','Frq':'D','CH':'Fd'})

    The output is:

    image

Answers