Login  Register

Re: RE: Double Barrier Options

Posted by rjcookusa on Mar 09, 2004; 9:32am
URL: http://quantlib.414.s1.nabble.com/SVD-routine-error-tp2794p2798.html

This is the info I sent to Daniel Saitowitz without the source code
attachments for QuantLib.Pricers.DblBarrierOption::DblBarrierOption

Daniel:
These are the source files (dblbarrieroption.cpp etc). They were last
compiled into the QuantLib-0.3.0 source tree. There is also a reference to the model
in quantlib.hpp, so I attached that.

I also created a test case that goes in the examples directory i.e. I created
a new dir called D:\QuantLib-0.3.0\Examples\BarrierOption and created a VC++
dsw for it. I ve attached the actual test file (BarrierOption.cpp) that was
modified from another test case. If you want the entire directory I can send it
as well. The test case actually diffs the value with the VBA prototype, which
I previously verified as correct vs Fenics.

It should look like this

D:\QuantLib-0.3.0\Examples\BarrierOption\build\Debug>BarrierOption
Time to maturity = 0.25
Underlying price = 100
Strike = 100
Risk-free interest rate = 0.1
Volatility = 0.15
BarType = 1
LoBarrier = 90
HiBarrier = 110

Method              Value                       EstimatedError
Black Scholes   2.91752076761027    0.00000000000000    0.0000  0.0000
Double Barrier  1.20547906151793    0.00000010708526    0.0000  0.0000

It should be noted that the VBA price = 1.20547916860319, which is not
exactly the same as the C++ price here.

regards

Julian Cook