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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
25 3 3 8

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-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpythonpermid-apidate
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.

Upvote
Accepted
18k 21 12 20

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 5.0 MiB each and 10.0 MiB total.

both of these answers work. thanks

Upvote
707 2 1 1

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 5.0 MiB each and 10.0 MiB total.

both of these work. thanks.

Click below to post an Idea Post Idea