Skip to content

Commit 75c9129

Browse files
committed
Now by default df and zero rate accept ticks.
1 parent 7663df9 commit 75c9129

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

src/greeks/greeks_problem.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ function solve(gprob::GreekProblem, ::AnalyticGreek, ::BlackScholesAnalytic)
134134
T = yearfrac(prob.market.referenceDate, prob.payoff.expiry)
135135
K = prob.payoff.strike
136136

137-
D = df_ticks(prob.market.rate, T)
137+
D = df(prob.market.rate, T)
138138
F = prob.market.spot / D
139139
T = sqrt(T)
140140
d1 = (log(F / K) + 0.5 * σ^2 * T) /* T)
@@ -173,7 +173,7 @@ function solve(
173173
T = yearfrac(inputs.referenceDate, prob.payoff.expiry)
174174
K = prob.payoff.strike
175175

176-
D = df_ticks(inputs.rate, T)
176+
D = df(inputs.rate, prob.payoff.expiry)
177177
F = S / D
178178
T = sqrt(T)
179179
d1 = (log(F / K) + 0.5 * σ^2 * T) /* T)

src/market_inputs/market_inputs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ BlackScholesInputs(
4040
rate::Real,
4141
spot,
4242
sigma
43-
) = BlackScholesInputs(reference_date, FlatRateCurve(rate), spot, sigma)
43+
) = BlackScholesInputs(reference_date, FlatRateCurve(rate; reference_date=reference_date), spot, sigma)
4444

4545
# in distribution.jl t is Real, hence we need to redefine it.
4646
"""

src/market_inputs/rate_curve.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,19 @@ end
4141

4242
# -- Accessors --
4343
# Accepts ticks (ms since epoch)
44-
df_ticks(curve::RateCurve, ticks::Real) =
45-
exp(-zero_rate_ticks(curve, ticks) * yearfrac(curve.reference_date, ticks))
44+
df(curve::RateCurve, ticks::Real) =
45+
exp(-zero_rate(curve, ticks) * yearfrac(curve.reference_date, ticks))
4646

4747
# Accepts Date, routes to tick-based version
4848
df(curve::RateCurve, t::Date) =
49-
df_ticks(curve, to_ticks(t))
49+
df(curve, to_ticks(t))
5050

5151
# Accepts ticks (ms since epoch)
52-
zero_rate_ticks(curve::RateCurve, ticks::Real) =
52+
zero_rate(curve::RateCurve, ticks::Real) =
5353
curve.interpolator(yearfrac(curve.reference_date, ticks))
5454

5555
# Accepts daycounts (already in year fractions)
56-
zero_rate(curve::RateCurve, t::Date) = zero_rate_ticks(curve, to_ticks(t))
56+
zero_rate(curve::RateCurve, t::Date) = zero_rate(curve, to_ticks(t))
5757

5858
# -- Forward rate between two times --
5959
function forward_rate(curve::RateCurve, t1::Real, t2::Real)

src/pricing_methods/black_scholes.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function solve(
3838
σ = prob.market.sigma
3939
cp = prob.payoff.call_put()
4040
T = yearfrac(prob.market.referenceDate, prob.payoff.expiry)
41-
D = df_ticks(prob.market.rate, T)
41+
D = df(prob.market.rate, prob.payoff.expiry)
4242
F = prob.market.spot / D
4343
price = if σ == 0
4444
D * prob.payoff(F)

0 commit comments

Comments
 (0)