Re: VanillaSwap evaluation between effective and termination date

Posted by Jicun Zhong on
URL: http://quantlib.414.s1.nabble.com/VanillaSwap-evaluation-between-effective-and-termination-date-tp383p388.html

No. It only caught my attention when I turned on capture all C++ exceptions. My question is really about why the startDiscounts are implemented there and what is its usage. If it is designed in the way you described, then the effectiveDate parameter for the schedule constructor should be the original effective date of the vanilla IRS not something dependent on the evaluation date right?

Thanks for the reply!

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