Utilities¶
Date utils
-
analysis_engine.utils.
last_close
()[source]¶ 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)
- During market hours the returned
- 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.
- Before or after market hours, the returned
Note
does not detect holidays and non-trading days yet and assumes the system time is set to EST or UTC
-
analysis_engine.utils.
get_last_close_str
(fmt='%Y-%m-%d')[source]¶ 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)