Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
alecloudenback committed Nov 3, 2023
1 parent b930f73 commit f29d50c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ FinanceModelsMakieCoreExt = "MakieCore"
AccessibleOptimization = "^0.1.1"
Accessors = "^0.1"
BSplineKit = "^0.16"
FinanceCore = "^2"
FinanceCore = "^2.1"
IntervalSets = "^0.7"
MakieCore = "0.6"
Optimization = "^3.15"
Expand Down
9 changes: 9 additions & 0 deletions src/Projection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,12 @@ function __rewrap(from, to)
# we've hit bottom, so return `to`
return to
end


function FinanceCore.present_value(model, p::FinanceModels.Projection{C,M,K}, cur_time=0.0) where
{
C,M,K<:FinanceModels.CashflowProjection
}
xf = p |> Filter(cf -> cf.time >= cur_time) |> Map(cf -> FinanceCore.discount(model, cur_time, cf.time) * cf.amount)
foldxl(+, xf)
end
8 changes: 0 additions & 8 deletions src/model/Model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,4 @@ 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 f29d50c

Please sign in to comment.