blpapi.Constant

class blpapi.Constant(handle, sessions)

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()
Return type:

int

Returns:

Data type used to represent the value of this Constant.

The possible return values are enumerated in DataType.

description()
Return type:

str

Returns:

Human readable description of this Constant.

getValue()
Return type:

Any

Returns:

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

getValueAsDatetime()
Return type:

Union[datetime, date, time]

Returns:

Value of this object as one of the datetime types.

Raises:

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

getValueAsFloat()
Return type:

float

Returns:

Value of this object as a float.

Raises:

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

getValueAsInteger()
Return type:

int

Returns:

Value of this object as an integer.

Raises:

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

getValueAsString()
Return type:

str

Returns:

Value of this object as a string.

Raises:

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

name()
Return type:

Name

Returns:

The symbolic name of this Constant.

status()
Return type:

int

Returns:

Status of this Constant.

The possible return values are enumerated in SchemaStatus.