Know Your Options

Maximilian Wimmer
7 min readMar 25, 2021

--

Option Trading Strategies in Python

An investment portfolio includes different securities such as stocks, bonds, commodities and currencies. Another type of investment are the options. Options are a choice to trade in the underlying security. When you trade in stock options, you dont buy or sell the stocks. You just buy or sell the option to buy or sell the stocks at a fixed price on a certain fixed date. In the year 1973 the Chicago Board of Options Exchange (CBOE) was formed. In the same year, Fisher Black and Myron Scholes devised a mathematical formula that could calculate the price of an option using specified variables. This had a major impact on option trading. Today the average daily traded volume of option contracts are nearly 15 million. Options are more complex than other financial instruments and can be very risky, expecially if you dont know what you are doing. In this articel we will start to have a look the basic concepts of options: call and put. We will start with the option buyer and seller payoff and the volatility which has a strong impact on options. The Black-Scholes formula will help us understand the pricing of an option. We have a closer look at the mathematics behind the formula and then apply it to real option data to get the greeks.

1. Payoff Functions

Payoff functions are key to understanding the profit (and loss) that we’ll receive upon purchasing an option or options. They are typically designed so that you can view the strike price on the purchased (or sold) option, as a function of the underlyings price.

1.1. Call

Buying a call option gives you the right, but not the obligation to buy the underlying security at the given strike price, within a specific time period. A call option payoff at expiration depends on where the underlying price is relative to the call option strike price.

Call Option Buyer Payoff

What do you observe?

  1. The loss to the call option buyer is restricted to the extent of the premium he has paid.
  2. The profit from this call option seems to increase linearly as and when the stock price starts to move above the strike price. Therefore, the higher the spot price goes from the strike price, the higher is the profit.
  3. Though the call option is supposed to make a profit when the spot price moves above the strike price, the call option buyer first needs to recover the premium he has paid.
Call Option Seller Payoff

The option buyer makes the profit, the option seller will lose the exact same amount and vice-versa.The call option seller payoff looks like a mirror image of the call option buyer payoff.

1.2. Put

Buying a put option gives you the right, but not the obligation to sell the underlying security at the given strike price, within a specific time period. A put option payoff at expiration depends on where the underlying price is relative to the put option strike price.

Put Option Buyer Payoff

What do you observe?

  1. The loss to the put option buyer is restricted to the extent of the premium he has paid.
  2. The profit from this put option seems to increase linearly as and when the stock starts to move below the strike price. Therefore, the higher the spot price goes from the strike price, the higher is the profit.
  3. Though the put option is supposed to make a profit when the spot price moves below the strike price, the put option buyer first needs to recover the premium he has paid.
Put Option Seller Payoff

Again the call option seller payoff looks like a mirror image of the call option buyer payoff.

2. Volatility

Options prices depend crucially on estimated future volatility of the underlying asset. Volatility can either be historical or implied.

2.1. Historical vs. Implied Volatility

Apple 20 Day Historical Volatility

While the historical volatility shows the past volatility of the stock price, the implied volatility (IV) measures the market’s expected best guess of future volatility of the underlying.

Many times the volatility changes with changes in the strike price — the higher the difference between strike and the underlying price, the higher the volatility. This phenomenon is called the Volatility Smile (refer to the chart below)

Options Volatitlity Smile

3. Option Analysis

To set up a virtual environment and run a Jupyter-Notebook I recommend you use Anaconda.

Stock to Option Price

3.1. Black-Scholes-Merton Model

Is a financial instrument to determine the price of vanilla Europrean options. To determine the price of vanilla Europrean options we use the Black-Scholes-Metron formula.

The Black-Scholes-Merton Formula for a Vanilla Call Option:

With:

  • S the spot price of the asset at time t.
  • T the maturity of the option. Time to maturity is defined as T−t.
  • K the strike price of the option.
  • r the risk-free interest rate, assumed to be constant between t and T.
  • sigma the volatility of underlying asset.
  • N the normal distribution.

3.2. The Greeks

The greeks are the partial-derivatives of the Black-Scholes equation with respect to each variable. Greeks are closed-form formulas that represent the sensitivity of the option to the different underlying parameters.

3.2.1. Delta

Delta is the option´s sensitivity to small changes in the underlying price.

Delta Mathematical Proof

According to:

I=0

We have:

Finally:

Delta Plot

3.2.2. Gamma

Gamma is the Delta’s sensitivity to small changes in the underlying price.

Gamma Mathematical Proof

Gamma Plot

3.2.3. Theta

Theta is the option’s sensitivity to small changes in time to expiry.

Theta Mathematical Proof

Theta Plot

3.3. Options Data

Basic Definitions:

ITM (In-The-Money): An option is ITM if it is currently worth exercising today i.e. for a call option the current underlying’s price is greater than the strike price (vice versa for a put).

OTM (Out-Of-The-Money): An option is OTM if it is currently not worth exercising today.

Underlying: This refers to the asset which underlies the derivative contract.

To calculate the greeks we use the QuantLib modul.

Now we get the call and put options for Apple.

Lets filter the call and put options.

3.3.1. Options Volatility Smile

The Black-Scholes-Merton model assumes that the underlying volatility (𝜎) is constant over the life of the option and stays unaffected by changes in the underlying stock price levels. Many times the volatility changes with changes in the strike price. The higher the difference between strike and the underlying price, the higher the volatility. This phenomenon is called the Volatility smile.

Apple Options Volatility Smile

3.3.2. Visualize Options Data

Apple Options Pairplot

4. Analyse Multiple Options

4.1. The Bid-Ask Spread

Bid-Ask Spread

4.1.1. Bid-Ask Spread Percentage

Bid-Ask Spread Percentage

Sources:

--

--