Skip to main content

Polygon Stock Market API

Polygon The Polygon.io Stocks API provides REST endpoints that let you query the latest market data from all US stock exchanges.

Use the PolygonAPIWrapper to get stock market data like the latest quote for a ticker.

import getpass
import os

os.environ["POLYGON_API_KEY"] = getpass.getpass()
from langchain_community.utilities.polygon import PolygonAPIWrapper
polygon = PolygonAPIWrapper()
polygon.run("get_last_quote", "AAPL")
{'results': {'P': 185.86, 'S': 1, 'T': 'AAPL', 'X': 11, 'i': [604], 'p': 185.81, 'q': 106551669, 's': 2, 't': 1705098436014023700, 'x': 12, 'y': 1705098436014009300, 'z': 3}}