New posts are disabled while we improve the user experience.

You can browse the site, or for urgent issues, raise a query at MyAccount.

question

Upvotes
Accepted
1 2 4 8

Can you use the .COM API or Data API to pull intraday mid-prices? Just need the field in Python is the end goal.

eikoneikon-data-apipythonworkspacerefinitiv-dataplatform-eikonworkspace-data-apiapieikon-com-api
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
25.4k 90 13 26

Hi @danny.mullins1

If you just want to snap the Mid price as and when required you can use Eikon Data API get_data function e.g.

ek.get_data(instruments = 'VOD.L',fields = ['TR.MIDPRICE'])

You can get more information on the get_data function here:

https://docs-developers.refinitiv.com/1558082609136/14684/book/en/eikon/index.html#get_data

If you want streaming data i.e. to be informed each time the mid price changes, then you can use the Streaming functionality as described here. There is a link to some examples at the bottom of that page.

Note that for Streaming data, not only will the field names will be different e.g. 'MID_PRICE' instead of TR.MIDPRICE - but also not all exchanges/asset classes provide a MID_PRICE - so you may have to calculate from the BID and ASK price.


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
1 2 4 8

Thanks Umer,

I would like streaming for minute by minute for 60 minutes - I tested this out but could not find the solution.

E.g. 60 mins worth of minute bar for mid-price for EUR=... Is this possible or will it just update singular values upon changing?

Happy to talk offline if that's easier.

Best,

Danny

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
25.4k 90 13 26

Hi,

The streaming will send an update as and when the value changes in the market (allowing for conflation on the feed) - not at regular intervals.

Otherwise, you can use the get_data and control the timing yourself e.g. call the get_data method every 60 seconds.

Or, if you don't actually need the data streaming and just want the past 60 minutes of data then you might be able to use timeseries data.

data = ek.get_timeseries("EUR=",  # the RICs
                         count=60,
                         interval = 'minute')  

Whilst this actually returns HIGH,LOW,OPEN and CLOSE for each minute - a quick observation seemed to suggest the HIGH price is the highest MID price - you will need to check with the Content helpdesk to confirm if this is indeed the case.

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
25.4k 90 13 26

Hi @danny.mullins1

You could also try something like this for get_data approach if the get_timeseries does not work out:

starttime=time.time()
while time.time() < (starttime+3600):
    mid = ek.get_data(instruments = 'VOD.L', fields = ['TR.MIDPRICE'])
    print(mid)
    time.sleep(60.0 - ((time.time() - starttime) % 60.0))


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.