Skip to main content

parse_ib_timestamp

Function parse_ib_timestamp 

Source
pub fn parse_ib_timestamp(
    s: &str,
    session_zone: Option<Tz>,
) -> Option<DateTime<Utc>>
Expand description

Reads IB’s text time, as on an execution or a completed order, as an instant.

IB writes such a time as a wall-clock reading and the zone it is in, such as 20261027 12:48:41 Asia/Singapore, where the zone is the gateway host’s, or as 20261027-04:48:41, which is UTC.

  • The zone is a tz database name, such as Asia/Singapore, or one of its aliases, such as US/Eastern or MET.
  • A time that names no zone is read in session_zone, the gateway’s zone from the connection handshake (see IbkrClient::session_zone). Without one, it is None. A time that names a zone is read in it, whatever session_zone is.
  • A zone that is not a tz database name is None, with a warn! the first time on each thread. Read in a guessed zone, such as UTC, the instant would be off by the zone’s offset, possibly by hours.
  • A reading in a repeated hour, as clocks go back, is the earlier of its two instants. One in a skipped hour, as clocks go forward, never showed on a clock, and is None.
  • Anything else that does not read as one of these forms is None, including the - form followed by a zone.