calculating time factor of a cashflow

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

calculating time factor of a cashflow

Khanh Nguyen
Hi,

I am writing a function that is similar to this

http://www.mathworks.com/access/helpdesk/help/toolbox/finance/cfamounts.html


I figured that I can set up a Fixed-Rate Bond to get the cashflow
amount and cashflow dates (please correct me if I am wrong..). Now I
am stuck at the TFactors - time factor of a cashflow, and CFlowFlags..
How should I go about calculating them with QuantLib?

Thanks

-k

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

calculating time factor of a cashflow

Piter Dias-4
Khanh,

> am stuck at the TFactors - time factor of a cashflow, and CFlowFlags..
> How should I go about calculating them with QuantLib?

You could try the yearFraction method of DayCounter class, assuming you
already have the correct day count basis in order to instantiate the proper
class.

Regards,

-------------------------

Piter Dias
[hidden email]

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: calculating time factor of a cashflow

Khanh Nguyen
Hi Piter,

Thank you for your answer. Could you elaborate a little more? I can't
establish a "connection" between yearFraction() with the Matlab's
description of TimeFactor.

Regards,

Khanh Nguyen

On Mon, Jan 4, 2010 at 6:28 PM, Piter Dias <[hidden email]> wrote:

> Khanh,
>
>> am stuck at the TFactors - time factor of a cashflow, and CFlowFlags..
>> How should I go about calculating them with QuantLib?
>
> You could try the yearFraction method of DayCounter class, assuming you
> already have the correct day count basis in order to instantiate the proper
> class.
>
> Regards,
>
> -------------------------
>
> Piter Dias
> [hidden email]
>

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: calculating time factor of a cashflow

Khanh Nguyen
there was a typo.. It should read

"between yearFraction() and the Matlab's description of TimeFactor."

-k

On Mon, Jan 4, 2010 at 6:38 PM, Khanh Nguyen <[hidden email]> wrote:

> Hi Piter,
>
> Thank you for your answer. Could you elaborate a little more? I can't
> establish a "connection" between yearFraction() with the Matlab's
> description of TimeFactor.
>
> Regards,
>
> Khanh Nguyen
>
> On Mon, Jan 4, 2010 at 6:28 PM, Piter Dias <[hidden email]> wrote:
>> Khanh,
>>
>>> am stuck at the TFactors - time factor of a cashflow, and CFlowFlags..
>>> How should I go about calculating them with QuantLib?
>>
>> You could try the yearFraction method of DayCounter class, assuming you
>> already have the correct day count basis in order to instantiate the proper
>> class.
>>
>> Regards,
>>
>> -------------------------
>>
>> Piter Dias
>> [hidden email]
>>
>

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Calculating time factor of a cashflow

Piter Dias-4
Khanh

> Thank you for your answer. Could you elaborate a little more? I can't
> establish a "connection" between yearFraction() with the Matlab's
> description of TimeFactor.


Please take a look at the PV formula where TFactor is explained. The
denominator in that formula looks like the code below, from
interestrate.cpp:

          case Compounded:
            return std::pow(1.0+r_/freq_, freq_*t);

Comparing the two formulas you can see that TFactor = freq_*t, where t =
yearFraction.

You can check the compoundFactor methods of InterestRate class in order to
understand how yearFraction (method of DayCounter class) is used.

Regards,

-------------------------

Piter Dias
[hidden email]

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users