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.

Best Answer

Answers

  • 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})


  • both of these work. thanks.

  • both of these answers work. thanks