LSEG Data Library for Python

recorder.get_history

The recorder.get_history method allows access to stored updates of the recorder object.

Module

lseg.data

Syntax

recorder.get_history()

Parameters

None

Returned value

A Pandas DataFrame, showing bid and ask pricing in columns, with timestamps in rows.

Usage

The following example demonstrates how to print the previously recorded history:

import time
import lseg.data as ld


stream = ld.open_pricing_stream(
    universe=['GBP=', 'EUR=', 'JPY='],
    fields=['BID', 'ASK'],
)

stream.recorder.record(frequency='3s')
time.sleep(10)
stream.recorder.stop()
stream.close()

history = stream.recorder.get_history()
print(history.to_string())

This example produces the following output:

> Response

                              EUR=                                                            GBP=                                                            JPY=                                                         ticks count
                               ASK                             BID                             ASK                             BID                             ASK                             BID                                    
                              open    high     low   close    open    high     low   close    open    high     low   close    open    high     low   close    open    high     low   close    open    high     low   close            
Timestamp                                                                                                                                                                                                                             
2023-04-20 10:15:19.530878  1.0958  1.0959  1.0957  1.0959  1.0957  1.0957  1.0955  1.0955  1.2443  1.2444  1.2442  1.2443  1.2439  1.2442  1.2439  1.2439  134.51  134.52  134.50  134.50  134.48  134.49  134.48  134.49          19
2023-04-20 10:15:22.553718  1.0958  1.0959  1.0958  1.0958  1.0957  1.0957  1.0955  1.0957  1.2444  1.2444  1.2441  1.2444  1.2440  1.2440  1.2439  1.2440  134.51  134.52  134.50  134.51  134.48  134.51  134.48  134.48          16
2023-04-20 10:15:25.576321  1.0959  1.0959  1.0958  1.0959  1.0955  1.0957  1.0955  1.0955  1.2443  1.2444  1.2442  1.2443  1.2439  1.2441  1.2439  1.2439  134.51  134.53  134.51  134.51  134.48  134.50  134.48  134.48          21
2023-04-20 10:15:26.530178  1.0958  1.0958  1.0958  1.0958  1.0954  1.0954  1.0954  1.0954  1.2443  1.2443  1.2442  1.2443  1.2439  1.2441  1.2439  1.2439  134.51  134.53  134.51  134.52  134.50  134.50  134.48  134.49           8

None

42 words (0:13 mins)