How to Predict Future Stock Prices with Options Data and Python
Predicting a stock’s future price range with implied volatility is simple and easy.
This tutorial walkthrough will discuss:
- What is Implied Volatility?
- Why Does Implied Volatility Impact Option Premiums?
- What Factors Impact Implied Volatility?
- Using Intrinio’s Real-Time Options API to Predict Stock Prices
What is Implied Volatility?
A product of the Black-Scholes model, implied volatility is an essential statistic for options traders and refers to the range of future moves in the underlying stock’s price.
Implied volatility is the overall market’s forecast of the probable price movements expected in a security’s price. Implied volatility differs from realized volatility, which measures the historical volatility associated with a security, not the predicted future movements in its price.
An important caveat about implied volatility is that the estimated price movements of the underlying stock are not bullish or bearish in nature. Instead, these estimates are merely a one standard deviation range of price outcomes that an investor can expect the underlying stock’s price to fall in between.
From a statistics point of view, you can think of implied volatility as an indicator that provides investors with an idea of the range of outcomes a stock price could result in by the expiration date over one standard deviation, or roughly 68% of the time.
For example, an at-the-money option contract for a $20 stock with an implied volatility of 10% indicates that 68% of the time, the underlying stock price should be between $18 and $22 by expiration.
Why Does Implied Volatility Impact Option Premiums?
From an option pricing standpoint, the higher the implied volatility, the wider the distribution of pricing outcomes and, therefore, the higher the premium demanded to purchase an option’s contract associated with that stock.
These higher premiums for option contracts with higher implied volatility are expected as the option underwriter must be compensated for the additional risk associated with a wide range of outcomes for the stock’s price.
Higher implied volatility is one reason why option contracts associated with companies with upcoming earnings are typically more expensive, as reported earnings and upcoming guidance may dramatically impact the underlying stock price, particularly when industry peers have recently reported mixed results.
What Factors Impact Implied Volatility?
We now know that higher implied volatility means a higher premium for a contract, but what causes implied volatility to rise?
In general, any related event surrounded by higher uncertainty will increase the implied volatility associated with the stock’s option contracts. Upcoming earnings and Federal Reserve meetings are two examples of events that often impact a stock’s implied volatility.
Additionally, investors typically look at the volume and open interest associated with a particular stock as heavy demand for a particular option increases implied volatility.
Finally, another factor impacting implied volatility is the number of days until its expiration. Typically, the longer the time period, the higher the implied volatility, as a long time horizon allows for many macro and micro impacts to affect a stock’s price before the option contract expires.
Using Intrinio’s Real-Time Options API to Predict Stock Prices
Using our newfound knowledge, we can now use Intrinio’s Real-Time Options API to construct a range of outcomes for an underlying stock price as of specific expiration dates.
Step 1: Retrieve Requisite Stock and Options Data
To forecast stock prices, we first need to create a few helper functions to retrieve the inputs for our formula. These inputs are:
- latest stock price;
- options expirations list;
- option strike price from each option chain; and
- and implied volatility from each option chain.
The functions below use Intrinio’s APIs to retrieve these inputs for our formula.
The _latest_stock_price function returns the latest stock price for a given stock.
The _options_expirations_list function returns a list of all upcoming expiration dates for a stock. The number of option expirations can vary widely by the stock itself. Popular stocks like SPDR S&P 500 ETF Trust (SPY) have daily, weekly, monthly, and yearly expiration dates, whereas less popular securities such as Realty Income Corporation (O) and other less liquid, less volatile, and unpopular stocks can have just a handful of expiration dates.
Finally, our _option_strike_price_and_implied_volatility function returns the implied volatility and associated strike price of an at-the-money call option, which aligns closest with the underlying security’s stock price.
Step 2: Calculate the Upper and Lower Price Range for Each Security
The _stock_standard_deviation_range uses the strike price, implied volatility, and expiration date supplied from the above functions to construct the upper and lower bounds of our one standard deviation forecast range. Again, these upper and lower figures signify the range in which the stock is likely to fall 68% of the time by the expiration date of a particular contract.
The math occurring in our _stock_standard_deviation_range is relatively simple.
We first use Python’s DateTime package to determine the number of days until expiration and then divide the days until expiration by the calendar days in a year (365) and grab the square root of this number. As mentioned above, the days until expiration are an essential facet of our predictions because the longer the time horizon, the more opportunity a company has to improve the market sentiment or business operations and increase its stock price, and vice-versa.
We then multiply the square root of expiration days differential with the implied volatility for that expiration date and the current option strike price. The product of this final multiplication is the expected +/- single standard deviation price movement.
Finally, adding and subtracting this value from the option contract’s strike price provides an upper and lower estimated range of outcomes.
Step 3: Iterate and calculate the forecasted range for all expirations.
Our final function _option_forecast_dataset puts all of the pieces together and will iterate through the list of option expiration dates for a particular ticker. Each iteration will perform the data ingestion and calculations above, returning an upper and lower estimated price forecast for each option chain associated with the stock.
Finally, the _option_forecast_dataset will return a DataFrame with three columns denoting an expiration date and the equity’s upper and lower forecasted price ranges by that expiration date.
Note: As you will see, the farther you forecast into the future, the wider the expected outcomes are based on the implied volatility and time until expiration. Additionally, comparing AAPL’s predicted price ranges to TSLA’s you can see the impact of higher volatility and the difficulty of forecasting far into the future for highly volatile stocks.
Complete Code Walkthrough:
Get the best options market data
Intrinio’s reputable US options data packages have everything your business needs and more! You can easily access and make the most out of our reliable filtered options data through our powerful infrastructure at a fraction of the cost. Not only will you have access to clean filtered options data, but you can request unusual options activity, and expect low latency and flexible licensing. Our data experts are ready to guide you in the right business direction.