TD Ameritrade: Pulling Options Chain

Viewing the options chain can be a useful exercise when determining the right options to consider for your strategy. The purpose of this post is to share how to pull the option chain using python + TD Ameritrade.

The code that is being shared is part of a larger project, which identifies potential arbitrage opportunities while looking at the option chain.

Will demonstrate

  • Pulling options chain for a single stock & viewing in a dataframe
  • Graphically view the greeks and additional attributes

Reference Links

A link to the code and notebook can be found here: GitHub

First, we need to connect to TD Ameritrade via python and then briefly explore the data

Now that we have a sense of the data structure, let’s put the Call option chain into a dataframe.

Suppose we want to view the greeks for a particular expiration. We can create a dataframe for that DTE and graphically view how each of the greeks behave at that point in time

As mentioned in the beginning, this code is part of a larger process of mine that looks to find arbitrage opportunities looking at the option chain.

Sharing

Related Articles

  • All Post
  • Articles
  • Blog Post
  • General Business Automation
  • Portfolio
  • Stock Market & Finance