Replies: 1 comment
-
Hi @Bshlomis, thanks for the question. Here's a simple example: there are three payments of 1000. The interest rates are 4%, 5% and 3%. 1. Payments in arrears# model.py
import numpy as np
from cashflower import discount, variable
@variable(array=True)
def discount_rates():
return np.array([1, 1/1.04, 1/1.05, 1/1.03])
@variable(array=True)
def payments_in_arrears():
return np.array([0, 1000, 1000, 1000])
@variable(array=True)
def pv_payments_in_arrears():
return discount(cash_flows=payments_in_arrears(), discount_rates=discount_rates()) # settings.py
settings = {
# ...
"T_MAX_CALCULATION": 3,
"T_MAX_OUTPUT": 3,
} 2. Payments due# model.py
import numpy as np
from cashflower import discount, variable
@variable(array=True)
def discount_rates():
return np.array([1, 1/1.04, 1/1.05, 1/1.03])
@variable(array=True)
def payments_due():
return np.array([1000, 1000, 1000, 0])
@variable(array=True)
def pv_payments_due():
return discount(cash_flows=payments_due(), discount_rates=discount_rates()) # settings.py
settings = {
# ...
"T_MAX_CALCULATION": 3,
"T_MAX_OUTPUT": 3,
} Output
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
what if the payment occurs in arrear? is there any way to implement this in the discount function?
Beta Was this translation helpful? Give feedback.
All reactions