Expand description
Massive (formerly Polygon.io) market data (behind massive feature).
Massive (formerly Polygon.io) market data connectors.
Provides access to institutional-grade market data across all major asset classes: stocks, options, indices, forex, crypto, and futures.
§Data licensing — redistribution prohibited
This crate’s code is MIT-licensed; the data it retrieves is not. Massive’s Market Data Terms of Service (§5(c)) prohibit redistributing the data to third parties. Use it for your own purposes only, and do not commit it, publish it, or serve it onward.
§Testing Status
Partially integration-tested. We have a currencies subscription (crypto + forex) but not stocks, options, indices, or futures subscriptions. Verified endpoints:
- ✅ REST aggregates (crypto, forex, stocks, options, futures via free tier)
- ✅ REST tick trades (crypto)
- ✅ REST quotes (forex)
- ✅ WebSocket streaming (crypto, forex)
- ✅ Reference data (tickers, exchanges, market status, holidays)
- ✅ Corporate actions (dividends, splits)
- ✅ Options contracts reference data (free tier)
- ❌ Options snapshots with Greeks — requires Options Starter subscription
- ❌ REST aggregates (indices) — requires indices subscription
- ❌ REST tick trades (stocks) — requires stocks subscription
- ❌ REST quotes (stocks) — requires stocks subscription
- ❌ WebSocket (stocks, options) — requires a stocks or options subscription
Unit tests for JSON transformation live inline in reference.rs, options.rs,
transformer.rs and message.rs. Live API integration tests are in
tests/massive_integration.rs.
§Architecture
MassiveRestClient: Historical and intraday data via REST APIMassiveSubscriberwith theMassiveStocks,MassiveCrypto,MassiveForexandMassiveOptionsconnectors: real-time streaming throughStreams, like any other exchange, or throughDynamicStreamswithDynamicSubscribers::with_massive
§Authentication
Requires MASSIVE_API_KEY environment variable from an active Massive subscription.
Get your API key from: https://massive.com/dashboard/api-keys
§One connection per cluster
Massive allows a key a fixed number of WebSocket connections per cluster — stocks,
options, forex and crypto count separately — one on an individual plan. Past the limit it
closes the older connection. Every stream a
MassiveSubscriber and its clones open on a
cluster therefore shares one socket to it. Pass clones of one subscriber to every stream on
the key; see connection for the details.
§Symbol Conventions
Important: REST API and WebSocket use different symbol formats!
§REST API Symbols
X:BTCUSD— CryptoC:EURUSD— ForexO:AAPL251219C00150000— OptionsI:SPX— IndicesAAPL— Stocks
§WebSocket Symbols
The connectors spell these from each instrument; see
MassiveSymbols.
BTC-USD— Crypto (hyphenated)EUR/USD— Forex (slashed: the cluster acceptsEUR-USDtoo, but delivers its data asEUR/USD)O:AAPL251219C00150000— OptionsAAPL— Stocks
§Supported Streams
| Kind | Stocks / Options | Crypto | Forex |
|---|---|---|---|
PublicTrades | T | XT | — (no trades) |
Quotes, OrderBooksL1 | Q | XQ | C |
Candles at Sec1 | A | XAS | CAS |
Candles at Min1 | AM | XA | CA |
Massive aggregates at no other interval, so a Candles subscription at any other is refused
before anything is sent. Forex quotes carry no sizes, so their amounts are zero, and forex
candles report no volume: Massive builds them from quote updates, not trades. Only crypto’s
trade conditions say which side took liquidity, so a stock or option trade has no side.
§Examples
§REST Client
use rustrade_data::exchange::massive::MassiveRestClient;
let client = MassiveRestClient::from_env()?;
let candles = client.fetch_aggregates("X:BTCUSD", 1, "minute", from, to).await?;§WebSocket Streams
use rustrade_data::exchange::massive::{MassiveCrypto, MassiveSubscriber};
use rustrade_data::streams::Streams;
use rustrade_data::subscription::trade::PublicTrades;
use rustrade_instrument::instrument::market_data::kind::MarketDataInstrumentKind;
// Load the key at construction time (fails fast if the variable is missing)
let subscriber = MassiveSubscriber::from_env()?;
let streams = Streams::<PublicTrades>::builder()
.subscribe(
subscriber,
[(MassiveCrypto::default(), "btc", "usd", MarketDataInstrumentKind::Spot, PublicTrades)],
)
.init()
.await?;Modules§
- channel
- The Massive WebSocket channel each subscription kind reads.
- connection
- One WebSocket per Massive cluster, shared by every stream a
MassiveSubscriberand its clones open on it. - market
- How each Massive cluster spells a market on its WebSocket.
- message
- Massive WebSocket market data messages, and the transformer turning them into market events.
- stream
- The Massive market stream.
Structs§
- Address
- Company address.
- Currency
Status - Currency market status.
- Dividend
- Dividend information.
- Dividend
Query - Filter parameters for the
/v3/reference/dividendsendpoint. - Exchange
- Exchange information.
- Fair
Market Value - Fair Market Value - a calculated mid-price from Massive.
- Market
Holiday - Market holiday information.
- Market
Status - Current market status.
- Massive
- Generic Massive WebSocket connector, one per cluster.
- Massive
Credentials - The API key authenticating to Massive’s WebSocket.
- Massive
Option Contract - Option contract from the Massive contracts endpoint.
- Massive
Option Snapshot - Option snapshot with Greeks and market data from Massive.
- Massive
Rest Client - REST client for Massive historical and intraday market data.
- Massive
Server Crypto - The crypto cluster.
- Massive
Server Forex - The forex cluster.
- Massive
Server Options - The options cluster.
- Massive
Server Stocks - The stocks cluster.
- Massive
Status - A Massive status message:
{"ev":"status","status":"success","message":"subscribed to: XT.BTC-USD"}. - Massive
SubResponse - A Massive frame of status messages, as a subscribe is answered.
- Massive
Subscriber - Massive market data subscriber: authenticates, and shares one connection per cluster among every stream it and its clones open.
- Option
Contract Query - Filter parameters for the
/v3/reference/options/contractsendpoint. - Option
DayBar - Daily OHLCV bar for an option contract.
- Option
Quote - Option quote (bid/ask).
- Option
Snapshot Query - Filter parameters for option snapshot endpoints.
- Option
Trade - Option trade.
- Split
Query - Filter parameters for the
/v3/reference/splitsendpoint. - Stock
Split - Stock split information.
- Ticker
- Ticker summary from the tickers list endpoint.
- Ticker
Details - Detailed ticker information from the ticker details endpoint.
- Ticker
Query - Filter parameters for the
/v3/reference/tickersendpoint. - Underlying
Asset - Underlying asset data included in option snapshots.
Enums§
- Dividend
Frequency - Dividend payment frequency.
- Massive
Error - Massive-specific errors.
- Sort
Order - Sort order for paginated results.
Constants§
- WEBSOCKET_
URL_ CRYPTO - Crypto WebSocket URL.
- WEBSOCKET_
URL_ FOREX - Forex WebSocket URL.
- WEBSOCKET_
URL_ OPTIONS - Options WebSocket URL.
- WEBSOCKET_
URL_ STOCKS - Stocks WebSocket URL.
Type Aliases§
- Massive
Crypto - Massive crypto connector.
- Massive
Forex - Massive forex connector. Forex publishes no trades, so it serves no
PublicTrades. - Massive
Options - Massive options connector (untested — requires an options subscription).
- Massive
Stocks - Massive stocks connector.