Getting Started
Setting up the link to QuantLib
The first step is to load the QuantLib package.
In[2]:=
The current version of Quantlib can be retrieved
In[3]:=
Out[3]=
Also the QuantLibAddin version might be of interest
In[4]:=
Out[4]=
A list of available QuantLib categories is set up during installation and can be retrieved as
In[5]:=
Out[5]=
There is same basic information available on each category
In[6]:=
The functions available in each category can be retrieved with the Category command
In[7]:=
Out[7]=
In[8]:=
Out[8]=
To each function the type is attached. This allows to select the constructors and member functions
In[9]:=
Out[9]=
In[10]:=
Out[10]=
Also for each function usage information is available
In[12]:=
In most cases there are additional options set up for a function
In[13]:=
Out[13]=
A simple option pricing example as a starter
This simple example demonstrates the valuation of a plain vanilla option using the different object available in QuantLib. Alternatively you also can use the well known formula which is also available in QuantLib.
Just using a formula
In[14]:=
With most functions there are options associated. This simplifies the calling of functions.
In[15]:=
Out[15]=
In[16]:=
Out[22]=
Working with objects
Defining an instrument
The exericise function is one part of the instrument description
In[23]:=
Out[24]=
|
When looking at the ExpiryDate properity it is noticable that internally dates a represnted as julian numbers. The transformation from date to julian number is most of the times done automatically. But there is also a function available to do it manually.
In[26]:=
In[27]:=
In[28]:=
Out[28]=
In[29]:=
Out[29]=
In[30]:=
|
So far we have generated three objects.
In[31]:=
Out[31]=
Defining the driving process
Here a Black-Scholes process is assumed which is driven by a scalar volatility parameter
In[32]:=
In[33]:=
Out[34]=
In[35]:=
Out[35]=
Now an symbol/object vol1 exists with a number of attributes. To see the details use
In[36]:=
|
In[37]:=
Out[38]=
In[39]:=
Out[40]=
In[41]:=
|
Defining the valuation method
In[42]:=
In[43]:=
Out[43]=
In[44]:=
|
Doing the valuation
In[45]:=
Out[46]=
Out[47]=