Timestamps
The timestamp data type describes a date and time as a whole number in Unix Time format, as the number of seconds or milliseconds since 1970-01-01 UTC.
Gemini strongly recommends using milliseconds instead of seconds for timestamps.
Requests
When timestamp is supplied as a request parameter, the following two values are supported in order of preference:
- The number of milliseconds since 1970-01-01 UTC
- The number of seconds since 1970-01-01 UTC (unix epoch)
For your convenience, a POST
request may supply the timestamp
parameter in a JSON payload as a string instead of a number.
Formats
Timestamp format | Example | Supported request type |
---|---|---|
whole number (seconds) | 1495127793 | GET , POST |
string (seconds) | "1495127793" | POST only |
whole number (milliseconds) | 1495127793000 | GET , POST |
string (milliseconds) | "1495127793000" | POST only |
Behavior
If the timestamp
parameter is not present, the default behavior is to return the most recent items in the list. For example, the public Trade History endpoint will return the most recent trades without a timestamp
parameter.
The first trade on Gemini occurred at 1444311607801
milliseconds. Any request for a timestamp value before this is the same as requesting the very first item in the list.
You may choose to supply a timestamp of 0
to get the first trade in the list when retrieving trades historically.
If unable to parse your timestamp
value, the exchange will return an InvalidTimestampInPayload
error.
Responses
In a JSON response, the key
timestamp
denotes the number of seconds since 1970-01-01 UTCtimestampms
denotes the number of milliseconds since 1970-01-01 UTC
For backwards compatibility, some but not all timestamp values will be supplied in seconds.