get_daily_open_close
Retrieve daily open and close prices for a specific stock on a given date using Polygon.io financial data.
Instructions
Get daily open/close prices
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ticker | Yes | Ticker symbol (e.g., AAPL) | |
| date | Yes | Date (YYYY-MM-DD format) |
Implementation Reference
- src/index.ts:119-137 (handler)The asynchronous handler function that implements the get_daily_open_close tool by calling the Polygon API to retrieve daily open and close prices for a given ticker and date.get_daily_open_close: async (args: { ticker: string; date: string }) => { try { const response = await polygonApi.get(`/v1/open-close/${args.ticker}/${args.date}`); return { content: [{ type: "text", text: JSON.stringify(response.data, null, 2) }] }; } catch (error: any) { return { content: [{ type: "text", text: `Error getting daily open/close: ${error.response?.data?.message || error.message}` }], isError: true }; } },
- src/index.ts:312-329 (registration)Registration of the get_daily_open_close tool in the ListTools handler, including its name, description, and input schema for validation.{ name: "get_daily_open_close", description: "Get daily open/close prices", inputSchema: { type: "object", properties: { ticker: { type: "string", description: "Ticker symbol (e.g., AAPL)" }, date: { type: "string", description: "Date (YYYY-MM-DD format)" } }, required: ["ticker", "date"] } },
- src/index.ts:315-328 (schema)Input schema defining the parameters (ticker and date) for the get_daily_open_close tool.inputSchema: { type: "object", properties: { ticker: { type: "string", description: "Ticker symbol (e.g., AAPL)" }, date: { type: "string", description: "Date (YYYY-MM-DD format)" } }, required: ["ticker", "date"] }