from datetime import datetime


def tradedate_2_dtime(td):
    """ convert trade date as formatted by yfinance to a datetime object """
    td_str = str(int(td))
    y, m, d = int(td_str[:4]), int(td_str[4:6]), int(td_str[6:])
    return datetime(y, m, d)