How to query realtime and delayed options

Overview

In this how to guide, we will show you how simple it is to use Intrinio to efficiently query our Realtime Options and 15 Minute Delayed Options data. In this example we will be using Python however, you can use any one of our client SDKs or query our REST API directly using your programming language of choice.


Note

Our SDKs make it really easy to ingest tons of data. However, I would be remiss to not mention that if you need all of the options data in realtime, the best delivery method is our web socket. I mean why pull data when we can push it all to you (and we push it good). The how to guide for this is coming soon.

Prerequisites

  1. Create an account to get an API key
  2. Contact [email protected] to sign up for a free trial.
  3. Choose which SDK you wish to use Python, Javascript/Node, C#, Java, Ruby, or R.

Procedure

Install the Intrinio Python SDK if you haven't already.

pip install intrinio-sdk

So, let's say you want to pull in all the data for a specific company so you can find some options contracts you would like to buy or sell. Let's use TSLA for example, analysts can't make up their mind on this stock so their is probably some good opportunities here whether you are bullish or bearish. Try this code out using the Options Expirations endpoint.

import intrinio_sdk as intrinio

intrinio.ApiClient().set_api_key('YOUR_API_KEY_HERE')

symbol = 'TSLA'
after = '2023-10-01'
before = '' # Leave an empty string to not specify

response = intrinio.OptionsApi().get_option_expirations_realtime(symbol, after=after, before=before)
print(response)

Wait, I thought we were getting data for TSLA options not just an array of dates. Well, having the expiration dates allows us to ingest the entire Realtime Options Chain at once. Now let's put those expiration dates to use.

import intrinio_sdk as intrinio

intrinio.ApiClient().set_api_key('YOUR_API_KEY_HERE')

symbol = 'TSLA'
after = '2023-10-01'
before = '' # Leave an empty string to not specify

response = intrinio.OptionsApi().get_option_expirations_realtime(symbol, after=after, before=before)
print(response)

for expiration in response.expirations:
    chain_response = intrinio.OptionsApi().get_options_chain_realtime(symbol, expiration)
    print(chain_response)

Ok, that is looking better. Just what I was looking for: ask, bid, last, open interest, implied volatility, greeks, and more. That is great for analyzing a bunch of contracts at once but what if I have honed in on a specific contract. Well try out this endpoint but be careful to test with a contract that is still active. On the Option Prices Realtime endpoint, we remove expired contracts regularly.

import intrinio_sdk as intrinio

intrinio.ApiClient().set_api_key('YOUR_API_KEY_HERE')

identifier = 'TSLA260116P00195000'

response = intrinio.OptionsApi().get_options_prices_realtime(identifier)

print(response)

By the time you got to reading this you're probably not actually reading this. You've secured your series A and you've hired a team of engineers and it is your team that is reading this. Now it is time to take your founder's options strategy that made investors pour their hard earned money into the company and put it to use against the entire options universe. Our Options Realtime Snapshot endpoint allows you to easily pull down the bids, asks, trades, and more in one flat file. Hit it with no parameters to get the latest snapshot.

import intrinio_sdk as intrinio

intrinio.ApiClient().set_api_key('YOUR_API_KEY_HERE')

response = intrinio.OptionsApi().get_options_snapshots()
print(response)

Conclusion

We strive to make data ingestion as simple as possible so you can focus on building your market beating application. Missing something? Have further questions? Comments? Ready to buy? Contact [email protected].