Skip to content

Commit

Permalink
begin work on addressing #64
Browse files Browse the repository at this point in the history
  • Loading branch information
genedan committed Sep 26, 2020
1 parent ffe589f commit a66bf76
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tmval/annuity.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,9 +449,9 @@ def sv(self):
sv = self.sbar_angln()

else:
sv = self.amount * \
((1 + self.gr.interest_rate) ** self.term - 1) / \
(self.gr.val(self.period) - 1)
i = self.gr.val(self.period) - 1
n = self.n_payments
sv = self.amount * ((1 + i) ** n - 1) / i

elif self.aprog != 0 and self.mprog == 0:

Expand Down Expand Up @@ -934,7 +934,7 @@ def olb_p(

else:
ann = Annuity(
period=period,
period=min(period, term - t),
term=term - t,
gr=gr,
amount=q
Expand Down
3 changes: 3 additions & 0 deletions tmval/loan.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ def __init__(
elif pp:
self.pmt_sched = self.get_payments()
self.pmt = self.pmt_sched.amounts[0]
else:
self.pmt_sched = Payments(times=[], amounts=[])
self.pmt = None

elif pmt and isinstance(pmt, (float, int)) and period and term:
n_payments = ceil(term / period)
Expand Down

0 comments on commit a66bf76

Please sign in to comment.