Bojan Nikolic: Using and Understanding the QuantLib Addin

[website home] | [BN Algorithms]

qlBlackConstantVol – Create a Volatility Structure with constant volatility for all times and strikes

This is the simplest volatility structure where the volatility is always constant and equal to the user defined value. For a maturity/strike dependant surface see qlBlackVarianceSurface – Create volatility structure represented by variance surface.

Usage:

=qlBlackConstantVol(<ObjPrefix>,
                    <SettlementDate>, <Calendar>,
                    <Volatility>, <DayCounter>)
<ObjPrefix>

Optional prefix for names of objects created with this function

<SettlementDate>

Reference date to which the volatility is zero

<Calendar>

Calendar to use in the underlying term structure. Used to adjustment to a business day

<Volatility>

The constant Black volatility that this object represents.

<DayCounter>

The day counter to use for calculating the length of time to use to convert the user-supplied annualised volatility to actual volatility during an interval

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 qlBlackConstantVol {

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

}