Curves.CurveMethod
Curve(x:: AbstractVector{Tenor}, y:: AbstractVector; offset:: Real = 0, kwargs...)

Construct Curve objects from an array of Tenor objects strings as x-axis.

With the offset keyword argument the points on the x-axis, defined by the given tenors, can be shifted. This could be e.g. used to take a spot lag of financial instruments into account. Note that the shift is always in calendar days, a spot lag given in business days must be converted to calendar days beforehand.

Curves.CurveMethod
Curve(x:: AbstractVector, y:: AbstractVector; method=ItpLinear(), extrapolation=EtpFlat(), logx=false, logy=false, sort=true)

Standard curve constructor. Creates the interpolation/extrapolation object of the curve instance. The points x and y do not need to be sorted, this is done in the Curve constructor.

Interpolation/extrapolation details can be changed using the keyword arguments, defaults are:

  • linear interpolation
  • constant extrapolation
  • no logarithmic axes

Note that for method ˋGridded(x)ˋ must be used so that the x-grid can be non-uniform.

Valid choices for ˋmethodˋ are:

  • ˋItpLinear()ˋ, corresponds to Interpolation.jl ˋGridded(Linear())ˋ - default
  • ˋItpConstant()ˋ, corresponds to Interpolation.jl ˋGridded(Constant())ˋ

Valid choices for ˋextrapolationˋ are:

  • ˋEtpFlat()ˋ, corresponds to Interpolation.jl ˋFlat()ˋ - default
  • ˋEtpLine()ˋ, corresponds to Interpolation.jl ˋLine()ˋ

If the curve consists only of a single point, always constant extrapolation is used.

  • sort=true: per default, the input points are sorted and duplicate x-values are removed. sort=true is unsafe and intended to be used for Curves.jl internal operations only, where it can be guaranteed that the points are sorted and not duplicate.
Curves.CurveMethod
Curve(x:: AbstractVector{<: AbstractString}, y; kwargs...)

Construct Curve objects from an array of tenor strings as x-axis.

Curves.CurveMethod
Curve(c1:: Curve; method=getitpm(c1), extrapolation=getetpm(c1), logx=c1.logx, logy=c1.logy, sort=true)

Copy constructor to generate a new curve from an existing one. The interpolation / extrapolation parameters can be changed.

Curves.TenorType

Structure for tenors, consisting of a multiplier and a unit (e.g. days, month, year)

Curves.TenorMethod
Tenor(x:: AbstractString)

Constructor for creating a Tenor object from a string. The input string must start with the multiplier as Integer followed by the unit (as last character).

Example:

julia> Tenor.(("1D", "3W", "1M", "10y"))
(Tenor(TDays, 1), Tenor(TWeeks, 3), Tenor(TMonths, 1), Tenor(TYears, 10))
Base.filterMethod
filter(f:: Function, c1::Curve; axis:: Symbol = :x, kwargs...)

Filters curve points according to the given (boolean return) function.

The output Curve is constructed using default settings, alternative settings can be passed to the Curve constructor using the ˋkwargs...ˋ

Base.firstMethod
first(c1:: Curve, n:: Integer; kwargs...)

Returns a new curve containing the first n points of the previous curve. n must be at least 1.

The output Curve is constructed using default settings, alternative settings can be passed to the Curve constructor using the ˋkwargs...ˋ

Base.lastMethod
last(c1:: Curve, n:: Integer; kwargs...)

Returns a new curve containing the last n points of the previous curve. n must be at least 1.

The output Curve is constructed using default settings, alternative settings can be passed to the Curve constructor using the ˋkwargs...ˋ

Curves.applyMethod
apply(f:: Function, c1:: Curve; axis:: Symbol = :xy, kwargs...)

If ˋaxisˋ is ˋ:xyˋ (default): applies a 2-argument function ˋf(x,y)=zˋ to each entry of the Curve.

If ˋaxisˋ is ˋ:xˋ or ˋ:yˋ: applies a 1-argument function ˋf(x)=zˋ to a single axis of the Curve.

The output Curve is constructed using default settings, alternative settings can be passed to the Curve constructor using the ˋkwargs...ˋ

Curves.concatMethod
concat(c1:: Curve, c2:: Curve; drop_dup=true, kwargs...)

Merges two curves.

Element type is inferred by promotion. Dulicate points are dropped by default, unless ˋdrop_dup=falseˋ is set. The output Curve is constructed using default settings, alternative settings can be passed to the Curve constructor using the ˋkwargs...ˋ

Curves.firstpointMethod
firstpoint(c1:: Curve; dims=1):: Real

Returns the first point of the X-axis (if dims=1) or the Y-axis (if dims=2).

Curves.get_daysMethod
get_days(x:: Tenor):: Int

Gets the number of days corresponding to the Tenor object. The days are calculated in a simplified way, assuming 30 days/ month and 365 days/ year.

Curves.get_tenorMethod
get_tenor(x:: Integer):: Tenor

Converts the given number of days to a Tenor.

The following mapping is used (exactly the reverse of get_days): TDays => 1, TWeeks => 7, TMonths => 30, TYears => 365

Curves.getetpmMethod

helper function to get Interpolations.jl extrapolation method

Curves.getitpmMethod

helper function to get Interpolations.jl interpolation method

Curves.lastpointMethod
lastpoint(c1:: Curve; dims=1):: Real

Returns the last point of the X-axis (if dims=1) or the Y-axis (if dims=2).

Curves.mergexyMethod

Merges two pairs of arrays x, y into a combined (along x-values) array pair.

Curves.uniquexyMethod

Removes duplicates in the array x and the entries in the array y which have the same index as the x-duplicates.

Note that it does not check if the y-values for x-value duplicates are the same!

Interpolations.interpolateMethod
interpolate(xval:: AbstractArray{T} where T, c1:: Curve; kwargs...):: Curve

Interpolates the curve onto the given array and returns a new Curve instance on the interpolated points.

The output Curve is constructed using default settings, alternative settings can be passed to the Curve constructor using the ˋkwargs...ˋ

Interpolations.interpolateMethod
interpolate(c0:: Curve, c1:: Curve; kwargs...):: Curve

Interpolates the Curve ˋc1ˋ on the x-axis points of the Curve ˋc0ˋ and returns a new Curve instance on the interpolated points.

The output Curve is constructed using default settings, alternative settings can be passed to the Curve constructor using the ˋkwargs...ˋ

Interpolations.interpolateMethod
interpolate(xval:: Real, c1:: Curve)

Returns the interpolated or extrapolated y-value of the curve for a given x-value.

Curves.@t_strMacro

String macro for the creation of Tenor objects.

Example:

julia> t"1W"
Tenor(Curves.TWeeks, 1)