Re: problem with ZeroCurve and ActualActual(Bond) day count

Posted by Peter Caspers-4 on
URL: http://quantlib.414.s1.nabble.com/problem-with-ZeroCurve-and-ActualActual-Bond-day-count-tp14661p14666.html

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.clktrk
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
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