TensorFlow and Quants

During this post I am going to go over a topic I found online by Matthias Groncki about using TensorFlow for Monte Carlo simulations using the Black-Scholes model. For sure check out his post but I am going to walk through doing this work as a way to force myself into using features of TensorFlow.

First, if you didn’t know, a Monte Carlo Simulation is a way to find the probability of different outcomes. In investing they are used to help understand the impact of risk and uncertainty. I have seen these done in Excel before but until I read Matthais’ post I never thought to give them a run in TensorFlow.

Second, the Black-Scholes model is a mathematical model that is used for pricing derivative investments.

Third, a plain vanilla call that I will be using is when you buy a call with a certain strike price and a certain expiration date. Buying the call means that you promise to buy that stock at a set price on a set date. Typically, there is something called an option premium that you will pay in order to enter into the contract. For example, let say that Wells Fargo (WFC) is trading at $50 on August 30th. You think it will go up at least 10% before the end of the year. So, you would buy the December 21st expiration with a strike price of $55. For the rights to buy that you would pay $3 in options premium. There are 3 common scenarios. First, the stock stays below $55 and you lose the premium and you don’t get the shares. Second, the stock goes above $55 and you get to purchase those shares for $55. Third, you sell the options to someone else and collect the money.

Tying this back to Black-Scholes, they thought they knew of a formula to correctly price these through the time to maturity. They actually won a noble prize for their creation. For a fun little read, check out Long-Term Capital Management to see how poorly this did when the 1997 Asian and 1998 Russian financial crises hit.

Checkout my Jupyter Notebook from my GitHub page for all the code and a more in depth walk-through: MonteCarloBlackScholes.ipynb. I work through a simple python implementation of Black-Scholes and then first up TensorFlow and run a lot of simulations.

One thought on “TensorFlow and Quants”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s