Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rcalxrc08 committed Aug 27, 2024
1 parent 258026a commit 32c8a0b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/financial_implied_volatility.jl
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ end

import ChainRulesCore: rrule, frule, NoTangent, @thunk, rrule_via_ad, frule_via_ad

function blprice_diff_impl(S0, K, T, σ, price_d, FlagIsCall)
return price_d - blprice_impl(S0, K, T, σ, FlagIsCall)
end

function rrule(config::RuleConfig{>:HasReverseMode}, ::typeof(blimpv), S0, K, T, price_d, FlagIsCall, xtol, n_iter_max)
σ = blimpv(S0, K, T, price_d, FlagIsCall, xtol, n_iter_max)
function update_pullback(slice)
Expand All @@ -109,10 +113,7 @@ function rrule(config::RuleConfig{>:HasReverseMode}, ::typeof(blimpv), S0, K, T,
return σ, update_pullback
end

function blprice_diff_impl(S0, K, T, σ, price_d, FlagIsCall)
return price_d - blprice_impl(S0, K, T, σ, FlagIsCall)
end
#TODO: Test the following function

function frule(config::RuleConfig{>:HasForwardsMode}, (_, dS, dK, dT, dprice, _, _, _), ::typeof(blimpv), S0, K, T, price_d, FlagIsCall::Bool, xtol, n_iter_max::Integer)
σ = blimpv(S0, K, T, price_d, FlagIsCall, xtol, n_iter_max)
vega = blvega_impl(S0, K, T, σ)
Expand Down
2 changes: 1 addition & 1 deletion test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

[compat]
Diffractor = "0.2.4"
Diffractor = "0.2"
DualNumbers = "0.5, 0.6"
ForwardDiff = "0.10"
HyperDualNumbers = "4"
Expand Down

0 comments on commit 32c8a0b

Please sign in to comment.