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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
1 0 2 5

python can not get the "TR.MIDPRICE" data of “AUDQM3AB3Y=”,however the excel can do it

python code is:

ek.get_data(['AUDQM3AB3Y='],{"TR.MIDPRICE": {'params': {'SDate': '2017-12-28', 'CALCMETHOD': 'CLOSE', 'Points': 1}}})[0]

run it,we can get NAN like this:

Instrument Mid Price
0 AUDQM3AB3Y= NaN

However in excel,we can get the data.

EXCEL code is:

=RHistory("AUDQM3AB3Y=","MID_PRICE.Timestamp;MID_PRICE.Close","START:2017-12-28 NBROWS:1 TRADETIME:YES INTERVAL:1D",,"TSREPEAT:NO SORT:ASC NULL:NA CH:Fd")

Only AUD currency has this problem,AUDQM3AB5Y=, AUDSM6AB2Y=, AUDQM3AB3Y= all can not get the data through python.

However other currency like USDAM3L2Y=; CADSB3BA2Y=;CHFAB6L10Y= do not has the problem, they can get the data through excel or python.

How can I deal with the problem?

THANKS

eikoneikon-data-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpythonexcel
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
4.6k 26 7 22

The equivalent to RHistory in Excel is get_timeseries() The only problem here is that the get_timeseries() currently only supports the default "view", which for OTC instruments is BID. So, to summarise - there is no way that you can get the mid price into python, unfortunately.

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.

Thanks for your answer.

But there is no problem with other currency RIC, such as: USDAM3L2Y=;CADSB3BA2Y=;CHFAB6L10Y=;GBPSB6L10Y=;SGDSB6SO4Y= and so on. I can get the mid data using get_data() in python, which is the same with the RHistory data in Excel. As you said, no way unfortunately to get the mid price in python. How to explain it?

Eikon python API not support AUD only?

Thanks very much !

Sorry for a bit of a delay on this, I did not understand your question fully.

You were referring to the RHistory() function in Excel, the equivalent of which in Python is get_timeseries(). The get_timeseries() function at the moment only supports the default set of fields, which is BID for all currency instruments. I hope this clarifies the difference between RHistory and get_timeseries().

Now, as for AUD, when you perform a get_data() call with TR.MIDPRICE, it accesses the reference database, and @chavalit.jintamalit has correctly pointed you to the data support desk.

Hope this clarifies it.

Just to add one more thing. It seems like the MID price for AUD IRS is available through get_data(), therefore, the content issue was fixed. The equivalent call for get_data() for last 100 points in Excel will be:

=TR("AUDQM3AB5Y=";"TR.MIDPRICE.date;TR.MIDPRICE.value";"SDate=0 EDate=-99")
Upvotes
18k 21 12 20

Using Data Item Browser to check the data, it also returns no value.

This is the equivalent call on Excel:

=TR("AUDQM3AB5Y=","TR.MIDPRICE(CALCMETHOD=CLOSE)","SDate=2017-12-28 Points=1 CH=Fd RH=IN")

Which also returns Null value.

AUDQM3AB5Y=  NULL

Please submit data question to ContactUs.


capture.png (55.0 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.

=RHistory("AUDQM3AB3Y=","MID_PRICE.Timestamp;MID_PRICE.Close","START:2017-12-28 NBROWS:1 TRADETIME:YES INTERVAL:1D",,"TSREPEAT:NO SORT:ASC NULL:NA CH:Fd")

what is the equivalent call of this on python.

thanks

Upvotes
23k 22 9 14

Does this example help:

df, err = ek.get_data("AUDQM3AB5Y=", 
     [ 
     'TR.MIDPRICE.date',
     {'TR.MIDPRICE.value':{'params':{'SDate': '20171228','CALCMETHOD': 'CLOSE'}}},
     {'TR.MIDPRICE.value':{'params':{'SDate': '20180110','CALCMETHOD': 'CLOSE'}}},
     {'TR.MIDPRICE.value':{'params':{'SDate': '1D','CALCMETHOD': 'CLOSE'}}},
     ])

resulting in:

    Instrument                  Date  Mid Price  Mid Price  Mid Price
0  AUDQM3AB5Y=  2018-01-24T00:00:00Z      2.395      2.375      2.503

Note, that TR.MIDPRICE.date is the date of the run, with TR.MIDPRICE.value defined by SDate parameter

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