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 librarydatetime.datetime
anddatetime.time
classes. These classes are accepted by the blpapi package to setDATE
,TIME
orDATETIME
elements. For example, theDATETIME
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 usedpytz
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 specifiedoffsetInMinutes
from UTC.
- fromutc()
datetime in UTC -> datetime in local time.