blpapi.CorrelationId
- class blpapi.CorrelationId(*argv, **_kwargs)
A key used to identify individual subscriptions or requests.
Two
CorrelationId
objects are considered equal if they have the sametype()
and:Hold the same (not just equal!) objects, if the type is
OBJECT_TYPE
.Hold equal integers, if the type is
INT_TYPE
orAUTOGEN_TYPE
.
If the type is
UNSET_TYPE
, then the twoCorrelationId
objects are always equal (as the value of both will necessarily beNone
).It is possible that a user constructed
CorrelationId
and aCorrelationId
generated by the API could return the same result forvalue()
. However, they will not compare equal because they have a differenttype()
.CorrelationId
objects are passed to many of theSession
object methods which initiate asynchronous operations and are obtained fromMessage
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 aCorrelationId
, it must not re-use the value contained in it in anotherCorrelationId
, whilst the original request or subscription is still active.The
xxx_TYPE
class attributes represent the possible types ofCorrelationId
.- AUTOGEN_TYPE = 3
The
CorrelationId
was created internally by API.
- INT_TYPE = 1
The
CorrelationId
was created from anint
orlong
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.
- STRUCT_SZ = 56
- UNSET_TYPE = 0
The
CorrelationId
is unset. That is, it was created by the defaultCorrelationId
constructor.
- __init__(*argv, **_kwargs)
CorrelationId([value[, classId=0]])
constructs aCorrelationId
object. Ifvalue
is an integer (eitherint
orlong
) then the createdCorrelationId
will have typeINT_TYPE
. Otherwise, it will have typeOBJECT_TYPE
. If no arguments are specified, then the type will beUNSET_TYPE
. The maximum allowedclassId
value isMAX_CLASS_ID
.
- static cidFromCPtr(ptr)
- Return type:
- classId()
- Returns:
The user defined classification of this
CorrelationId
object- Return type:
- type()
- Returns:
The type of this CorrelationId object (see the
xxx_TYPE
class attributes)- Return type:
- value()
-
The return value depends on this
CorrelationId
’s value type and could be:Integer (
type() == CorrelationId.INT_TYPE
ortype() == CorrelationId.AUTOGEN_TYPE
)Object (
type() == CorrelationId.OBJECT_TYPE
)None
(type() == CorrelationId.UNSET_TYPE
)