How to use the Eikon API to get the data of the red box field in the screenshot below and its histor

Best Answer

  • @yuyang Please try:

    df,err = ek.get_data(["AAPL.O"],["TR.H.PE/PERCENT_CHG(TR.F.EPSDilExclExOrditemsComTot(Period=LTM,Methodology=InterimSum),wsize=-1)","TR.F.PriceToEPSDilExclExOrdComTot(Period=FY-1)/PERCENT_CHG(TR.F.EPSDilExclExOrditemsComTot(Period=FY-1),wsize=-1)","TR.F.PriceToEPSDilExclExOrdComTot(Period=FY0)/PERCENT_CHG(TR.F.EPSDilExclExOrditemsComTot(Period=FY0),wsize=-1)","TR.H.PriceToSalesPerShare","TR.F.PriceToTotRevPerShr(Period=FY-1)","TR.F.PriceToTotRevPerShr(Period=FY0)","TR.H.PriceToCFPerShare","TR.F.PriceToNetCFOpPerShr(Period=FY-1)","TR.F.PriceToNetCFOpPerShr(Period=FY0)"])

    df.transpose()

    image

    I hope this can help. In future you can just hover over the question mark icon next to the field you are interested in and it will give you the formula in excel but you can use the fieldname in python as well by inserting them into the above structure.