Refinitiv Data Library for Python

stream.on_error

Called when a data retrieval error happens.

Module

refinitiv.data.content.pricing

Syntax

stream.on_error(func)

Parameters

Value Description Data type Optional Default value
func Callable object to process the retrieved data. Callable No -

Returned value

pricing.Stream object

Usage

The following example demonstrates how to display messages received when a data retrieval error happens:

import datetime


# previously defined callable, pay attention that arguments order is important
def display_error(error, stream):
    current_time = datetime.datetime.now().time()
    print("\t{} | Received error : {}".format(current_time, error))  # noqa


definition = pricing.Definition("EUR=")
stream = definition.get_stream()
stream.on_error(display_error)
stream.open()

None