pyBlaSch – An object-oriented Python code for option pricing with the Black-Scholes equation

pyBlaSch is an open-source Python code demonstrating option valuation via the solution of the Black-Scholes equation

\(\frac{\partial V}{\partial t} + \frac{1}{2}\sigma^2 S^2 \frac{\partial^2 V}{\partial S^2} + rS\frac{\partial V}{\partial S} – rV = 0.\)

It is a parabolic partial differential equation involving the option price \(V,\) the price of the underlying stock \(S,\) the volatility \(\sigma,\) and the risk free rate \(r.\) As it is simple to account forĀ annualizedĀ dividend payments \(d\), these are included in the code, too.


  • Finite differences discretization of the spatial derivative operators
  • Runge-Kutta schemes for the integration in time (currently first to 4th order low-storage schemes)
  • Currently only simple Dirichlet type boundary conditions are implemented
  • Types of options are European and Binary call/put
  • Derived quantities: Greeks Delta and Gamma, Put-Call parity implied price

The code design follows an object-oriented programming paradigm and was done with extensibility in mind.

Getting the code

pyBlaSch is open-source software licensed under the MIT license and available on Bitbucket at

Solution for a European Call

Solution for a European Call with expiry in one year and a strike of 100.

Leave a Reply