Login  Register

Re: Operation opposite to dayCounter.yearFraction()

Posted by Grześ Andruszkiewicz on Feb 18, 2013; 11:21am
URL: http://quantlib.414.s1.nabble.com/Operation-opposite-to-dayCounter-yearFraction-tp14046p14048.html

Hi Luigi,

I am using ActualActual currently. The reason is that I am dealing
with natural events. Does it make sense?

I have an end date as well, so would it make sense to use:

Integer days = t*dayCounter.dayCount(start,
end)/dayCounter.yearFraction(start, end);

?

Ciao,
Grzegorz

On 18 February 2013 11:13, Luigi Ballabio <[hidden email]> wrote:

> Hi,
>     unfortunately, there's no defined inverse for yearFraction.  You
> can probably get close by writing
>
> Date eventDate = start+(t*365)*Days;
>
> but then again, depending on the day counter that 365 might have to be
> 360 instead. You'll have to check what day counter is used in
> nextEvent().
>
> Luigi
>
> On Mon, Feb 18, 2013 at 12:01 PM, Grześ Andruszkiewicz
> <[hidden email]> wrote:
>> Hi,
>>
>> I have the following code:
>>
>> Real t = nextEvent();//years
>> Date eventDate = start+t*Years;
>>
>> but this seems to be incorrect, because Period rounds t to an Integer.
>> In the opposite direction I can get a year fraction using
>> dayCounter.yearFraction(). How can I get a date, when I know the start
>> date and the year fraction (possibly greater than 1)?
>>
>> Regards,
>> Grzegorz
>>
>> ------------------------------------------------------------------------------
>> The Go Parallel Website, sponsored by Intel - in partnership with Geeknet,
>> is your hub for all things parallel software development, from weekly thought
>> leadership blogs to news, videos, case studies, tutorials, tech docs,
>> whitepapers, evaluation guides, and opinion stories. Check out the most
>> recent posts - join the conversation now. http://goparallel.sourceforge.net/
>> _______________________________________________
>> QuantLib-dev mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/quantlib-dev

------------------------------------------------------------------------------
The Go Parallel Website, sponsored by Intel - in partnership with Geeknet,
is your hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials, tech docs,
whitepapers, evaluation guides, and opinion stories. Check out the most
recent posts - join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev