question

Upvotes
Accepted
3 0 1 4

Exact definition of fields some fields when using rd.get_history() in python (using refinitiv.data as rd)

Hi,

I am using your get_history() method from the "refinitiv.data" library, e.g.:

import refinitiv.data as rd
rd.open_session()
df = rd.get_history(
    universe= "AAPL.OQ",
    start= dt.date.today() - dt.timedelta(days=300),
    end= dt.date.today(),
    interval= "5min",
    parameters= {"Fill": "None"}
)
rd.close_session()
print(df)


The example above will output something like:

AAPL.OQ
Timestamp…ASK_HIGH_1
ASK_LOW_1
OPEN_ASK
ASK
…3/27/2023 8:45…160159.8159.8160…3/27/2023 8:50…160159.78159.89160……………………


It is not clear to me to which point in time the following fields refer to exactly:

  • MID_PRICE
  • BID
  • ASK
  • TRDPRC_1

e.g. "ASK":

Let's look at "3/27/2023 8:45", it has the value "160". If I look at the description in the 'Data Item Browser' (DIB), it tells me that "ASK" refers to the "latest ask price". If you take this literally it would translate to the ask price that could have been observed on the instrument at exactly 8:45. If that is true, I would expect the OPEN_ASK for the next timestamp to be 160 (OPEN_ASK[t+1] == ASK[t]). In the returned data OPEN_ASK is 159.89 (please note: this is real data).

Could you please elaborate what the 4 mentioned fields show me exactly.
Your help is highly appreciated!


Best and thanks in advance

#technology#contentrefinitiv-data-platformpython 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.

I just realized that the table I pasted has warped, please find a screenshot belowcapture.png

capture.png (7.4 KiB)
Upvotes
Accepted
51 0 0 2

There is no requirement for Open(t)=Close(t-1). Both the price (TRDPRC_1 or MID_PRICE) as well as quote (BID or ASK) can differ on the marking timestamps.Let's take OPEN_ASK and ASK (CLOSE) between 8:45 and 8:55 as an example. The OPEN_ASK stamped with 8:50 will be the first (open) available quote in the range of 8:50:01 to 8:55:00. Then ASK (CLOSE) at 8:45 will be the last (close) available quote in range of 8:45:01 to 8:50:00. As you can see quotes (or prices traded) do not have to be equal (even though they often will for the price can make no immediate shift over the period). The price will vary most often (sometimes even considerably) over the illiquid markets/instruments or during low frequency trading periods.

The most basic example can be observed on Daily prices / quotes and the gaps seen frequently especially during inflated volatility periods. This is similar to the aboce example only the interval is not 5-min but 24-hours.

To better understand, below is an example where I compare 5-min quotes to actual ticks (all available market quotes). Since RDP Excel does not allow to retrieve data older than 3 months I am using todays quotes for AAPL.OQ (trading in premarket). See how ASK (close) stamped 9:10 retrieves a 191.87 USD at 9:14:53 whereas OPEN_ASK stamped 9:15 retrieves 191.86 USD at 9:15:11.

1-22-2024-2-36-48-pm.png
Get.History_close.open.interval.logic.xlsx.zip


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
15.5k 32 5 10

Hi @felix.echtermeyer ,

Thank you for posting the question in this forum. However, this forum is dedicated to an API usage question hence, the moderators on this forum do not have deep expertise in every type of content available through Refinitiv products. Such expertise is available through Refinitiv Helpdesk, which can be reached via MyRefinitiv. To be of help, ticket number 13240909 was raised on your behalf and the support team is going to contact you directly to assist with this.

Hope this helps and please let me know in case you have any further questions.

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.

The discrepancy you observed between the ask price at "3/27/2023 8:45" and "OPEN_ASK" at "3/27/2023 8:50" could be due to various factors such as market volatility, liquidity, or the frequency of updates in the bid-ask spread.

that's not my neighbor

Thank you for contacting the forum with your question. While this platform is primarily focused on API usage requests, our moderators are committed to providing assistance whenever possible. However, for specific inquiries about Refinitiv products outside of using the API, we recommend contacting the dedicated support team via MyRefinitiv. Also, buy discussion board post is available here https://studyfy.com/write-my-discussion-board-post

Upvotes
51 0 0 2

Hi Felix,

Let's look at your string of values: …3/27/2023 8:45…160159.8159.8160…3/27/2023 8:50…160159.78159.89160……………………


Now, let's put them into context by limiting the data coverage with:


df = rd.get_history(

universe= "AAPL.OQ",

start= "2023-03-27 08:00:00",
end="2023-03-27 09:00:00",

interval= "5min",

parameters= {"Fill": "None"} )

print(df)


What you will see now is sth like this:

1-22-2024 11-31-04 AM


I highlighted your string, you can see that it covers a few consecutive summary "get.history" data items (you can specify fields to display with "fields=" , eg. fields=["BID", "ASK"]), ie.:

  • "ASK HIGH", "ASK LOW", "OPEN ASK" and "ASK"
  • by set interval of 5 minutes, ie. first at 8:45, then 8:50, etc.

As you can see "ASK" itself shows constant 160 USD both at 8:45 and 8:50, just as expected.

As for the TIMESTAMP, the prices are delivered by the end of given interval in GMT Timezone ,ie. 8:45:00 will show last available quoted/traded price in the range of 8:45:00 to 8:50:00.

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.