Pricing a European Option in Black and Scholes framework: According to Black and Scholes model, the price of a european option can be expressed as follows:
European Call PriceCbs(S,K,r,T,σ,d)=Se−dTN(d1)−Ke−rTN(d2)
European Put PricePbs(S,K,r,T,σ,d)=Ke−rTN(−d2)−Se−dTN(−d1)
Computing Implied Volatility in a Black and Scholes framework: Given an option price V, the Black and Scholes implied volatility is defined as the positive number σ which solves:
From European Call PriceV=Se−dTN(d1)−Ke−rTN(d2)
From European Put PriceV=Ke−rTN(−d2)−Se−dTN(−d1)
where:
d1=σTln(KS)+(r−q+2σ2)Td2=d1−σT
The way to compute the volatility in this library is:
blsimpv accepts additional arguments such as the absolute tolerance and the maximum numbers of steps of the numerical inversion.
Currently blsimpv is using the rational inversion method based on LetsBeRational method in order to invert the relation between the price and the volatility. If you notice something wrong with the numerical inversion, you are strongly suggested to open a issue.
Computing Implied Volatility in Black framework: Given an option price V, the Black implied volatility is defined as the positive number σ which solves:
From European Call PriceV=Fe−rTN(d1)−Ke−rTN(d2)
From European Put PriceV=Ke−rTN(−d2)−Fe−rTN(−d1)
where:
d1=σTln(KF)+2σ2Td2=d1−σT
The way to compute the volatility in this library is:
blkimpv accepts additional arguments such as the absolute tolerance and the maximum numbers of steps of the numerical inversion.
Currently blkimpv is using the rational inversion method based on LetsBeRational method in order to invert the relation between the price and the volatility. If you notice something wrong with the numerical inversion, you are strongly suggested to open a issue.
Automatic Differentiation
Pricers and sensitivities functions are differentiable as far as the AD engine is capable of differentiating the erfc function. Implied volatility computations are fully differentiable by using ChainRulesCore.jl. Explicit support for ForwardDiff, ReverseDiff, TaylorDiff, TaylorSeries is added. In case your package does not support ChainRulesCore.jl APIs, please open an issue if you need the support for implied volatility differentiation. Automatic Differentiation of Implied Volatility: In a Black and Scholes setup, let's define f(S,K,r,T,σ,d) as follows:
For European Callf=Cbs(S,K,r,T,σ,d)
For European Putf=Pbs(S,K,r,T,σ,d)
Let's fix a feasible option price V. Then we can compute the derivative of the implied volatility as follows: Since σ=σ(S,K,r,T,V,d) solves the inversion, then:
f(S,K,r,T,σ(S,K,r,T,V,d),d)=V
By differentating both sides for a generic parameter θ we get:
∂θσ=∂σf(S,K,r,T,σ,d)∂θ(V−f(S,K,r,T,σ,d))
Very similar applies to Black model:
∂θσ=∂σf(F,K,r,T,σ)∂θ(V−f(F,K,r,T,σ))
with:
For European Callf=Cbk(F,K,r,T,σ)
For European Putf=Pbk(F,K,r,T,σ)
This formulation of the derivative allows to define analytically the frule and the rrule for the function blsimpv and blkimpv, without the need of differentiating the numerical solver, proving once again the superiority of automatic differentiation against numerical one.