Date utils


Get last trading close time as a python datetime

How it works:

  • During market hours the returned datetime will be
    datetime.datetime.utcnow() - datetime.timedelta(hours=5)
  • Before or after market hours, the returned datetime
    will be 4:00 PM EST on the previous trading day which could be a Friday if this is called on a Saturday or Sunday.


does not detect holidays and non-trading days yet and assumes the system time is set to EST or UTC


Get the Last Trading Close Date as a string with default formatting ae_consts.COMMON_DATE_FORMAT (YYYY-MM-DD)

Parameters:fmt – optional output format (default ae_consts.COMMON_DATE_FORMAT)
analysis_engine.utils.utc_now_str(fmt='%Y-%m-%d %H:%M:%S')[source]

Get the UTC now as a string with default formatting ae_consts.COMMON_TICK_DATE_FORMAT (YYYY-MM-DD HH:MM:SS)

Parameters:fmt – optional output format (default ae_consts.COMMON_TICK_DATE_FORMAT)

Get the UTC date as a string with default formatting COMMON_DATE_FORMAT

Parameters:fmt – optional output format (default COMMON_DATE_FORMAT YYYY-MM-DD)

Call this to plot date strings in order with just the trading open as the xticks

Parameters:date_list – column from the pandas.DataFrame like date_list=df['minute']