Skip to content

Commit

Permalink
black-karasinski
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandrebrilhante committed Oct 25, 2018
1 parent 8005b4d commit 021d554
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Financial derivatives modeling and pricing in Julia.

## Models

* `BlackKarasinski`
* `BlackScholes`
* `BrennanSchwartz`
* `CoxIngersollRoss`
Expand Down
4 changes: 3 additions & 1 deletion src/FinancialDerivatives.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export InterestRateDerivative,
EuropeanOption,
FXOption

export BlackScholes,
export BlackKarasinski,
BlackScholes,
BrennanSchwartz,
CoxIngersollRoss,
CoxRossRubinstein,
Expand All @@ -27,6 +28,7 @@ abstract type Model end

include("derivatives.jl")

include("models/black_karasinski.jl")
include("models/black_scholes.jl")
include("models/brennan_schwartz.jl")
include("models/cox_ingersoll_ross.jl")
Expand Down
15 changes: 15 additions & 0 deletions src/models/black_karasinski.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
struct BlackKarasinski <: Model end

"""
`BlackKarasinski`:
`n`: number of paths to simulate
"""
function evaluate(IRD::InterestRateDerivative, m::BlackKarasinski, n::Int64 = 12)
Δt = IRD.t / n
rates = [IRD.r]
for i = 0:n
dr = IRD.k * (IRD.θ - log(rates[end])) * Δt + IRD.σ * rates[end] * randn()
append!(rates, rates[end] + dr)
end
return rates
end

0 comments on commit 021d554

Please sign in to comment.