Knowledge Base/What timezone are Massive's timestamps in?

What timezone are Massive's timestamps in?

All of them are UTC. Massive returns Unix epoch integers, which carry no time zone at all, so nothing needs converting on the way in. The unit differs by feed: nanoseconds on REST and the flat files, milliseconds on the WebSocket.

There is nothing to convert on the way in, which is the point of the format: Massive returns Unix epoch integers, and an epoch integer counts from one fixed instant and carries no zone at all. Conversion is only ever something you do on the way out, to display a local time. The difference that does bite is the unit, and it changes between feeds.

Applies to

  • Plans: all plans.
  • Endpoints: every REST endpoint, every WebSocket channel and every flat-file dataset.
  • Asset classes: all.

Unit by feed

The unit differs by feed, and getting it wrong is the mistake that actually happens, because it is silent:

FeedFieldUnit
REST trades and quotessip_timestamp, participant_timestamp, trf_timestampNanoseconds
REST aggregatestMilliseconds
Flat filesthe timestamp columnsNanoseconds
WebSocket trades and quotest, ptMilliseconds
WebSocket aggregatess, eMilliseconds
Futureswindow_start, timestampNanoseconds

A nanosecond unit is not always nanosecond precision. Massive's options trades on REST older than the last few sessions, and options trades in the flat files including recent sessions, carry nanosecond values that end in six zeros, so they are only precise to the millisecond. Which timestamps are returned for Massive's stock trades and NBBO quotes? shows how to tell the two forms apart.

How to convert one

Use your language's own library rather than a website:

from datetime import datetime, timezone

ns = 1788566398110367271          # a REST trade
ms = 1788566398110                # the same event on the WebSocket
print(datetime.fromtimestamp(ns / 1_000_000_000, timezone.utc))
print(datetime.fromtimestamp(ms / 1_000, timezone.utc))

Keep the integer for storage, comparison and sorting, and convert only when you display it. Storing a formatted local string is how a trade ends up attributed to the wrong session.

Why UTC rather than Eastern time

UTC is used rather than market time because the markets Massive covers are not all in one time zone and not all of them close: crypto runs continuously, forex runs around the clock on weekdays, and futures sessions cross midnight. One fixed reference means a timestamp means the same thing on every feed and never repeats or skips an hour, which local time does twice a year.

If you need the trading session, derive it. The US equities regular session is 09:30 to 16:00 Eastern, which is 14:30 to 21:00 UTC in winter, when Eastern is UTC-5, and 13:30 to 20:00 UTC in summer, when it is UTC-4. Convert with a real time-zone database rather than a fixed offset, or the two weeks around each daylight saving change will be wrong.

If you see an error

A timestamp that decodes to 1970 means the value was divided as if it were seconds. One far in the future means milliseconds were treated as nanoseconds.

Events that look an hour out for part of the year are a fixed UTC offset applied to Eastern time. Use a time-zone database.

A trade that appears outside market hours may be genuine. Pre-market and after-hours trades are published like any other.

Related


Was this article helpful?

Modernizing Wall St.

Reimagining financial market data for the 21st century.

Schedule a demo

Talk with our market data experts

Recommended

Can't find the answer you're looking for? Contact our team.
  • Title
    Are all indices available through the basic subscription tier?
    Data Coverage Category

    Data Coverage

    Indices Category

    Indices

    Description
    No, and the ones it withholds are the famous ones: SPX, DJI, RUT and VIX all need a paid Indices tier. Basic still reaches more than 10,000 of the 13,000-odd indices Massive publishes, and NDX and the Nasdaq Composite are among them.
  • Title
    Does Massive offer dark pool data?
    Data Coverage Category

    Data Coverage

    Stocks Category

    Stocks

    Description
    Yes. Off-exchange prints, which include dark pool executions, arrive on the ordinary trades feed and are identified by an exchange ID of 4. There is no separate dark pool endpoint, and no way to tell which individual venue a print came from.
  • Title
    Does Massive offer pre-market and after-hours data?
    FAQ Category

    FAQ

    Stocks Category

    Stocks

    Description
    Yes. Every extended-hours trade and quote is published, from 04:00 to 20:00 Eastern. There is no session parameter, so you select a session with timestamps, and expect far fewer aggregate bars outside regular hours because many extended-hours trades are odd lots that cannot set a price.