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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
1 1 1 0

How would you get ohlc data for regular trading hours in the python Eikon Data Api?

When I pull some OHLC data through the python API, through either get_data() or get_timeseries() I get the bar for the entire day. Can I restrict it to regular trading hours, and how would I do that?

eikoneikon-data-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpythonpricing
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
39.2k 75 11 27

Trade summarization into OHLC is performed in accordance with exchange or market regulation or practice. For US stocks for example pre and post market trades are excluded from daily OHLC summarization. For some other markets there may be different RICs for different sessions, e.g. for cash settled corn futures on Brazilian B3 exchange "0#CCM:" chain provides consolidated quotes, "0#1CCM" chain provides after hours quotes and chain "0#2CCM:" provides regular session quotes.

If you would like an explanation how trades are summarized into daily OHLC for a specific market you're following, or if you'd like to know whether there are RICs that differentiate between trading sessions for this market, the best resource is Refinitiv Helpdesk, which you can reach using Contact Us capability in your Eikon application or by visiting MyRefinitiv. The moderators on this forum do not have deep expertise in every type of content available through Refinitiv products, however such expertise is available through the Helpdesk.

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
13k 32 12 18

Hi @sanjeev.sethi,

The get_timeseries call be used to restrict the time range like this:

>>> df = ek.get_timeseries("IBM.N", start_date = "2020-12-01T15:04:05", end_date = "2020-12-05T15:04:05", interval="minute")

>>> df
IBM.N                  HIGH     LOW    OPEN   CLOSE  COUNT  VOLUME
Date
2020-12-01 15:05:00  125.11  125.05  125.09  125.07     18    2014
2020-12-01 15:06:00  125.10  125.03  125.03  125.04     35    3958
2020-12-01 15:07:00  125.11  124.99  125.05  125.11     36    3045
2020-12-01 15:08:00  125.30  125.14  125.14  125.22     56    6730
2020-12-01 15:09:00  125.29  125.14  125.24  125.14     31    2075
...                     ...     ...     ...     ...    ...     ...
2020-12-04 20:57:00  127.10  127.07  127.07  127.07    104   10998
2020-12-04 20:58:00  127.10  127.06  127.06  127.08     80   11037
2020-12-04 20:59:00  127.13  127.06  127.07  127.13     88   14943
2020-12-04 21:00:00  127.22  127.12  127.14  127.17    238   31626
2020-12-04 21:01:00  127.20  127.20  127.20  127.20      1  388463

[1529 rows x 6 columns]

The time is in the UTC - '%Y-%m-%dT%H:%M:%S' format.

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