1
- """ A method for delta calculation"""
1
+ """ A method for delta calculation. """
2
2
abstract type AbstractDeltaMethod end
3
3
4
- """ A method for delta calculation analytically using black scholes """
4
+ """ A method for delta calculation analytically using the Black-Scholes model. """
5
5
struct BlackScholesAnalyticalDelta <: AbstractDeltaMethod end
6
6
7
- """ Delta calculator"""
7
+ """ A delta calculator that computes the sensitivity of an option's price to changes in the underlying asset's price.
8
+
9
+ # Type Parameters
10
+ - `D <: AbstractDeltaMethod`: The method used for delta calculation.
11
+ - `P <: AbstractPayoff`: The type of payoff being priced.
12
+ - `I <: AbstractMarketInputs`: The type of market data inputs required for pricing.
13
+ - `S <: AbstractPricingMethod`: The pricing method used.
14
+
15
+ # Fields
16
+ - `pricer::Pricer{P, I, S}`: The pricer used to compute the option price.
17
+ - `deltaMethod::D`: The delta calculation method.
18
+
19
+ A `DeltaCalculator` is a callable struct that computes delta using the specified method.
20
+ """
8
21
struct DeltaCalculator{D<: AbstractDeltaMethod , P<: AbstractPayoff , I<: AbstractMarketInputs , S<: AbstractPricingMethod }
9
22
pricer:: Pricer{P, I, S}
10
23
deltaMethod:: D
11
24
end
12
25
13
- """ Callable struct: Computes delta when called, using black scholes on a call."""
26
+ """ Computes delta analytically for a vanilla European call option using the Black-Scholes model.
27
+
28
+ # Arguments
29
+ - `delta_calc::DeltaCalculator{BlackScholesAnalyticalDelta, VanillaEuropeanCall, BlackScholesInputs, BlackScholesMethod}`:
30
+ A `DeltaCalculator` configured for Black-Scholes analytical delta calculation.
31
+
32
+ # Returns
33
+ - The computed delta value.
34
+
35
+ The Black-Scholes delta formula for a call option is:
36
+ ```
37
+ d1 = (log(S / K) + (r + 0.5 * σ^2) * T) / (σ * sqrt(T))
38
+ delta = Φ(d1)
39
+ ```
40
+ where `Φ` is the CDF of the standard normal distribution.
41
+ """
14
42
function (delta_calc:: DeltaCalculator{BlackScholesAnalyticalDelta, VanillaEuropeanCall, BlackScholesInputs, BlackScholesMethod} )()
15
43
S = delta_calc. pricer. marketInputs. spot
16
44
K = delta_calc. pricer. payoff. strike
@@ -21,10 +49,20 @@ function (delta_calc::DeltaCalculator{BlackScholesAnalyticalDelta, VanillaEurope
21
49
return cdf (Normal (), d1) # Black-Scholes delta for calls
22
50
end
23
51
24
- """ Delta with AD """
52
+ """ A method for computing delta using automatic differentiation (AD). """
25
53
struct ADDelta <: AbstractDeltaMethod end
26
54
27
- """ Delta with AD callable"""
55
+ """ Computes delta using automatic differentiation (AD).
56
+
57
+ # Arguments
58
+ - `delta_calc::DeltaCalculator{ADDelta, P, BlackScholesInputs, S}`:
59
+ A `DeltaCalculator` configured for AD-based delta calculation.
60
+
61
+ # Returns
62
+ - The computed delta value using AD.
63
+
64
+ This method uses `ForwardDiff.derivative` to compute the delta by differentiating the option price with respect to the spot price.
65
+ """
28
66
function (delta_calc:: DeltaCalculator{ADDelta, P, BlackScholesInputs, S} )() where {P,S}
29
67
pricer = delta_calc. pricer
30
68
return ForwardDiff. derivative (
0 commit comments