3.5 KiB
black-scholes example
#
#
#
Introduction
This is intended to be an interactive Black-Scholes option-pricing demonstration. Warning: Work in progress
.orgsource for this page is here: index.org
Option pricing
The Black-Scholes formula for European call options is: $$ C(s,t) = N(d_{1})S = N(d_{2})Ke^{-r\tau} $$ where $N(x)$ is the cumulative normal distribution function: $$ N(x) = \frac{1}{\sqrt{2\pi}}\int_{-\infty}^{x}{e^{-\frac{x^2}{2}} dx} $$ We also have $N'(x)$ is the normal probability density function: $$ N'(x) = \frac{1}{\sqrt{2\pi}}e^{-\frac{x^2}{2}} $$ $$ d_{1} = \frac{1}{\sigma\sqrt{\tau}} \left[\ln{\left(\frac{S}{K}\right)}+\left(r+\frac{\sigma^2}{2}\right)\tau\right] $$ and $$ d_{2} = d_{1} - \sigma\sqrt{\tau} $$
We also have greeks: $$ delta: \frac{\partial C}{\partial S} = N(d_{1}) $$ $$ gamma: \frac{N'(d1)}{S\sigma\sqrt{\tau}} $$
Demo
The div element #frame will appear below this line:
Prerequisites
- d3 example #1 prerequisites (D3, webserver)
-
jqueryinstalled in$HTTP_ROOT/ext/jquery:ls -l $HOME/proj/public_html/org-howto/ext/jquerytotal 88 -rw-r–r– 1 roland roland 87533 Oct 18 1991 jquery-3.7.1.min.js
Procedure
Cumulative normal distribution
We use the ubiquitous polynomial approximation.
Write normal.js
Black-Scholes call
Write blackscholes.js