Bug in DayCounter for ActualActual::ISMA ?

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

Bug in DayCounter for ActualActual::ISMA ?

Dagur Gunnarsson-2
hello,

I am getting strange results with the  DayCounter using the ActualActual::ISMA day convention.

DayCounter dayCounter = ActualActual(ActualActual::ISMA);
cout<<setprecision(10)<<" yearfract "<< dayCounter.yearFraction(Date(2, Mar, 2012), Date(26, Feb, 2013))<<endl;

gives me :

yearfract 1.0000000000 -  Instead of 361/366 

Could this be a bug?

regards
Dagur G

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Bug in DayCounter for ActualActual::ISMA ?

Luigi Ballabio
With ISMA, if the period is somewhat irregular, you'll need to pass
reference dates for the result to make sense.  In this case,

dayCounter.yearFraction(Date(2, Mar,2012), Date(26, Feb, 2013),
                        Date(2,Mar,2012), Date(2,Mar,2013))

will give you 0.989041095890411, which is 361/365;

dayCounter.yearFraction(Date(2, Mar,2012), Date(26, Feb, 2013),
                        Date(26,Feb,2012), Date(26,Feb,2013))

will give you 0.9863387978142076, which is 361/366; and

dayCounter.yearFraction(Date(2, Mar,2012), Date(26, Feb, 2013),
                        Date(1,Jan,2012), Date(1,Jan,2013))

will give you 0.98675799086758, which matches 305/366 + 56/365 (the
part in 2012 + the part in 2013).

If you don't pass any dates, the only thing the day counter can do is
take the two passed dates as the start and end of the reference
period, which in this case messes things up.

Later,
    Luigi


On Fri, Mar 2, 2012 at 9:13 AM, Dagur Gunnarsson <[hidden email]> wrote:

> hello,
>
> I am getting strange results with the  DayCounter using the
> ActualActual::ISMA day convention.
>
> DayCounter dayCounter = ActualActual(ActualActual::ISMA);
> cout<<setprecision(10)<<" yearfract "<< dayCounter.yearFraction(Date(2, Mar,
> 2012), Date(26, Feb, 2013))<<endl;
>
> gives me :
>
> yearfract 1.0000000000 -  Instead of 361/366
>
> Could this be a bug?
>
> regards
> Dagur G
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users