@@ -70,14 +70,14 @@ import Accessors: @optic
70
70
71
71
@testset " Greeks Agreement Test" begin
72
72
strike = 1.0
73
- expiry = Date (2020 , 1 , 2 )
73
+ expiry = Date (2021 , 1 , 1 )
74
74
reference_date = Date (2020 , 1 , 1 )
75
75
rate = 0.03
76
76
spot = 1.0
77
77
sigma = 1.0
78
78
79
79
underlying = Hedgehog2. Forward ()
80
- payoff = VanillaOption (strike, expiry, European (), Put (), underlying)
80
+ payoff = VanillaOption (strike, expiry, European (), Call (), underlying)
81
81
market_inputs = BlackScholesInputs (reference_date, rate, spot, sigma)
82
82
pricing_prob = PricingProblem (payoff, market_inputs)
83
83
bs_method = BlackScholesAnalytic ()
@@ -109,9 +109,11 @@ import Accessors: @optic
109
109
@test isapprox (volga_ad, volga_fd; rtol= 1e-3 )
110
110
@test isapprox (volga_ad, volga_an; rtol= 1e-5 )
111
111
112
- # Theta (no analytic yet )
112
+ # Theta (no analytic)
113
113
thetaprob = GreekProblem (pricing_prob, @optic _. payoff. expiry)
114
114
theta_ad = solve (thetaprob, ForwardAD (), bs_method). greek
115
115
theta_fd = solve (thetaprob, FiniteDifference (1 ), bs_method). greek
116
- @test isapprox (theta_ad, theta_fd; rtol= 1e-5 )
116
+ theta_analytic = solve (thetaprob, AnalyticGreek (), bs_method). greek
117
+ @test isapprox (theta_ad, theta_fd; rtol= 5e-3 )
118
+ @test isapprox (theta_ad, theta_analytic; rtol= 1e-8 )
117
119
end
0 commit comments