Posted by
Jicun Zhong on
URL: http://quantlib.414.s1.nabble.com/VanillaSwap-evaluation-between-effective-and-termination-date-tp383p385.html
Hi Luigi,
Attached another modified swapvaluation.cpp where if the effective date of the schedules are set with the original IRS effective date will cause an missing past fixing exception and fail the calculation. In such a case, what is the general procedure to provide fixings before call NPV? Obviously this exception depends on the evaluation date. If one passes as effective date of the schedule the immediate cash flow date that is later than the settlement date, then this will not happen. So some explanation is needed here.
Thanks!
Jicun
-----Original Message-----
From: Luigi Ballabio [mailto:
[hidden email]]
Sent: den 29 juni 2011 16:36
To: Jicun Zhong
Cc:
[hidden email]
Subject: Re: [Quantlib-users] VanillaSwap evaluation between effective and termination date
On Mon, 2011-06-20 at 12:42 +0200, Jicun Zhong wrote:
> Hi,
>
> I am trying to calculate NPV of a vanilla swap based in the
> swapvaluation.cpp code.
>
> I have setup the swap the following way :
>
> Effective time : 2010-10-01
>
> Termination time : 2020-10-01
>
> Evaluation date is June 20, 2011 which will have a settlement date on
> June 22, 2011. The rates used are :
>
> USDLibor BBA depo rates from ON to 12 months and several swap rates
> from 2 years to 30 years. The fixed payment frequency is annual and
> floating is semiannual. The calendar used is TARGET. As shown here the
> difference is the evaluation date is between the swap’s effective and
> termination dates. So when I came to construct the VanillaSwap, what
> should I pass for the effective date parameter for the fixed and
> floating schedules if the date generation rule is Forward? If I pass
> June 22, then the payment dates thus generated will be different from
> the original schedule. So I pass the original effective date
> 2010-10-01 as effective date. But with this setting, I got an
> exception in DiscountingSwapEngine::calculate() when it discounts on
> each cash flow’s startDate like startDiscounts[i] =
> discountCurve_->discount(d) because timeFromReference (referernce
> date is June 22, 2011) will be negative. So what is this
> startDiscounts are used for in the first place and what should one
> setup to evaluate a VanillaSwap on a date between its effective and
> termonation time. Should one pass as effective date of the schedule
> the immediate cach flow date that is later than the settlement date
> (June 22, 2011, this is case)?
Jicun,
your code works correctly on my Ubuntu machine (and yes, I'm catching
exceptions.) It is to be expected that for some of the
startDiscounts[i] an exception is thrown, but it should be caught and
discarded a few lines later (in the catch (...) clause at line 95 of
discountingswapengine.cpp) and the execution of the code should continue
normally after this. Are you saying that the exception escapes from the
engine?
Luigi
--
Skinner's Constant (or Flannagan's Finagling Factor):
That quantity which, when multiplied by, divided by, added to,
or subtracted from the answer you got, gives you the answer you
should have gotten.
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users