For prefacing log lines with the minute of each day. I find this useful sometimes, easier to read than the time stamps.
from pytz import timezone as tz
def minut(): # Minute of the trading day
dt = get_datetime().astimezone(tz('US/Eastern'))
return (dt.hour * 60) + dt.minute - 570
Examples:
log.info('{} {}'.format(minut(), int(context.portfolio.portfolio_value)))
2002-11-05 06:40 get_prices:244 INFO 10 1003352
2002-11-05 06:45 cancel_oos:113 INFO 15 1003889
^^
_____||