Knowledge Base/Does Massive offer sample code?

Does Massive offer sample code?

Yes. Client libraries and runnable examples are published on GitHub, and the documentation carries a code sample for every endpoint. The quickest start is a client library for your language rather than raw HTTP.

For anything past a first curl, start from a client library rather than assembling requests yourself: pagination, retries and the WebSocket handshake are already handled, and those are the three things people rewrite badly. Massive maintains libraries on GitHub, and the documentation carries a runnable sample for every endpoint.

Applies to

  • Plans: every plan. The libraries authenticate with an ordinary API key.
  • Endpoints: all of them, REST and WebSocket.
  • Asset classes: all.

Where to look, in order

Look in this order:

  1. The documentation for the endpoint you need. Every page carries a sample request and a sample response, which is usually enough to see the shape before you write anything.
  2. The client libraries on GitHub. Use one if your language has one. They handle authentication, paging through next_url, and the connect-authenticate-subscribe sequence on the WebSocket.
  3. massive.com/docs/rest/llms.txt, a machine-readable index of every REST endpoint, which is the fastest way to find what exists without reading the whole site.

What the samples will not tell you

The samples will not tell you three things that regularly surprise people:

  • Paging. Most list endpoints return a next_url and the sample shows one page. Follow the cursor rather than raising limit.
  • The limit parameter on aggregates counts base units scanned rather than bars returned, so a sample with a small limit will quietly return fewer bars than you expect over a longer range.
  • Entitlement is per asset class. A sample that works for stocks will return NOT_AUTHORIZED for options unless you hold that subscription too.

Why start from a library

Starting from a library saves you the parts of the integration that are the same for everyone and easy to get subtly wrong: cursor paging, retry behavior on a 429, and keeping a WebSocket read loop from blocking on parsing, which is the single most common cause of disconnects. None of that is difficult, but all of it is already written.

If you see an error

A sample that returns NOT_AUTHORIZED is usually the asset class rather than the code. Check which subscription the endpoint belongs to.

A sample that returns fewer results than the documentation shows is often paging or the limit semantics rather than missing data.

A library that fails to authenticate is nearly always the key rather than the library. Test the same key with a plain curl first.

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.