Skip to content

Commit

Permalink
doc and test
Browse files Browse the repository at this point in the history
  • Loading branch information
alecloudenback committed Nov 3, 2023
1 parent 7a2d7e8 commit b930f73
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/model/Model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ include("Volatility.jl")
include("Equity.jl")

"""
present_value(model,contract,current_time=0.0)
present_value(model,contract,current_time=0.0)
present_value(model,projection,current_time=0.0)
Return the value of the contract as corresponding with the valuation assumptions embedded in the `model`.
Return the value of the contract as corresponding with the valuation assumptions embedded in the `model` for the given contract or projection with `CashflowProjection` kind.
# Examples
Expand Down
2 changes: 2 additions & 0 deletions test/sp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ end
@test collect(Bond.Fixed(0.05, Periodic(1), 1)) == [Cashflow(1.05, 1.0)]

@test pv(Yield.Constant(0.05), Bond.Fixed(0.05, Periodic(1), 3.0)) 1.0
@test pv(Yield.Constant(0.05), p) 1.0
end

@testset "Floating Bonds" begin
Expand Down Expand Up @@ -47,6 +48,7 @@ end
swap = InterestRateSwap(curve, 10)
proj = Projection(swap, Dict("OIS" => curve), CashflowProjection())
@test pv(0.04, proj |> collect) 0.0 atol = 1e-12
@test pv(0.04, proj) 0.0 atol = 1e-12
end

@testset "Transduced Contracts" begin
Expand Down

0 comments on commit b930f73

Please sign in to comment.