For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
19 0 1 2

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!


eikoneikon-data-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpythoneikon-data-api-r
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
Accepted
38.1k 71 35 53

@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:


1605164031410.png (16.1 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
19 0 1 2

Thank you very much. It works beautifully!

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea