alexanu / tos_options_dashboard

Interactive dashboard to filter and analyse stock options contracts (Built using data from ThinkOrSwim's API and Plotly Dash components)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ThinkOrSwim (TOS) Options Dashboard

Project Description:

An interactive dashboard to filter and analyze stock options contracts (Built using data from ThinkOrSwim's Option Chain API and Plotly Dash components). It is useful for quickly scanning option chains to look for individual profitable options contracts to trade on.

Filter options include:

  • Return of Investment (ROI) Range: Percentage of premium received (by selling an contract) over the underlying amount (strike price * 100)
  • Delta Range: Represents current probability that the option contract will expire in-the-money (i.e. Option is exercised)
  • Option Contract Type: Call/Put/All (both call and put options)
  • Days to expiration: No. of days till options contract is set to expire
  • Confidence Level: Represents the level of confidence in which the stock price is likely to be within the probability cone. A higher confidence level would result in a wider probability cone.
  • Historical Volatility Period: Changes the width of the probability cone calculation based on past period historical volatility (Past month, past 3 months, past year). For example, historical volatility of 40% would result in a wider probability curve than that based on a historical volatility of 25%.

Pre-requisites:

  1. Set-up a TDAmeritrade Developer account to receive an API key. This key is necessary to authenticate each API call to extract the necessary data (e.g. stock quote date, option chain data) to required to perform financial analysis.

  2. Activate virtual environment in the directory of choice and install the necessary libraries outlined in requirements.txt .

    pip install -r requirements.txt
  3. [Docker Option] To build and run the docker container, run the following lines in the terminal/command prompt. After running docker run, proceed with step 2 of the Usage section.

    docker build -t tos_options_dashboard .
    docker run -p 8050:8050 tos_options_dashboard
    
    • Note: You can override the default value of the TOS API Key set in Dockerfile by running the following command during build

      docker build --build-arg api_key=<NEW_API_KEY> -t tos_options_dashboard .

Usage:

  1. Run the python file dashboard.py

    python dashboard.py
  2. The Dashboard would be running on local host (Port: 8050) by default. Open the web browser and enter the corresponding localhost address (http://127.0.0.1:8050/) to view the Dashboard.

  3. To start using the Dashboard, activate Ticker mode before entering the stock ticker of interest (e.g. AAPL for Apple Inc. stock).

    Alternatively, you can type 'Apple' without activating Ticker mode to search for a particular option underlying.

    There are several options property filter options to choose from:

    • Return on Investment (ROI) Range: (Default: More than 1%)
    • Delta Range: (Default: Ignore Delta value)
    • Option Contract Type: Call/Put/All (Default: All)
    • Day(s) to Expiration: 0-100 days (Default: 0-14 days)
    • Confidence Level: (Default: 30% Confidence)
    • Historical Volatility Level: (Default: 1 Month)

    To proceed with the search function, select on the Submit button.

    step3-search

  4. The corresponding historical price charts for the specified stock ticker is generated along with the associated cone of probability (Default: 30% confidence level).

    step4-results

  5. The open interest and volume of the options chain is generated. Note: The options chain with expiry date closest to the 'Day(s) to Expiration' field is used (i.e. if option 0-14 days is selected, the graph will show the option chain with number of expiry days closest to 14)

    step5-results

  6. The dashboard also measures the Call / Put skew of the specified ticker, as well as listing the option contracts that matches the filter requirements in Step 3.

    • Put Skew: Defined as the price of 10% OTM puts/10% OTM calls for the next monthly option expiry
    • Call Skew: Defined as the price of 10% OTM calls/10% OTM puts for the next monthly option expiry.

    step6-results

About

Interactive dashboard to filter and analyse stock options contracts (Built using data from ThinkOrSwim's API and Plotly Dash components)

License:MIT License


Languages

Language:Python 97.5%Language:Dockerfile 1.3%Language:CSS 1.2%