blpapi.Message¶
-
class
blpapi.Message¶ A handle to a single message.
Messageobjects are obtained by iterating anEvent. EachMessageis associated with aServiceand with one or moreCorrelationIdvalues. TheMessagecontents are represented as anElementand allElement’s accessors could be used to access the data.The possible fragment types are:
The possible recap types are:
Messageobjects are always created by the API, never directly by the application.-
FRAGMENT_END= 3¶ Final part of a fragmented message
-
FRAGMENT_INTERMEDIATE= 2¶ Intermediate fragment
-
FRAGMENT_NONE= 0¶ Unfragmented message
-
FRAGMENT_START= 1¶ Start of a fragmented message
-
RECAPTYPE_NONE= 0¶ Normal data tick
-
RECAPTYPE_SOLICITED= 1¶ Generated on request by subscriber
-
RECAPTYPE_UNSOLICITED= 2¶ Generated by the service
-
correlationIds()¶ - Returns
Correlation ids associated with this message.
- Return type
Note
A
Messagewill have exactly oneCorrelationIdunlessallowMultipleCorrelatorsPerMsgoption was enabled for theSessionthisMessagebelongs to. WhenallowMultipleCorrelatorsPerMsgis disabled (the default), and more than one active subscription would result in the sameMessage, theMessageis delivered multiple times (without making physical copies). EachMessageis accompanied by a singleCorrelationId. WhenallowMultipleCorrelatorsPerMsgis enabled and more than one active subscription would result in the sameMessagetheMessageis delivered once with a list of correspondingCorrelationIdvalues.
-
destroy()¶
-
fragmentType()¶ - Returns
Fragment type of this message.
- Return type
Fragment types are listed in the class docstring.
-
getElement(name)¶ Equivalent to
asElement().getElement(name).
-
getElementAsBool(name)¶ Equivalent to
asElement().getElementAsBool(name).
-
getElementAsDatetime(name)¶ Equivalent to
asElement().getElementAsDatetime(name).
-
getElementAsFloat(name)¶ Equivalent to
asElement().getElementAsFloat(name).
-
getElementAsInteger(name)¶ Equivalent to
asElement().getElementAsInteger(name).
-
getElementAsString(name)¶ Equivalent to
asElement().getElementAsString(name).
-
hasElement(name, excludeNullElements=False)¶ Equivalent to asElement().hasElement(name, excludeNullElements).
-
numElements()¶ Equivalent to
asElement().numElements().
-
recapType()¶ - Returns
Recap type of this message.
- Return type
Recap types are listed in the class docstring.
-
timeReceived(tzinfo=<blpapi.datetime.FixedOffset object>)¶ Get the time when the message was received by the SDK.
- Parameters
tzinfo (tzinfo) – Timezone info
- Returns
Time when the message was received by the SDK.
- Return type
- Raises
ValueError – If this information was not recorded for this message. See
SessionOptions.recordSubscriptionDataReceiveTimes()for information on configuring this recording.
The resulting datetime will be represented using the specified
tzinfovalue, and will be measured using a high-resolution clock internal to the SDK.
-
toString(level=0, spacesPerLevel=4)¶ Format this
Messageto the string at the specified indentation level.- Parameters
- Returns
This element formatted as a string
- Return type
If
levelis negative, suppress indentation of the first line. IfspacesPerLevelis negative, format the entire output on one line, suppressing all but the initial indentation (as governed bylevel).
-