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
25 5 5 9

ek.get_data - TR.PriceClose.date not working

i have the python code:

fields=[ek.TR_Field('TR.PriceClose',
                            {'Frq':'D',
                             'SDate':0,
                             'EDate':-365
                             },'asc',1),

                ek.TR_Field('TR.PriceClose.date',
                            {'Period':'D',
                             'SDate':0,
                             'EDate':-365
                             },'asc',1)

And I run this to get the data for the permid:

df,err=ek.get_data([4295905573],fields)    

This returns 1 line with <NA> for both fields.

df
Out[108]: 
            0  TR.PRICECLOSE(EDate=-9999,Frq=D,SDate=0)  \
0  4295905573                                      <NA>   

   TR.PRICECLOSE.DATE(EDate=-9999,Period=D,SDate=0)  
0                                              <NA>  

If I use JUST the field PriceClose, I get all the data, but there are no dates so kind of useless...

df
Out[112]: 
     Instrument  Price Close
0    4295281938        15.65
1    4295281938        15.65
2    4295281938        15.65
3    4295281938        15.65
4    4295281938        15.65
..          ...          ...
361  4295281938        15.65
362  4295281938        15.65
363  4295281938        15.65
364  4295281938        15.65
365  4295281938        15.65

[366 rows x 2 columns]


Need to return both price and date.

eikoneikon-data-apipythonrefinitiv-dataplatform-eikonworkspaceworkspace-data-apipermid-apidate
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.

Upvote
Accepted
18.2k 21 13 21

Hi @lgreen

Please try this code:


ahs.png (27.7 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.

both of these answers work. thanks

Upvote
1.5k 3 2 3

I guess we need to group the pair of fields (date and price) using the same period specification. Can you try:

fields = ek.get_data('4295905573',['TR.PriceClose.Date', 'TR.PriceClose'], {'SDate':0, 'EDate':-365})


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.

both of these work. thanks.

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.