Re: timeFromReference

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: timeFromReference

Luigi Ballabio
Hi Theo,
   I didn't remember timeFromReference is public now. It used to be
protected. Good to know.

Anyway: the difference between the code in sabrvolsurface.cpp and your
code is probably that the former is inside a method of SabrVolSurface,
which inherits from the TermStructure class; thus, it has direct
access to timeFromReference as one of its own methods.

If your code is not part of a class derived from TermStructure, you
can't call it directly.  If you have some kind of term structure
available in scope, you can call termStructure.timeFromReference(d);
otherwise, you'll have to use a day counter and make the call to
yearFraction manually.

Luig

On Fri, Dec 21, 2012 at 10:53 AM, Boafo, Theophilus
<[hidden email]> wrote:

>
>  Hi Luigi,
>
> timeFromReference is a public method in the TermStructure class.
>
> Also in sabrvolsurface.cpp, I see this
>
>             LinearInterpolation interpolator(optionTimes_.begin(),
> optionTimes_.end(),
>                                              vols.begin());
>             interpolatedVols[i] =
> interpolator(timeFromReference(d),true);
>
> and is called directly.
>
> I managed to compile sabrvolsurface.cpp, dont understand how it works
>
>
> Regards
>
> Theo
>
>
> ----Original Message-----
> From: Luigi Ballabio [mailto:[hidden email]]
> Sent: Friday, 21 December 2012 5:22 PM
> To: Boafo, Theophilus
> Subject: Re: timeFromReference
>
> Theo,
>     mailing list, please.
>
> Anyway: timeFromReference is a protected method of the TermStructure
> class, so you can't use it as a free function like you're doing.
> Instead, just define a day counter and a reference date and use
> dayCounter.yearFraction(referenceDate, observationDate).
>
> Luigi
> "This e-mail and any attachments to it (the "Communication") is, unless otherwise stated, confidential,  may contain copyright material and is for the use only of the intended recipient. If you receive the Communication in error, please notify the sender immediately by return e-mail, delete the Communication and the return e-mail, and do not read, copy, retransmit or otherwise deal with it. Any views expressed in the Communication are those of the individual sender only, unless expressly stated to be those of Australia and New Zealand Banking Group Limited ABN 11 005 357 522, or any of its related entities including ANZ Bank New Zealand Limited (together "ANZ"). ANZ does not accept liability in connection with the integrity of or errors in the Communication, computer virus, data corruption, interference or delay arising from or in respect of the Communication."

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: timeFromReference

Boafo, Theophilus
Many thanks Luigi, Merry Xmas to you in advance

Regards

Theo

-----Original Message-----
From: Luigi Ballabio [mailto:[hidden email]]
Sent: Friday, 21 December 2012 6:16 PM
To: Boafo, Theophilus
Cc: quantlib-users
Subject: Re: timeFromReference

Hi Theo,
   I didn't remember timeFromReference is public now. It used to be
protected. Good to know.

Anyway: the difference between the code in sabrvolsurface.cpp and your
code is probably that the former is inside a method of SabrVolSurface,
which inherits from the TermStructure class; thus, it has direct access
to timeFromReference as one of its own methods.

If your code is not part of a class derived from TermStructure, you
can't call it directly.  If you have some kind of term structure
available in scope, you can call termStructure.timeFromReference(d);
otherwise, you'll have to use a day counter and make the call to
yearFraction manually.

Luig

On Fri, Dec 21, 2012 at 10:53 AM, Boafo, Theophilus
<[hidden email]> wrote:

>
>  Hi Luigi,
>
> timeFromReference is a public method in the TermStructure class.
>
> Also in sabrvolsurface.cpp, I see this
>
>             LinearInterpolation interpolator(optionTimes_.begin(),
> optionTimes_.end(),
>                                              vols.begin());
>             interpolatedVols[i] =
> interpolator(timeFromReference(d),true);
>
> and is called directly.
>
> I managed to compile sabrvolsurface.cpp, dont understand how it works
>
>
> Regards
>
> Theo
>
>
> ----Original Message-----
> From: Luigi Ballabio [mailto:[hidden email]]
> Sent: Friday, 21 December 2012 5:22 PM
> To: Boafo, Theophilus
> Subject: Re: timeFromReference
>
> Theo,
>     mailing list, please.
>
> Anyway: timeFromReference is a protected method of the TermStructure
> class, so you can't use it as a free function like you're doing.
> Instead, just define a day counter and a reference date and use
> dayCounter.yearFraction(referenceDate, observationDate).
>
> Luigi
> "This e-mail and any attachments to it (the "Communication") is,
unless otherwise stated, confidential,  may contain copyright material
and is for the use only of the intended recipient. If you receive the
Communication in error, please notify the sender immediately by return
e-mail, delete the Communication and the return e-mail, and do not read,
copy, retransmit or otherwise deal with it. Any views expressed in the
Communication are those of the individual sender only, unless expressly
stated to be those of Australia and New Zealand Banking Group Limited
ABN 11 005 357 522, or any of its related entities including ANZ Bank
New Zealand Limited (together "ANZ"). ANZ does not accept liability in
connection with the integrity of or errors in the Communication,
computer virus, data corruption, interference or delay arising from or
in respect of the Communication."
"This e-mail and any attachments to it (the "Communication") is, unless otherwise stated, confidential,  may contain copyright material and is for the use only of the intended recipient. If you receive the Communication in error, please notify the sender immediately by return e-mail, delete the Communication and the return e-mail, and do not read, copy, retransmit or otherwise deal with it. Any views expressed in the Communication are those of the individual sender only, unless expressly stated to be those of Australia and New Zealand Banking Group Limited ABN 11 005 357 522, or any of its related entities including ANZ Bank New Zealand Limited (together "ANZ"). ANZ does not accept liability in connection with the integrity of or errors in the Communication, computer virus, data corruption, interference or delay arising from or in respect of the Communication."

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users