Welcome to the official Python client library for the Massive REST and WebSocket API. To get started, please see the Getting Started section in our documentation, view the examples directory for code snippets.
Note: Polygon.io has rebranded as Massive.com on Oct 30, 2025. Existing API keys, accounts, and integrations continue to work exactly as before. The only change in this SDK is that it now defaults to the new API base at api.massive.com, while api.polygon.io remains supported for an extended period.
For details, see our rebrand announcement blog post or open an issue / contact support@massive.com if you have questions.
Before installing the Massive Python client, ensure your environment has Python 3.9 or higher.
Please use pip to install or update to the latest stable version.
pip install -U massive
To get started, please see the Getting Started section in our docs, view the examples directory for code snippets.
The free tier of our API comes with usage limitations, potentially leading to rate limit errors if these are exceeded. For uninterrupted access and to support larger data requirements, we recommend reviewing our subscription plans, which are tailored for a wide range of needs from development to high-demand applications. Refer to our pricing page for detailed information on limits and features to ensure a seamless experience, especially for real-time data processing.
Import the RESTClient.
from massive import RESTClientCreate a new client with your API key
client = RESTClient(api_key="<API_KEY>")Request data using client methods.
ticker = "AAPL"
# List Aggregates (Bars)
aggs = []
for a in client.list_aggs(ticker=ticker, multiplier=1, timespan="minute", from_="2023-01-01", to="2023-06-13", limit=50000):
aggs.append(a)
print(aggs)
# Get Last Trade
trade = client.get_last_trade(ticker=ticker)
print(trade)
# List Trades
trades = client.list_trades(ticker=ticker, timestamp="2022-01-04")
for trade in trades:
print(trade)
# Get Last Quote
quote = client.get_last_quote(ticker=ticker)
print(quote)
# List Quotes
quotes = client.list_quotes(ticker=ticker, timestamp="2022-01-04")
for quote in quotes:
print(quote)