Replicating Tastywork’s Probability of 50% Profit for Option Trades

For those of you who use the Tastyworks platform, you may have noticed that they have a P50 metric. If you’re wondering what that does, it essentially gives you the Probability of closing that option at 50% profit. Now, I always wondered how that calculated that metric and recently stumbled across this video where they explained how they did. And I needed to replicate it. So, for all you nerds out there who wonder what goes on behind the hood… here ya go!

note: this would also be useful if you didn’t want to close at 50% profit but wanted to maybe close at 70% profit etc. You could just tweak the numbers around to get your desired PXX metric

Background

I decided to run this simulation on AAPL — a well-known ticker. Looking first at Tastywork’s option chain…

Screenshot of Tastyworks (photo by author)

I decided to simulate it on the 122.5 Put, with 37 days to go. You can see at the bottom left hand corner the P50 which currently stands at 89%. We’ll try to match that.

1. Simulating Stock Price

I pulled Apple’s stock price from Tiingo, this free website that gives better data than Yahoo and then calculated the log daily returns. Plotting it out, you get this:

AAPL returns (graph by author)

Which looks fine. Next, in order to perform GBM calculations, we have to find the drift (the mean) and the sigma (the standard deviation). I’m not going to go into detail about GBM calculations since the focus of this article is the P50 but you can find more of it here.

I got the gbm_vector calculation from here so credits to RobotWealth for that. I then set it up for our particular Put (which has 37 days to go), with 1000 simulations (as per the Tastyworks video).

AAPL price simulation (graph by author)

And that’s done! So we’ve completed the first part, which is the simulation of the stock price.

2. Simulating Put Price

Once I had the matrix of the Put price, I converted it to a dataframe and then plotted it!

AAPL put price simulation (graph by author)

I intentionally limited the “zoom” to only up to 25 as the put started at ~$1.70 and we wanted to see when it would hit P50 (which is $0.85) so it didn’t make sense to see the puts that had gone up to the $100s. Of course, this graph was still incredibly messy so I just selected 10 random ones to make it look cleaner and limited the y-axis.

AAPL put price simulation (graph by author)

As you can see, some did indeed dip below the $0.85 mark. All we had to do now was quantify how many had dipped below that mark.

Calculating P50

Comparing our value of 86% to Tastywork’s, we see that theirs is 89%! So not too far off!

Conclusion

Originally published at zachlim98.github.io/me

Hi! I’m learning to explore data and think about personal finance (not always in that order)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store