Bojan Nikolic: Using and Understanding the QuantLib Addin

[website home] | [BN Algorithms]

qlVanillaOption – Create a Vanilla option derivative

This function creates a vanilla option derivative. The properties of the derivative are defined by its payoff and the exercise.

Usage:

=qlVanillaOption(<ObjPrefix>,
                 <Payoff>, <Exercise>)
<ObjPrefix>

Optional prefix for names of objects created with this function

<Payoff>

Definition of the option payoff. See for example, qlStrikedTypePayoff – create a definition of a derivative payoff

<Exercise>

Definition of the possible exercise of the derivative. See for example qlEuropeanExercise – create an object defining a derivative that can only be exercised at maturity

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

    public static void main(String[] args) throws Exception {

        String payoff=qlw.qlStrikedTypePayoff("payoff", 
                                              "Vanilla", 
                                              "Call", 
                                              100.0,
                                              qlw.OH_NULL(),
                                              qlw.OH_NULL(),
                                              qlw.OH_NULL(),
                                              false
                                              );

        String exercise=qlw.qlEuropeanExercise("exercise", 
                                               new property_t("41030"),
                                               qlw.OH_NULL(),
                                               qlw.OH_NULL(),
                                               false);

        String option=qlw.qlVanillaOption("option",
                                          payoff, 
                                          exercise,
                                          qlw.OH_NULL(),
                                          qlw.OH_NULL(),
                                          false);

    }
}