APIYard
Back to APIs
FinanceAPI KeyFree tier

Polygon.io

Polygon.io provides real-time and historical data for stocks, options, forex, and crypto — trades, quotes, aggregates, and company fundamentals.

Base URL

https://api.polygon.io
stocksoptionsforexcryptoreal-time

Endpoints

GET/v2/aggs/ticker/{stocksTicker}/range/{multiplier}/{timespan}/{from}/{to}

Get OHLCV aggregate bars for a stock ticker.

const response = await fetch("https://api.polygon.io/v2/aggs/ticker/AAPL/range/1/day/2024-01-01/2024-01-31?apiKey=YOUR_API_KEY", {
  method: "GET",
  headers: {
  "Content-Type": "application/json",
  "X-API-Key": "YOUR_API_KEY"
  }
});

const data = await response.json();
console.log(data);

Response Preview

{
  "ticker": "AAPL",
  "resultsCount": 23,
  "results": [{
    "v": 72143000,
    "o": 186.09,
    "c": 185.92,
    "h": 188.44,
    "l": 185.83,
    "t": 1704067200000,
    "n": 783456
  }]
}