blpapi.FixedOffset

class blpapi.FixedOffset(offsetInMinutes=0)

Time zone information.

Represents time zone information to be used with Python standard library datetime classes.

This class is intended to be used as tzinfo for Python standard library datetime.datetime and datetime.time classes. These classes are accepted by the blpapi package to set DATE, TIME or DATETIME elements. For example, the DATETIME element of a request could be set as:

value = datetime.datetime(1941, 6, 22, 4, 0, tzinfo=FixedOffset(4*60))
request.getElement("last_trade").setValue(value)

The TIME element could be set in a similar way:

value = datetime.time(9, 0, 1, tzinfo=FixedOffset(-5*60))
request.getElement("session_open").setValue(value)

Note that you could use any other implementations of datetime.tzinfo with BLPAPI-Py, for example the widely used pytz package (https://pypi.python.org/pypi/pytz/).

For more details see datetime module documentation at https://docs.python.org/library/datetime.html

__init__(offsetInMinutes=0)
Parameters

offsetInMinutes (int) – Offset from UTC in minutes

Creates an object that implements datetime.tzinfo interface and represents a timezone with the specified offsetInMinutes from UTC.

dst(dt)

datetime -> DST offset as timedelta positive east of UTC.

Return type

timedelta

fromutc()

datetime in UTC -> datetime in local time.

getOffsetInMinutes()
Return type

int

Returns

Offset from UTC in minutes

tzname(dt)

datetime -> string name of time zone.

Return type

timedelta

utcoffset(dt)

datetime -> timedelta showing offset from UTC, negative values indicating West of UTC

Return type

timedelta