Upgrade from Eikon -> Workspace. Learn about programming differences.

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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
39 3 3 7

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-apipythonrefinitiv-dataplatform-eikonworkspaceworkspace-data-apieikon-data-api-r
icon clock
10 |1500

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

Upvotes
Accepted
80.3k 259 52 75

@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 512.0 KiB each and 1.0 MiB total.

Upvotes
39 3 3 7

Thank you very much. It works beautifully!

icon clock
10 |1500

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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