Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No way to create an amortization for a Rate that doesn't compound monthly #4

Open
fringd opened this issue Sep 6, 2011 · 3 comments
Assignees

Comments

@fringd
Copy link

fringd commented Sep 6, 2011

r = Finance::Rate.new( Flt::DecNum('0.06'), :apr, :duration => 10.years, :compounds => 4 )

a = Finance::Amortization.new( 1000, r )

a.interest seems to have 10_12 entries, not 10_4

doesn't seem to be right with duration set to 10 or 10 * 4 either ( it doesn't apply 1/4 of 0.06 as expected )

is there some way to do this that just isn't obvious from the readme? or is this simply non-working?

@wkranec
Copy link
Collaborator

wkranec commented Sep 6, 2011

Thanks for bringing this up. I think this is due to the fact that the #years method is a little half-baked at this point:

  • It simply multiplies by 12 to get the number of months.
  • Since #years is a Numeric method rather than a Rate method, it doesn't necessarily know the number of compounding periods.

You should still be able to create the amortization, but (for now) you will have to manually compute the duration, i.e.:

r = Finance::Rate.new( Flt::DecNum('0.06'), :apr, :duration => 40, :compounds => 4 )
a = Finance::Amortization.new( 1000, r )

@fringd
Copy link
Author

fringd commented Sep 6, 2011

Hmmm... I think that my problem is that I need the number of payments
per year to be something besides 12 as well...

so that you make debt payments 4 times per year instead of 12.

I am trying to mirror the Excel cumprinc function with a number of
periods not equal to 12

On Tue, Sep 6, 2011 at 12:52 PM, wkranec
[email protected]
wrote:

Thanks for bringing this up.  I think this is due to the fact that the #years method is a little half-baked at this point:

  • It simply multiplies by 12 to get the number of months.
  • Since #years is a Numeric method rather than a Rate method, it doesn't necessarily know the number of compounding periods.

You should still be able to create the amortization, but (for now) you will have to manually compute the duration, i.e.:

r = Finance::Rate.new( Flt::DecNum('0.06'), :apr, :duration => 40, :compounds => 4 )
a = Finance::Amortization.new( 1000, r )

Reply to this email directly or view it on GitHub:
#4 (comment)

@wkranec
Copy link
Collaborator

wkranec commented Sep 11, 2011

The Amortization payments will match the compounding periods of the Rate given. So the example I gave before should work here.

I probably ought to have a #balance method which gives you the balance of the loan in a particular period. This would make it easier to replicate cumprinc.

@marksweston marksweston self-assigned this Nov 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@fringd @marksweston @wkranec and others