get_previous_close
Retrieve the previous trading day's open, high, low, and close prices for a stock ticker, optionally adjusted for splits.
Instructions
Previous trading day's OHLC for a single stock ticker.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ticker | Yes | Stock symbol (e.g. "NVDA"). | |
| adjusted | No | Adjust for splits. Default true. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The get_previous_close async function that implements the tool logic. It calls client.get() on path '/v2/aggs/ticker/{ticker}/prev' with an 'adjusted' query parameter.
async def get_previous_close(ticker: str, adjusted: bool = True) -> dict[str, Any]: """Previous trading day's OHLC for a single stock ticker. Args: ticker: Stock symbol (e.g. "NVDA"). adjusted: Adjust for splits. Default true. """ return await client.get( f"/v2/aggs/ticker/{ticker}/prev", {"adjusted": str(adjusted).lower()}, ) - src/massive_mcp/tools/__init__.py:1-23 (registration)The tools __init__.py imports the aggregates module so its register() function can be called.
from . import ( aggregates, corporate, financials, indicators, news, quotes, reference, snapshots, tickers, ) __all__ = [ "aggregates", "corporate", "financials", "indicators", "news", "quotes", "reference", "snapshots", "tickers", ] - src/massive_mcp/server.py:37-48 (registration)The build_server() function calls module.register(mcp, client) for each tool module including aggregates, which registers get_previous_close as an MCP tool.
for module in ( aggregates, quotes, snapshots, tickers, news, reference, indicators, corporate, financials, ): module.register(mcp, client) - src/massive_mcp/tools/aggregates.py:12-12 (registration)The register() function that uses @mcp.tool() decorator to register get_previous_close as a FastMCP tool.
def register(mcp: FastMCP, client: MassiveClient) -> None: - src/massive_mcp/client.py:47-50 (helper)The client.get() helper method that executes the actual HTTP GET request, used by get_previous_close to call the Massive REST API.
async def get( self, path: str, params: dict[str, Any] | None = None, *, trim: bool = True ) -> dict[str, Any]: merged: dict[str, Any] = {k: v for k, v in (params or {}).items() if v is not None}