blpapi.FixedOffset¶
- class blpapi.FixedOffset¶
Time zone information.
Represents time zone information to be used with Python standard library datetime classes.
This class is intended to be used as
tzinfofor Python standard librarydatetime.datetimeanddatetime.timeclasses. These classes are accepted by the blpapi package to setDATE,TIMEorDATETIMEelements. For example, theDATETIMEelement 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
TIMEelement 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.tzinfowith BLPAPI-Py, for example the widely usedpytzpackage (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.tzinfointerface and represents a timezone with the specifiedoffsetInMinutesfrom UTC.
- dst(dt)¶
datetime -> DST offset as timedelta positive east of UTC.
- fromutc()¶
datetime in UTC -> datetime in local time.
- tzname(dt)¶
datetime -> string name of time zone.
- utcoffset(dt)¶
datetime -> timedelta showing offset from UTC, negative values indicating West of UTC