top of page
Search

Option pricing Visualisation using the Black-Scholes model

  • Writer: Kito Theron
    Kito Theron
  • Apr 5
  • 2 min read

You can run this program without any setup directly in your browser using the following link: https://kitotheron.shinyapps.io/Customisable_Option_Pricing_Visualisation/ This project was inspired by Sheldon Natenberg's book Option Volatility & Pricing. In it, Natenberg discusses how European option pricing can be modelled using the Black-Scholes formula, which uses the values of the strike price, stock price, volatility, risk-free interest rate, and time to expiration to calculate the value of put and call options. I saw an opportunity to bring this concept to life through visualization, which led to the development of this program. I wrote this project using R with the Shiny library, the plots were created using the Plotly and Ggplot2 libraries.


This project features three types of interactive graphs. Each one updates in real time when the user changes input values. The calculated put and call prices are also displayed at the top of the screen. Users can customize which variables appear on each axis of the graphs via the sidebar controls.


3d Scatter Plots



These interactive plots are made using Plotly. The color legend is mapped to the call/put price—lower prices appear in red, and higher prices in green. Users can zoom in to explore specific areas of the graph.


When building these plots, I had to balance the number of data points shown with how long it would take the graph to load. I found that using 15 data points per axis provided enough detail while keeping load times short—just a few seconds.


Example: The plot below shows the result after replacing volatility with the risk-free interest rate.




Heat-maps


These plots were created using ggplot2. Originally, they only included a color legend, making it harder to read specific values. I later added a numeric grid overlay to make the values easier to interpret at a glance.


Example: This heatmap replaces stock price with time to expiration.





Parallel Coordinates Plot


This graph would be useful to show the user all of the values which they are using and it makes it more obvious the impact of the first column (which is customisable) on the call and put values.

For example, in the graph below, you can see how stock price positively correlates with the call price and negatively with the put price.


Users can also isolate a specific range of values, highlighted by a pink line in the example below.




User Interface



Users can adjust their inputs using the forms and sliders on the left-hand side. The graphs update automatically in response to these changes.

For parameters that range between 0 and 1, I used sliders. For those with broader ranges, I used standard input fields. "Value 1" and "Value 2" at the top of the sidebar represent the variables compared on the graphs. "Value 1" is also used as the first column in the Parallel Coordinates Plot.


If users want to learn more about options, they can click the "About Options" tab at the top of the page to access a dedicated info screen.



You can view the source code for this project on GitHub:

To run the program via the web without any setup, use this link:

 
 
 

Comments


© 2035 by Train of Thoughts. Powered and secured by Wix

bottom of page