FinancialDerivatives.jl
FinancialDerivatives.jl copied to clipboard
Derivatives require too-strict type signatures
It seems like your dispatching for derivatives is too strict. Terms like
struct AmericanOption{T<:Number} <: Option
s::T
k::T
r::T
σ::T
t::T
call::Int64
end
mean that you can't create an option with mixed Ints and Floats like AmericanOption(10, 12, 0.05, 0.4, 1, 1). Also, I don't think you use the parameterization {T} when you dispatch on it later in evaluate(...), so I'd suggest modifying the definitions to:
struct AmericanOption <: Option
s::Real
k::Real
r::Real
σ::Real
t::Real
call::Int64
end
I can make a PR and run tests to make sure when I get a chance. Let me know if I'm missing anything obvious though!