blpapi.CorrelationId

class blpapi.CorrelationId

A key used to identify individual subscriptions or requests.

Two CorrelationId objects are considered equal if they have the same type() and:

If the type is UNSET_TYPE, then the two CorrelationId objects are always equal (as the value of both will necessarily be None).

It is possible that a user constructed CorrelationId and a CorrelationId generated by the API could return the same result for value(). However, they will not compare equal because they have a different type().

CorrelationId objects are passed to many of the Session object methods which initiate asynchronous operations and are obtained from Message objects which are delivered as a result of those asynchronous operations.

When subscribing or requesting information, an application has the choice of providing a CorrelationId they construct themselves or allowing the session to construct one for them. If the application supplies a CorrelationId, it must not re-use the value contained in it in another CorrelationId, whilst the original request or subscription is still active.

The xxx_TYPE class attributes represent the possible types of CorrelationId.

AUTOGEN_TYPE = 3

The CorrelationId was created internally by API.

INT_TYPE = 1

The CorrelationId was created from an int or long supplied by the user.

MAX_CLASS_ID = 65535

The maximum value allowed for classId.

OBJECT_TYPE = 2

The CorrelationId was created from an object supplied by the user.

UNSET_TYPE = 0

The CorrelationId is unset. That is, it was created by the default CorrelationId constructor.

__init__(*args)

CorrelationId([value[, classId=0]]) constructs a CorrelationId object.

If value is an integer (either int or long) then the created CorrelationId will have type INT_TYPE. Otherwise, it will have type OBJECT_TYPE.

If no arguments are specified, then the type will be UNSET_TYPE.

The maximum allowed classId value is MAX_CLASS_ID.

classId()
Returns

The user defined classification of this CorrelationId object

Return type

int

type()
Returns

The type of this CorrelationId object (see the xxx_TYPE class attributes)

Return type

int

value()
Returns

The value of this CorrelationId object.

Return type

int or long or object

The return value depends on this CorrelationId’s value type and could be:

  • Integer (type() == CorrelationId.INT_TYPE or type() == CorrelationId.AUTOGEN_TYPE)

  • Object (type() == CorrelationId.OBJECT_TYPE)

  • None (type() == CorrelationId.UNSET_TYPE)