eikonapir: how to get dates returned from get_data()

Hi,

I wonder how to get dates returned from get_data() of the "philaris/eikonapir" package. I'd like to download SPY's market cap over a period. Using eikon package in Python, I can get this done easily with ek.get_data() as follows:

df, err = ek.get_data('SPY',['TR.CompanyMarketCap', 'TR.CompanymarketCap.Date'], {'SDate':'2020-01-02', {'EDate:'2020-10-31'})

However, if I use the get_data() in eikonapir package in r in the same fashion as follows,

sample_period = list('SDate'='2020-01-02', 'EDate'='2020-10-31')

fields = list(TR_Field('tr.companymarketcap', sample_period), TR_Field('tr.companymarketcap.date'))

df = eikonapir::get_data('SPY', fields)

the date column in the dataframe df returns only the last date of the sample period, instead of all the dates in the sample period.

I would highly appreciate any advice/suggestion to get all the dates returned with aikonapir::get_data()!

Thank you!


Best Answer

  • @tta

    Please try this one:

    data_frame2 <- get_data(list("SPY"), 
                            list("TR.CompanyMarketCap", "TR.CompanymarketCap.Date"),
                            list("Frq"="D","SDate"="2020-01-02","EDate"="2020-10-31"))
    data_frame2

    The output is:

    image

Answers