Thank you

    We will be in contact shortly.

    Kx Whitepaper: Option Pricing Methods in kdb+/q

    5 December 2019

    By Deanna Morgan

    As an addition to the technical whitepapers curated on the Kx Developer’s site, this paper compares methods of pricing options in kdb+/q. This work looks specifically at Black-Scholes, Monte Carlo and Quasi-Monte Carlo Methods and the use of Sobol sequences to improve results, in place of more traditional random number generation algorithms. This work follows the methods presented in a paper by S. Kucherenko et. al 2007. [1]

    For almost 50 years, the most commonly used model for pricing options is Black-Scholes. In the paper, I look specifically at the use of the Black-Scholes models for European and Asian call options. In each case, the Black-Scholes model produces a closed-form solution with a deterministic result. In addition to Black-Scholes, Monte Carlo (MC) methods can also be used in option pricing, where random experiments are run with an average price returned based on the option type and the strike price.

    The use of MC simulations in the financial industry stems from the need to evaluate complex financial instruments and the lack of analytical solutions available to do so. MC methods are used to mimic the uncertainty associated with the underlying price of an instrument and are subsequently used to generate a price based on the possible underlying factors. These models are based on pseudo-random numbers which despite being ubiquitous, exhibit very slow convergence, often at a rate of O(1N) where N is the number of sampled points.

    To improve upon these models, Quasi-Monte Carlo methods have been developed which use a low-discrepancy sequence (LDS) to generate rates of convergence on the order of O(1N). Many practical studies have proven that the Sobol’ LDS is superior to other LDS’s in a number of ways. The most effective Quasi-Monte Carlo method as applied in financial engineering is based on Sobol’ LDS. [2-5]

    In the whitepaper, I compare the use of both Monte Carlo (MC) and Quasi-Monte Carlo (QMC) methods for pricing Asian and European call options. In doing so, I consider the use of two discretization schemes – standard discretization and Brownian bridge construction. The Black-Scholes price for each market is compared to an average price generated using the following combinations of simulation and discretization methods:

    • Pseudo-random number generation (MC) with standard discretization.
    • Sobol sequences (QMC) with standard discretization.
    • Sobol sequences (QMC) with Brownian Bridge construction.

    Once both the Black-Scholes and MC/QMC prices have been calculated for each market, the RMSE can be calculated between the two. This is demonstrated in the final example in the paper. The process is repeated for an increasing number of paths, with resulting errors compared.

    The full paper, code and Jupyter notebook explaining how to price Asian and European call options using the aforementioned methods can be found on the Kx Developer’s site.


    If you have any questions about the above work, please reach out to or Sergei Kucherenko at


    [1] S. Kucherenko et al. 2007, ‘The Importance of Being Global – Application of Global Sensitivity Analysis in Monte Carlo Option Pricing’, Wilmott, pp. 82–91. Available at Accessed September 3, 2019.

    [2] S. Kucherenko et al. 2001, ‘Construction and Comparison of High-Dimensional SobolGenerators’, Wilmott, Nov, pp. 64-79. Available at Accessed September 23, 2019.

    [3] Broda. Published 2019. Accessed September 23, 2019.

    [4] P. Jäckel 2001, ‘Monte Carlo Methods In Finance’, pp. 122.

    [5] P. Glasserman 2003, ‘Monte Carlo Methods in Financial Engineering’, Springer.