## Pricing Options and Implied Volatility with Python

In 2012, my first options trade lost $9,000. 12 months later I was making $1,100 per week trading in my free time. What changed? I read 20 books on options and finished a master’s degree. But what took my game to the next level was pricing options and implied volatility with Python.

## What Are Options?

A quick primer on options in case you’re not familiar:

- Over $450 billion in notional trades DAILY
- 39 million options contracts trade DAILY
- 25% of total options trading is from retail

So how do we make money?

## A Simple Framework

Trade options with a simple, 3-part framework:

- Design your risk
- Value the position
- Measure and monitor

Now pair this framework with Python and you get a potent combination for making money trading options. Pricing options and implied volatility with Python is the easiest way to design your risk.

Let’s dig in:

To design our risk profile, we need the option payoff. Let’s start by defining the variables we need:

- Stock price
- Strike price
- Time to expiration
- Interest rate
- Volatility

We also define market prices for demonstrating trades.

Remember our payoff functions for calls and puts?

• call = max(S – K, 0)

• put = max(K – S, 0)

We can define them in Python in one line of code each. And here’s where it gets really interesting.

We can clearly see that as the stock price decreases in price, the value of our put option increases. Here’s the amazing part of this…

Using this framework, we can construct any complex options position we want. For example, I modeled a short straddle with breakeven points at $38.75 and $51.25 and max profit when the stock price is at $45.

Butterfly spread?

The value in doing this FIRST is to pick the right position for the market. Bullish? Buy a call. Bearish? Buy a put. Want to bet on volatility? Buy a straddle. Know the breakeven points, max gain and loss – before you put the trade on.

## There’s One Thing Missing

You’ll notice all these payoffs happen when the options expire. What about before they expire? The Black-Scholes formula gives us the value of an option at any time before expiration. In the next thread, we’ll see how to build the formula in Python.

Here’s a preview:

## Pricing Options and Implied Volatility with Python

Now, you can apply this framework for pricing options and implied volatility with Python. Step 1 is understanding risk before you make the trade. If you want to learn how to do this with Python, grab my 46-page ultimate guide to pricing options and implied volatility with Python.