2
$\begingroup$

I am looking to program the Black Scholes model, but I don't understand how to write this equation as basic math.

Example values

  • Type: Put
  • StockPrice: 19
  • StrikePrice: 20
  • YearsToMaturity: 0.16
  • RiskFreeRate: 0.10
  • Volatility: 0.60

I can get all of these inputs, but I just need to program the basic calculation, like (these are just made up numbers and equations)

f = a + (b/c);
f * f = z;
z / 3 + ( f * a ) = m;

m is the answer.

2 Answers 2

5

Espen Haug, the guy famous for his book on option formulas, implements Black Scholes in several languages/platforms here.

0

This can be done very very easily in Excel. All you're doing is:

$C_t = S_t N(d_1) - N(d_2) K e^{-r(T-t)}$

where $d_1$ and $d_2$ are constants obtained through elementary calculations, $N(.)$ is the NormSdist function in Excel, and $S$, $K$ and $e^{-r(T-t)}$ are also easy to compute.

This is for a call; but it's almost the same thing as for a put.