Refinitiv Data Library for Python

get_data

Sends a request to the Refinitiv Data Platform to retrieve the historical pricing data described in the historical_pricing.events.Definition object.

Module

refinitiv.data.content.historical_pricing.events

Syntax

definition.get_data(session, on_response)

Parameters

Value Description Optional Data type Default value
session Session object. If it's not passed the default session will be used. Yes Session object None
on_response Callable function to process the retrieved data. Yes Callable None

Return value

Response

Usage

The following example demonstrates how to get the last five historical pricing data rows for LSEG.L:

response = historical_pricing.events.Definition(
    universe="LSEG.L",
    count=5,
).get_data()

print(response.data.df)
Response
EVENT_TYPE RTL SEQNUM TRDXID_1 TRDPRC_1 TRDVOL_1 VWAP BID BIDSIZE ASK ASKSIZE PRCTCK_1 YIELD PCTCHNG BKGD_REF TRADE_ID TRD_P_CCY TRD_STATUS HALT_RSN TRNOVR_UNS NETCHNG_1 MMT_CLASS TR_TRD_FLG ACVOL_UNS OPEN_PRC HIGH_1 LOW_1 MID_PRICE IMB_SH IMB_SIDE QUALIFIERS
2022-06-06 10:28:57.004000 quote 58816 2424538 N/A N/A N/A N/A 7270 106 7274 310 N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A 7272 N/A N/A [BID_TONE]
2022-06-06 10:28:57.004000 quote 58848 2424540 N/A N/A N/A N/A 7270 156 7274 260 N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A 7272 N/A N/A [ASK_TONE]
2022-06-06 10:28:57.004000 quote 58864 2424541 N/A N/A N/A N/A 7270 201 7274 260 N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A 7272 N/A N/A [BID_TONE]
2022-06-06 10:28:57.004000 quote 58880 2424542 N/A N/A N/A N/A 7270 201 7274 241 N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A 7272 N/A N/A [ASK_TONE]
2022-06-06 10:28:57.004000 quote 58832 2424539 N/A N/A N/A N/A 7270 156 7274 310 N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A 7272 N/A N/A [BID_TONE]

The following example demonstrates how to get the last five historical pricing data rows for GPB, specifying the start-time, end-time and corrections parameters:

import datetime

import refinitiv.data as rd
from refinitiv.data.content import historical_pricing
from refinitiv.data.content.historical_pricing import Adjustments


rd.open_session()

response = historical_pricing.events.Definition(
    universe="GBP=",
    count=5,
    start=datetime.timedelta(-1),
    end=datetime.timedelta(0),
    adjustments=[
        Adjustments.EXCHANGE_CORRECTION,
        Adjustments.MANUAL_CORRECTION
    ]
).get_data()

print(response.data.df)
Response
EVENT_TYPE RTL BID ASK MID_PRICE DSPLY_NAME SRC_REF1 DLG_CODE1 CTBTR_1 CTB_LOC1 QUALIFIERS
2022-06-06 11:13:41.758000 quote 20750 1.2555 1.2559 1.2557 N/A SAHK SAHK SANTANDER HKG N/A
2022-06-06 11:13:42.275000 quote 20814 1.2554 1.2558 1.2556 N/A BCFX N/A BARCLAYS LON N/A
2022-06-06 11:13:42.539000 quote 20878 1.2552 1.2559 1.25555 N/A N/A N/A SEB STO N/A
2022-06-06 11:13:43.307000 quote 20942 1.2554 1.2558 1.2556 N/A BCFX N/A BARCLAYS LON N/A
2022-06-06 11:13:44.268000 quote 21006 1.2554 1.2558 1.2556 N/A BCFX N/A BARCLAYS LON N/A

The following example demonstrates how to get the last five historical pricing data rows for GPB by specifying a particular interval:

import refinitiv.data as rd
from refinitiv.data.content import historical_pricing
from refinitiv.data.content.historical_pricing import Intervals


rd.open_session()

response = historical_pricing.summaries.Definition(
    "GBP=",
    interval=Intervals.FIVE_MINUTES,
    count=5
).get_data()

print(response.data.df)
Response
BID_HIGH_1 BID_LOW_1 OPEN_BID BID BID_NUMMOV ASK_HIGH_1 ASK_LOW_1 OPEN_ASK ASK ASK_NUMMOV MID_HIGH MID_LOW MID_OPEN MID_PRICE
2022-06-06 09:55:00 1.2564 1.2555 1.2557 1.2562 358 1.2569 1.2558 1.2561 1.2566 358 1.25655 1.25575 1.2559 1.2564
2022-06-06 10:00:00 1.2564 1.2552 1.2563 1.2553 405 1.2568 1.2556 1.2566 1.2557 405 1.25655 1.2555 1.25645 1.2555
2022-06-06 10:05:00 1.2556 1.2547 1.2553 1.255 372 1.256 1.2552 1.2557 1.2555 372 1.2557 1.2551 1.2555 1.25525
2022-06-06 10:10:00 1.2553 1.2546 1.2552 1.2548 365 1.2557 1.255 1.2553 1.2552 365 1.25545 1.25495 1.25525 1.255
2022-06-06 10:15:00 1.2562 1.2547 1.2548 1.2557 348 1.2566 1.2551 1.2552 1.2565 348 1.25635 1.255 1.255 1.2561

None