Example #1
0
def ib_timestamp_to_datetime(timestamp_ib):
    """
    Turns IB timestamp into pd.datetime as plays better with arctic, and adjusts yyyymm to closing vector

    :param timestamp_str: datetime.datetime
    :return: pd.datetime
    """
    timestamp = pd.to_datetime(timestamp_ib)

    adjusted_ts = adjust_timestamp(timestamp)

    return adjusted_ts
Example #2
0
def ib_timestamp_to_datetime(timestamp_str):
    """
    Turns IB timestamp into datetime and adjusts yyyymm to closing vector
    Eithier yyyymmdd or 'yyyymmdd  hh:mm:ss'

    :param timestamp_str: str
    :return: datetime.datetime
    """
    timestamp = ib_timestamp_to_date_or_datetime(timestamp_str)

    adjusted_ts = adjust_timestamp(timestamp)

    return adjusted_ts
Example #3
0
    def ib_timestamp_to_datetime(self, timestamp_ib):
        """
        Turns IB timestamp into pd.datetime as plays better with arctic, converts IB time (UTC?) to local,
        and adjusts yyyymm to closing vector

        :param timestamp_str: datetime.datetime
        :return: pd.datetime
        """

        local_timestamp_ib = self.adjust_ib_time_to_local(timestamp_ib)
        timestamp = pd.to_datetime(local_timestamp_ib)

        adjusted_ts = adjust_timestamp(timestamp)

        return adjusted_ts