Skip to content

Commit

Permalink
Merge pull request #24 from imanuelcostigan/feature-vol-surface
Browse files Browse the repository at this point in the history
Implement volatility surface functionality
  • Loading branch information
imanuelcostigan authored Sep 7, 2019
2 parents d28a2b9 + c41b983 commit 594331e
Show file tree
Hide file tree
Showing 92 changed files with 6,930 additions and 2,132 deletions.
47 changes: 27 additions & 20 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,37 @@ Type: Package
Package: fmbasics
Title: Financial Market Building Blocks
Version: 0.3.99
Authors@R: person("Imanuel", "Costigan", email = "i.costigan@me.com",
role = c("aut", "cre"))
Description: Implements basic financial market objects like currencies, currency
pairs, interest rates and interest rate indices. You will be able to use
Benchmark instances of these objects which have been defined using their most
common conventions or those defined by International Swap Dealer Association
(ISDA, <https://www.isda.org>) legal documentation.
Authors@R: c(person(given = "Imanuel", family = "Costigan", role = c("aut", "cre"),
email = "i.costigan@me.com"),
person(given = "Sayf", family = "Hamada", role = "ctb",
email = "sayfeddine.hamada@westpac.com.au"))
Description: Implements basic financial market objects like
currencies, currency pairs, interest rates and interest rate indices.
You will be able to use Benchmark instances of these objects which
have been defined using their most common conventions or those defined
by International Swap Dealer Association (ISDA,
<https://www.isda.org>) legal documentation.
License: GPL-2
URL: https://github.com/imanuelcostigan/fmbasics, https://imanuelcostigan.github.io/fmbasics/
URL: https://github.com/imanuelcostigan/fmbasics,
https://imanuelcostigan.github.io/fmbasics/
BugReports: https://github.com/imanuelcostigan/fmbasics/issues
Imports:
assertthat,
fmdates (>= 0.1.2),
lubridate (>= 1.6.0),
methods,
stats,
tibble,
utils
assertthat,
fmdates (>= 0.1.2),
lubridate (>= 1.6.0),
methods,
readr,
stats,
tibble,
utils,
tidyr
Suggests:
covr,
knitr,
rmarkdown,
testthat
VignetteBuilder: knitr
covr,
knitr,
rmarkdown,
testthat
VignetteBuilder:
knitr
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
Expand Down
11 changes: 11 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ S3method(format,IborIndex)
S3method(format,InterestRate)
S3method(format,Interpolation)
S3method(format,SingleCurrencyMoney)
S3method(format,VolSurface)
S3method(format,ZeroCurve)
S3method(interpolate,VolSurface)
S3method(interpolate,ZeroCurve)
S3method(interpolate_dfs,ZeroCurve)
S3method(interpolate_fwds,ZeroCurve)
Expand All @@ -57,6 +59,7 @@ S3method(print,Index)
S3method(print,InterestRate)
S3method(print,Interpolation)
S3method(print,SingleCurrencyMoney)
S3method(print,VolSurface)
S3method(print,ZeroCurve)
S3method(rep,DiscountFactor)
S3method(rep,InterestRate)
Expand Down Expand Up @@ -104,6 +107,7 @@ export(InterestRate)
export(JPY)
export(JPYLIBOR)
export(JPYTIBOR)
export(LinearCubicTimeVarInterpolation)
export(LinearInterpolation)
export(LogDFInterpolation)
export(MultiCurrencyMoney)
Expand All @@ -122,9 +126,13 @@ export(USDHKD)
export(USDJPY)
export(USDLIBOR)
export(USDNOK)
export(VolQuotes)
export(VolSurface)
export(ZeroCurve)
export(as_DiscountFactor)
export(as_InterestRate)
export(build_vol_quotes)
export(build_vol_surface)
export(build_zero_curve)
export(interpolate)
export(interpolate_dfs)
Expand All @@ -142,10 +150,13 @@ export(is.IborIndex)
export(is.Index)
export(is.InterestRate)
export(is.Interpolation)
export(is.LinearCubicTimeVarInterpolation)
export(is.LinearInterpolation)
export(is.LogDFInterpolation)
export(is.MultiCurrencyMoney)
export(is.SingleCurrencyMoney)
export(is.VolQuotes)
export(is.VolSurface)
export(is.ZeroCurve)
export(is_t1)
export(iso)
Expand Down
5 changes: 5 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Version 0.3.99

NEW:

- `VolQuotes()` and `VolSurface()` allow you to create volatility surfaces. The latter can be interpolated by a two-dimensional interpolator via `LinearCubicTimeVarInterpolation()` which uses linear interpolation in the maturity dimension (x), cubic splines in the smile dimension (y) for implied volatility squared (variance, z).
- Implemented a `VolSurface` method for `interpolate()`.

IMPROVED:

- Rebuilt documentation using newer version of `roxygen2`
Expand Down
20 changes: 13 additions & 7 deletions R/generic-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,26 @@ to_maturity <- function(dates, index) UseMethod("to_maturity", index)
#' @rdname indexshifters
#' @export
to_reset.default <- function(dates, index) {
fmdates::shift(dates, -index$spot_lag,
index$day_convention, index$calendar, index$is_eom)
fmdates::shift(
dates, -index$spot_lag,
index$day_convention, index$calendar, index$is_eom
)
}
#' @rdname indexshifters
#' @export
to_value.default <- function(dates, index) {
fmdates::shift(dates, index$spot_lag,
index$day_convention, index$calendar, index$is_eom)
fmdates::shift(
dates, index$spot_lag,
index$day_convention, index$calendar, index$is_eom
)
}
#' @rdname indexshifters
#' @export
to_maturity.default <- function(dates, index) {
fmdates::shift(dates, index$tenor,
index$day_convention, c(index$pfc_calendar, index$calendar), index$is_eom)
fmdates::shift(
dates, index$tenor,
index$day_convention, c(index$pfc_calendar, index$calendar), index$is_eom
)
}


Expand Down Expand Up @@ -125,4 +131,4 @@ interpolate_dfs <- function(x, from, to, ...) UseMethod("interpolate_dfs")

#' @export
#' @rdname interpolate_dfs
interpolate_fwds <- function(x, from, to, ...) UseMethod("interpolate_fwds")
interpolate_fwds <- function(x, from, to, ...) UseMethod("interpolate_fwds")
Loading

0 comments on commit 594331e

Please sign in to comment.