blpapi.Constant

class blpapi.Constant

Represents the value of a schema enumeration constant.

Constants can be any of the following DataTypes: BOOL, CHAR, BYTE, INT32, INT64, FLOAT32, FLOAT64, STRING, DATE, TIME, DATETIME. This class provides access not only to to the constant value, but also to the symbolic name, the description, and the status of the constant.

Constant objects are read-only.

Application clients never create Constant object directly; applications will typically work with Constant objects returned by other blpapi components.

datatype()
Returns

Data type used to represent the value of this Constant.

Return type

int

The possible return values are enumerated in DataType.

description()
Returns

Human readable description of this Constant.

Return type

str

getValue()
Returns

Value of this object as it is stored in the object.

getValueAsDatetime()
Returns

Value of this object as one of the datetime types.

Return type

datetime.time or datetime.date or datetime.datetime

Raises

InvalidConversionException – If the value cannot be converted to one of the datetime types.

getValueAsFloat()
Returns

Value of this object as a float.

Return type

float

Raises

InvalidConversionException – If the value cannot be converted to a float.

getValueAsInteger()
Returns

Value of this object as an integer.

Return type

int

Raises

InvalidConversionException – If the value cannot be converted to an integer.

getValueAsString()
Returns

Value of this object as a string.

Return type

str

Raises

InvalidConversionException – If the value cannot be converted to a string.

name()
Returns

The symbolic name of this Constant.

Return type

Name

status()
Returns

Status of this Constant.

Return type

int

The possible return values are enumerated in SchemaStatus.