Skip to content

Commit

Permalink
add method to allow PV on CashflowProjeciton
Browse files Browse the repository at this point in the history
  • Loading branch information
alecloudenback committed Nov 3, 2023
1 parent 41345cb commit 7a2d7e8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/model/Model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,12 @@ function FinanceCore.present_value(model, c::FinanceCore.AbstractContract, cur_t
p = Projection(c, model, CashflowProjection())
xf = p |> Filter(cf -> cf.time >= cur_time) |> Map(cf -> FinanceCore.discount(model, cur_time, cf.time) * cf.amount)
foldxl(+, xf)
end

function FinanceCore.present_value(model, p::FinanceModels.Projection{C,M,K}, cur_time=0.0) where
{
C,M,K<:CashflowProjection
}
xf = p |> Filter(cf -> cf.time >= cur_time) |> Map(cf -> FinanceCore.discount(model, cur_time, cf.time) * cf.amount)
foldxl(+, xf)
end

0 comments on commit 7a2d7e8

Please sign in to comment.