Bojan Nikolic: Using and Understanding the QuantLib Addin

[website home] | [BN Algorithms]

qlGeneralizedBlackScholesProcess – Create an object representing the Black-Scholes process

Creates an object describing a process of form

\[dS(t, S) = (r - q - \frac{\sigma(t, S)^2}{2}) dt + \sigma dW_t\]

where:

\(r\)

is the risk free rate (defined by parameter <RiskFreeRate> below). The rate passed in the Addin is a flat-forward rate, not a term structure.

\(q\)

the dividend rate (parameter <DividendYield> below)

\(\sigma(t,S)\)

volatility defined by the term structure in parameter <BlackVolId> below

Usage:

=qlGeneralizedBlackScholesProcess(<ObjPref>, <BlackVolId>,
                                  <Underlying>, <DayCounter>,
                                  <SettlementDate>,
                                  <RiskFreeRate>, <DividendYield>)
<ObjPrefix>

Optional prefix for names of objects created with this function

<BlackVolId>

An object representing the volatility term structure to use for this process. See for example qlBlackConstantVol – Create a Volatility Structure with constant volatility for all times and strikes.

<Underlying>

The present value of the underlying being modelled.

<DayCounter>

Day count convention used to calculate the interest earned over a specific period of time. For example, “Actual/360”.

<SettlementDate>

Value date from which interest begins to be earned. (Does not affect volatility/variance calculations)

<RiskFreeRate>

The risk-free rate as a number

<DividentYield>

The dividend yield as a number

Here is example usage in QLW – QuantLib-Addin like interface from Java and Python

// Copyright (C) 2012 Bojan Nikolic <bojan@bnikolic.co.uk>
//

import co.uk.bnikolic.qlw.property_t;
import co.uk.bnikolic.qlw.qlw;
import co.uk.bnikolic.qlw.StringVector;
import co.uk.bnikolic.qlw.LongVector;
import co.uk.bnikolic.qlw.PropertyVector;

public class qlGeneralizedBlackScholesProcess{

    public static void main(String[] args) throws Exception {
        property_t settlementdate=new property_t(41030);
        property_t dcc=new property_t("Actual/365 (Fixed)");
        String vol=qlw.qlBlackConstantVol("vol",
                                          settlementdate, 
                                          "TARGET", 
                                          0.2, 
                                          dcc,
                                          qlw.OH_NULL(),
                                          qlw.OH_NULL(),
                                          false);
        String process=qlw.qlGeneralizedBlackScholesProcess("process", 
                                                            "vol",
                                                            100.0, 
                                                            dcc,
                                                            settlementdate, 
                                                            0.05, 
                                                            0.02,
                                                            qlw.OH_NULL(),
                                                            qlw.OH_NULL(),
                                                            false)        ;

    }

}