def adjust_ib_time_to_local(self, timestamp_ib): if getattr(timestamp_ib, "tz_localize", None) is None: # daily, nothing to do return timestamp_ib timestamp_ib_with_tz = self.add_tz_to_ib_time(timestamp_ib) local_timestamp_ib_with_tz = timestamp_ib_with_tz.astimezone( tz.tzlocal()) local_timestamp_ib = strip_tz_info(local_timestamp_ib_with_tz) return local_timestamp_ib
def get_broker_time_local_tz(self): ib_time = self.ib.reqCurrentTime() local_ib_time_with_tz = ib_time.astimezone(tz.tzlocal()) local_ib_time = strip_tz_info(local_ib_time_with_tz) return local_ib_time