Bojan Nikolic: Using and Understanding the QuantLib Addin

[website home] | [BN Algorithms]

qlPricingEngine – Create a engine for pricing derivatives

Creates an object representing a pricing engine, i.e., a method for pricing derivatives. The type of pricing engine to be created is decided based on the string parameter <EngineID>. See also qlBinomialPricingEngine – Create pricing engines with discretised time.

Usage:

=qlPricingEngine(<ObjPrefix>, <EngineID>,
                 <ProcessID>)
<ObjPrefix>

Optional prefix for names of objects created with this function

<EngineID>

The type of engine that is to be constructed. Should be one of following:

  • AB – AnalyticBarrierEngine

  • AC – AnalyticCliquetEngine

  • ACGAPA – AnalyticContinuousGeometricAveragePriceAsianEngine

  • ADA – AnalyticDigitalAmericanEngine

  • ADE – AnalyticDividendEuropeanEngine

  • ADGAPA – AnalyticDiscreteGeometricAveragePriceAsianEngine

  • AE – AnalyticEuropeanEngine

  • AP – AnalyticPerformanceEngine

  • BAWA – BaroneAdesiWhaleyApproximationEngine

  • BSA – BjerksundStenslandApproximationEngine

  • I – IntegralEngine

  • PE – PricingEngine

  • SE – StulzEngine

<ProcessID>

Object of type GeneralizedBlackScholesProcess, created for example with qlGeneralizedBlackScholesProcess – Create an object representing the Black-Scholes process

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

    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)        ;

        String pengine=qlw.qlPricingEngine("pengine", 
                                           "AE",
                                           process,
                                           qlw.OH_NULL(),
                                           qlw.OH_NULL(),
                                           false);

    }
}