Option pricing library for q by KX, includes implementations for:
- Black Scholes
- Monte Carlo
- Cox-Ross-Rubenstein binomial
- Garman–Kohlhagen
Install kdb+ from kx.com and rlwrap
Move to the q-option-pricing directory
cd ./q-option-pricing/
Start q (example for macOS)
rlwap ~/q/m64/q
Load the library
\l ./loadall.q
Examples of calculating the price of a call
q).bs.c.price[420;420.04;0.8;0.17;0.05]
34.02261
q).mc.c.price[420;420.04;0.8;0.17;0.05;1000]
33.89279
q).crr.c.price[420;420.04;0.8;0.17;0.05;1000]
34.01666
Start a web server on port 5000
\p 5000