Bourse.Timestamp (bourse v0.1.0)

Copy Markdown View Source

Timestamp formatting helpers shared across request signing and response parsing.

Summary

Functions

Formats a millisecond Unix timestamp as an ISO 8601 string, or nil when the timestamp is absent.

Formats a millisecond Unix timestamp as a UTC ISO 8601 string truncated to whole seconds, with no zone designator — the iso8601_seconds authored format (2017-05-11T15:19:30), which htx/huobi/bittrade's signing scheme requires.

Functions

iso8601_from_ms(timestamp_ms)

@spec iso8601_from_ms(integer() | nil) :: String.t() | nil

Formats a millisecond Unix timestamp as an ISO 8601 string, or nil when the timestamp is absent.

iso8601_seconds_from_ms(timestamp_ms)

@spec iso8601_seconds_from_ms(integer() | nil) :: String.t() | nil

Formats a millisecond Unix timestamp as a UTC ISO 8601 string truncated to whole seconds, with no zone designator — the iso8601_seconds authored format (2017-05-11T15:19:30), which htx/huobi/bittrade's signing scheme requires.