You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
coupon_pv =sum(discount(curve, t) for t in coup_times)
@@ -148,7 +148,7 @@ end
148
148
149
149
Return the zero rate for the curve at the given time.
150
150
"""
151
-
function Base.zero(c::YC, time) where {YC<:AbstractYieldModel}
151
+
function Base.zero(c::YC, time) where {YC<:AbstractYieldModel}
152
152
df =discount(c, time)
153
153
r =-log(df) / time
154
154
returnContinuous(r)
@@ -177,7 +177,7 @@ Can only be created via the public API by using the `+`, `-`, `*`, and `/` opera
177
177
As this is double the normal operations when performing calculations, if you are using the curve in performance critical locations, you should consider transforming the inputs and
178
178
constructing a single curve object ahead of time.
179
179
"""
180
-
struct CompositeYield{T,U,V} <:AbstractYieldModel
180
+
struct CompositeYield{T, U, V} <:AbstractYieldModel
181
181
r1::T
182
182
r2::U
183
183
op::V
@@ -217,13 +217,13 @@ While `ForwardStarting` could be nested so that, e.g. the third period's curve i
217
217
218
218
`ForwardStarting` is not used to construct a curve based on forward rates.
219
219
"""
220
-
struct ForwardStarting{T,U} <:AbstractYieldModel
220
+
struct ForwardStarting{T,U} <:AbstractYieldModel
221
221
curve::U
222
222
forwardstart::T
223
223
end
224
224
225
225
function FinanceCore.discount(c::ForwardStarting, to)
226
-
FinanceCore.discount(c.curve, c.forwardstart, to + c.forwardstart)
226
+
returnFinanceCore.discount(c.curve, c.forwardstart, to + c.forwardstart)
227
227
end
228
228
229
229
"""
@@ -239,11 +239,11 @@ function Base.:+(a::Constant, b::Constant)
239
239
returnConstant(a.rate + b.rate)
240
240
end
241
241
242
-
function Base.:+(a::T, b) where {T<:AbstractYieldModel}
242
+
function Base.:+(a::T, b) where {T<:AbstractYieldModel}
243
243
return a +Constant(b)
244
244
end
245
245
246
-
function Base.:+(a, b::T) where {T<:AbstractYieldModel}
246
+
function Base.:+(a, b::T) where {T<:AbstractYieldModel}
247
247
returnConstant(a) + b
248
248
end
249
249
@@ -279,11 +279,11 @@ function Base.:*(a::Constant, b::Constant)
279
279
)
280
280
end
281
281
282
-
function Base.:*(a::T, b) where {T<:AbstractYieldModel}
282
+
function Base.:*(a::T, b) where {T<:AbstractYieldModel}
283
283
return a *Constant(b)
284
284
end
285
285
286
-
function Base.:*(a, b::T) where {T<:AbstractYieldModel}
286
+
function Base.:*(a, b::T) where {T<:AbstractYieldModel}
287
287
returnConstant(a) * b
288
288
end
289
289
@@ -297,14 +297,14 @@ function Base.:-(a::AbstractYieldModel, b::AbstractYieldModel)
297
297
end
298
298
299
299
function Base.:-(a::Constant, b::Constant)
300
-
Constant(a.rate - b.rate)
300
+
returnConstant(a.rate - b.rate)
301
301
end
302
302
303
-
function Base.:-(a::T, b) where {T<:AbstractYieldModel}
303
+
function Base.:-(a::T, b) where {T<:AbstractYieldModel}
304
304
return a -Constant(b)
305
305
end
306
306
307
-
function Base.:-(a, b::T) where {T<:AbstractYieldModel}
307
+
function Base.:-(a, b::T) where {T<:AbstractYieldModel}
308
308
returnConstant(a) - b
309
309
end
310
310
@@ -340,11 +340,11 @@ function Base.:/(a::Constant, b::Constant)
340
340
)
341
341
end
342
342
343
-
function Base.:/(a::T, b) where {T<:AbstractYieldModel}
343
+
function Base.:/(a::T, b) where {T<:AbstractYieldModel}
344
344
return a /Constant(b)
345
345
end
346
346
347
-
function Base.:/(a, b::T) where {T<:AbstractYieldModel}
347
+
function Base.:/(a, b::T) where {T<:AbstractYieldModel}
0 commit comments