{"id":8303,"library":"massive","title":"Massive Python Client","description":"The `massive` library is the official Python client for the Massive (formerly Polygon.io) REST and WebSocket APIs. It provides comprehensive access to real-time and historical market data for Stocks, Options, Forex, and Crypto. The library is currently at version 2.5.0 and aims to follow the API's release cadence, often bundling breaking changes and maintaining backward compatibility where feasible.","status":"active","version":"2.5.0","language":"en","source_language":"en","source_url":"https://github.com/massive-com/client-python","tags":["financial data","stocks","options","forex","crypto","real-time","historical data","api client","trading"],"install":[{"cmd":"pip install -U massive","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Used for HTTP requests by the underlying client.","package":"httpx","optional":false}],"imports":[{"note":"The library rebranded from Polygon.io to Massive.com, changing the package name and import path from 'polygon' to 'massive' in v2.0.1.","wrong":"from polygon import RESTClient","symbol":"RESTClient","correct":"from massive import RESTClient"},{"note":"Similar to RESTClient, the WebSocket client import also changed due to the rebranding.","wrong":"from polygon import WebSocketClient","symbol":"WebSocketClient","correct":"from massive import WebSocketClient"}],"quickstart":{"code":"import os\nfrom massive import RESTClient\nfrom datetime import date\n\napi_key = os.environ.get('MASSIVE_API_KEY', 'YOUR_API_KEY')\n\nif api_key == 'YOUR_API_KEY':\n    print(\"WARNING: Please set the MASSIVE_API_KEY environment variable or replace 'YOUR_API_KEY' with your actual API key.\")\n    # Exit or raise an error in a real application\n\nclient = RESTClient(api_key=api_key)\n\nticker = \"AAPL\"\nmultiplier = 1\ntimespan = \"day\"\nfrom_date = date(2023, 1, 1)\nto_date = date(2023, 1, 5)\n\nprint(f\"Fetching aggregate bars for {ticker} from {from_date} to {to_date}...\")\ntry:\n    aggs = []\n    for a in client.list_aggs(ticker=ticker, multiplier=multiplier, timespan=timespan, from_=from_date, to=to_date):\n        aggs.append(a)\n    \n    if aggs:\n        print(f\"Retrieved {len(aggs)} aggregate bars:\")\n        for agg in aggs:\n            print(agg)\n    else:\n        print(\"No aggregate bars found for the specified period.\")\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")","lang":"python","description":"This quickstart demonstrates how to initialize the `RESTClient` using an API key (preferably from an environment variable) and fetch historical aggregate bars for a stock like Apple (AAPL). It iterates through the results, printing each aggregate bar."},"warnings":[{"fix":"Update your `pip install` command to `pip install massive` and change import statements from `from polygon import ...` to `from massive import ...`. Existing API keys and `api.polygon.io` endpoints will continue to work for an extended period, but updating is recommended.","message":"The library underwent a major rebranding from Polygon.io to Massive.com in v2.0.1. This changed the package name from `polygon` to `massive`, updated default API base URLs (e.g., `api.polygon.io` to `api.massive.com`), and necessitated changes in import statements.","severity":"breaking","affected_versions":">=2.0.1"},{"fix":"Refer to the updated Futures API documentation for the new consolidated endpoint structures and methods. Your existing Futures API calls may need to be refactored.","message":"The Futures Beta Endpoints were significantly updated and consolidated in v2.1.0. Endpoints like `/futures/vX/contracts`, `/futures/vX/products`, and `/futures/vX/schedules` now handle both lists and specific details, replacing older separate endpoints.","severity":"breaking","affected_versions":">=2.1.0"},{"fix":"Adjust your parsing and calculations for stock quote sizes, as they now represent raw share counts. Historical flat files will also be regenerated to reflect this change.","message":"Effective November 3, 2025 (v2.0.x series), the `bid_size` and `ask_size` fields for stock quotes now report values in shares instead of round lots. This change aligns with SEC Market Data Infrastructure (MDI) Rules.","severity":"breaking","affected_versions":">=2.0.1"},{"fix":"Migrate to the Benzinga News v2 API. The v2 API includes small breaking changes that enabled real-time delivery architecture and provides faster access to news. Consult the Benzinga News v2 documentation for migration details.","message":"The Benzinga News v1 API was officially sunset on December 1, 2025. This endpoint is no longer available.","severity":"deprecated","affected_versions":"All versions"},{"fix":"Review Massive.com's subscription plans for higher usage limits suitable for your application. Implement robust error handling and retry logic with exponential backoff for API calls.","message":"Users of the free tier API may encounter rate limit errors (`HTTP 429 Too Many Requests`) due to usage limitations.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Change your import statements from `from polygon import ...` to `from massive import ...`.","cause":"Attempting to import from the old 'polygon' package name after upgrading to `massive` client version 2.0.1 or later, which introduced the rebranding.","error":"ModuleNotFoundError: No module named 'polygon'"},{"fix":"Consult the official Massive API documentation or the library's `examples` directory on GitHub for the correct method names and usage patterns for the endpoints you are trying to access.","cause":"Method names may have changed or been consolidated, particularly for newer API versions or after major updates (e.g., Futures API).","error":"AttributeError: 'SomeClient' object has no attribute 'get_aggs' (or similar for other methods)"},{"fix":"Update your code to access the 'transactions' key instead of 'transaction_count' when parsing aggregate data.","cause":"In version 2.0.2, the field name 'transaction_count' was changed to 'transactions' in aggregate models.","error":"KeyError: 'transaction_count'"}]}