Posted by
Knox, Matt on
URL: http://quantlib.414.s1.nabble.com/problem-with-ZeroCurve-and-ActualActual-Bond-day-count-tp14661p14668.html
Thanks Peter. The situation is as follows:
I have a pre-calculated zero curve which was boot strapped from government of Canada bonds. According to this document
http://iiac.ca/wp-content/uploads/Canadian-Conventions-in-FI-Markets.pdf , the day count convention for these bonds would be ActualActual(Bond) if I am understanding it correctly - see footnote at bottom of page 6 of that document. I want to use this curve to calculate some shocks on a bond portfolio, as well as a stream of cash flows (representing pension liabilities). My thinking was that when I construct the zero curve, I should match the day count convention of the bonds that were used to build it. Furthermore, for apples to apples comparison with the liabilities, I should use the same day count on the liability cash flows. However, due to the spacing of the data points in the pre-calculated curve, I would have to pre-adjust the curve to pass it into the ZeroCurve constructor if I am to use the ActualActual(Bond) day count convention.
So my options seem to be: adjust the curve, or pick another day count convention that is "good enough".
Does my thinking make sense here? Or am I going about this the wrong way? Thanks for the reply, appreciate any insight you can offer.
- Matt
-----Original Message-----
From: Peter Caspers [mailto:
[hidden email]]
Sent: November 16, 2013 3:02 PM
To: Knox, Matt
Cc: '
[hidden email]'
Subject: Re: [Quantlib-users] problem with ZeroCurve and ActualActual(Bond) day count
The dates are actually different, but the year fraction is the same for groups of several of dates under ActualActual/ICMA because no reference period is specified in TermStructure::timeFromReference(), therefore it is set equal to the period itself, therefore (largely) yearfractions of the form n/12 are produced. Since the spacing between your dates is only 10 days, more than one date can (and does) produce the same year fraction.
So I guess technically the behaviour is expected (also, with a meaningful message thrown).
The question is, what do you want to achieve exactly ?
best regards
Peter
"Knox, Matt" <
[hidden email]> writes:
> I am trying to construct zero curves using the ZeroCurve class (using
> the Python wrappers), and I seem to run into problems when using the
> ActualActual(Bond) day count convention. It thinks that different
> input dates are actually the same date.
>
> The best way I can explain this is with an example. Consider the
> following code:
>
> #.....................................................................
> import QuantLib as ql
> import traceback
>
> start_date = ql.Date(30,9,2013)
>
> # 50 years of data points spaced 10 days apart dates = [(start_date +
> x * 10) for x in range(365 * 5)] rates = [0.02 for _ in dates]
>
> for daycount, description in [
> (ql.ActualActual(ql.ActualActual.Bond), "ActualActual(Bond)"),
> (ql.ActualActual(ql.ActualActual.ISDA), "ActualActual(ISDA)"),
> (ql.Actual360(), "Actual360()"),
> (ql.Thirty360(), "Thirty360()"),
> ]:
> try:
> ql.ZeroCurve(dates, rates, daycount)
> print "success: %s" % description
> except:
> print "failure: %s" % description
> print traceback.format_exc()
> # and the output....
> failure: ActualActual(Bond)
> Traceback (most recent call last):
> File "foobar.py", line 47, in <module>
> ql.ZeroCurve(dates, rates, daycount)
> File "C:\analytics\ext\python27\lib\site-packages\QuantLib\
> QuantLib.py", line 10028, in __init__
> this = _QuantLib.new_ZeroCurve(*args)
> RuntimeError: two dates correspond to the same time under this curve's
> day count convention
>
> success: ActualActual(ISDA)
> success: Actual360()
> success: Thirty360()
>
> #....................................
> This is using Python 2.7 and QuantLib 1.3
>
> Any idea what is going on?
>
> Any help would be greatly appreciated. Thanks!
>
> - Matt Knox
>
>
>
> NOTICE: Confidential message which may be privileged. Unauthorized
> use/disclosure prohibited. If received in error, please go to
> www.td.com/legal for instructions.
> AVIS : Message confidentiel dont le contenu peut être privilégié.
> Utilisation/divulgation interdites sans permission. Si reçu par
> erreur, prière d'aller au www.td.com/francais/avis_juridique pour des
> instructions.
>
>
>
> ----------------------------------------------------------------------
> -------- DreamFactory - Open Source REST & JSON Services for HTML5 &
> Native Apps OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External
> API Access Free app hosting. Or install the open source package on any
> LAMP server.
> Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
>
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.c> lktrk _______________________________________________
> QuantLib-users mailing list
>
[hidden email]
>
https://lists.sourceforge.net/lists/listinfo/quantlib-usersNOTICE: Confidential message which may be privileged. Unauthorized use/disclosure prohibited. If received in error, please go to www.td.com/legal for instructions.
AVIS : Message confidentiel dont le contenu peut être privilégié. Utilisation/divulgation interdites sans permission. Si reçu par erreur, prière d'aller au www.td.com/francais/avis_juridique pour des instructions.
------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users