From f29d50c7160164a5f776e60a9de6ca897297c8dc Mon Sep 17 00:00:00 2001 From: Alec Loudenback Date: Fri, 3 Nov 2023 17:16:58 -0500 Subject: [PATCH] fix --- Project.toml | 2 +- src/Projection.jl | 9 +++++++++ src/model/Model.jl | 8 -------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Project.toml b/Project.toml index 878df9e..dcfba16 100644 --- a/Project.toml +++ b/Project.toml @@ -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" diff --git a/src/Projection.jl b/src/Projection.jl index ab20805..79d9557 100644 --- a/src/Projection.jl +++ b/src/Projection.jl @@ -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 \ No newline at end of file diff --git a/src/model/Model.jl b/src/model/Model.jl index 551e76f..3d62006 100644 --- a/src/model/Model.jl +++ b/src/model/Model.jl @@ -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 \ No newline at end of file