Introducing

Introducing Stock Options APIs

Mar 7, 2022

We’ve just launched a new set of Stock Options APIs that change the game for options trading.  We’re making available real-time trade and quote data from the full OPRA feed, as well as custom aggregate bars, greeks, open interest, and years of tick-level historical data for the entire stock options market.

Real time, full market data on every active options chain — check.
Custom aggregates of any duration down to 1 minute — check.
5+ years of historical tick-level data — check.
Self-serve sign-up without ever talking to a sales person — check.

You asked for it, so we built it.  Starting today, all Polygon users will have access to stock options data.  We’ve brought the same low-latency and developer-centric API design of our stocks, crypto, and forex APIs to a new category of financial market data.

We live for making market data fast at scale, so the challenge of taking on the market that generates tens of terabytes of data each day was something we couldn’t pass up. It’s a lot of data.  Each optionable stock ticker may have hundreds of available options contracts at any given time, translating into well north of a million unique active options contracts, across which billions of quotes and millions of trades are generated throughout the day.

Here’s some help visualizing what that looks like compared to stock data.

The technical demands of storing and processing that much data are real, which is presumably why so few data platforms have even attempted to make a full-market options data product.  To make it work, we built a proprietary database capable of keeping pace with the barrage of messages sent during peak market times.  Then we built out a state-of-the-art data center, colocated with OPRA, and installed over 5 petabytes of storage.

Engineering flexes aside, we've designed our new APIs to make it as easy as possible to search, filter, and sort options contracts so that you can slice the market any way you need to. Using our new Options Contracts API, you can search or screen contracts on underlying stock ticker, expiration date, contract type, and more.  Expiration date also supports Query Filter Extensions, so you can use inequalities to query date ranges.

For example, to find all of the Norwegian Cruise Lines options contracts expiring in 2022, we can query

https://api.polygon.io/v3/reference/options/contracts?underlying_ticker=NCLH&order=asc&sort=ticker&expiration_date.gte=2022-01-01&expiration_date.lt=2023-01-01&limit=1000&apiKey=*

This gives us all 400+ active NCLH contracts that expire in 2022.

{
    "results":[{
        "cfi": "OCASPS",
        "contract_type": "call",
        "exercise_style": "american",
        "expiration_date": "2022-03-04",
        "primary_exchange": "BATO",
        "shares_per_contract": 100,
        "strike_price": 14,
        "ticker": "O:NCLH220304C00014000",
        "underlying_ticker": "NCLH"
    },
    ...
    {
        "cfi": "OPASPS",
        "contract_type": "put",
        "exercise_style": "american",
        "expiration_date": "2022-09-16",
        "primary_exchange": "BATO",
        "shares_per_contract": 100,
        "strike_price": 40,
        "ticker": "O:NCLH220916P00040000",
        "underlying_ticker": "NCLH"
    }],
    "status":"OK",
    "count":442
}

Once you’ve got the contract tickers that fit your criteria, if you've upgraded to one of our paid options plans, you can get all of the most recent quotes, aggregate bars, break even price, etc. for that contract in a single call using our Snapshot API.

Let’s get the most recent information on the last NCLH contract in our list, a put with a $40 strike expiring on Sept. 16th.

https://api.polygon.io/v3/snapshot/options/NCLH/O:NCLH220916P00040000?apiKey=*
{
 "results": {
  "break_even_price": 18.5,
  "day": {
   "close": 17.4,
   "high": 17.4,
   "last_updated": 1644469200000000000,
   "low": 17.4,
   "open": 17.4,
   "previous_close": 17.4,
   "volume": 10,
   "vwap": 17.4
  },
  "details": {
   "contract_type": "put",
   "exercise_style": "american",
   "expiration_date": "2022-09-16",
   "shares_per_contract": 100,
   "strike_price": 40,
   "ticker": "O:NCLH220916P00040000"
  },
  "greeks": {
   "delta": -0.9547898282427094,
   "gamma": 0.012612636299809162,
   "theta": -0.001834603718325581,
   "vega": 0.010021448944732716
  },
  "implied_volatility": 0.5605449877663735,
  "last_quote": {
   "ask": 21.55,
   "ask_size": 58,
   "bid": 21.45,
   "bid_size": 37,
   "last_updated": 1646327776062591500,
   "midpoint": 21.5,
   "timeframe": "REAL-TIME"
  },
  "open_interest": 9,
  "underlying_asset": {
   "change_to_break_even": -0.120000000000001,
   "last_updated": 1646327802592721400,
   "price": 18.62,
   "ticker": "NCLH",
   "timeframe": "REAL-TIME"
  }
 },
 "status": "OK"
}

This gives us all of the most up to date information for that contract including today’s open, high, low, and close, the most recent bid, ask, and midpoint, open interest, greeks, etc.  For users who also have a stocks subscription, this API will return data on the underlying asset as well, including the current price and the price change to break even.

We’ve spent the last few months tuning performance, and we’re excited to make this fully available to everyone starting today.  Check out the docs, and leave us feedback.

From the blog

See what's happening at polygon.io

hunting anomalies in the stock market Feature Image
tutorial

Hunting Anomalies in the Stock Market

This tutorial demonstrates how to detect short-lived statistical anomalies in historical US stock market data by building tools to identify unusual trading patterns and visualize them through a user-friendly web interface.