Skip to content

Commit

Permalink
fix documentation error
Browse files Browse the repository at this point in the history
  • Loading branch information
farzadwp committed Nov 28, 2019
1 parent 46718d0 commit 39743c3
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ S3method(as.double,InterestRate)
S3method(as_DiscountFactor,InterestRate)
S3method(as_InterestRate,DiscountFactor)
S3method(as_InterestRate,InterestRate)
S3method(as_SurvivalProbabilities,CDSCurve)
S3method(as_SurvivalProbabilities,ZeroHazardRate)
S3method(as_ZeroHazardRate,SurvivalProbabilities)
S3method(as_ZeroHazardRate,ZeroHazardRate)
Expand Down
17 changes: 13 additions & 4 deletions R/credit-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#'
#' @param x object to coerce
#' @param ... other parameters passed to methods
#' @return an `SurvivalProbabilities` object
#' @export
as_SurvivalProbabilities <- function(x, ...) UseMethod("as_SurvivalProbabilities")

Expand All @@ -19,13 +18,23 @@ as_SurvivalProbabilities <- function(x, ...) UseMethod("as_SurvivalProbabilities
#' usually gives a good approximation (Ref. Valuation of Credit Default Swaps, Dominic O Kane and
#' Stuart Turnbull)
#' @param accrued_premium If set to TRUE, the accrued premium will be taken into account in the calculation of the premium leg value.
#'
#' @param ... other parameters passed to methods
#' @return An object of type `SurvivalProbabilitiesCurve`

#' @return an `SurvivalProbabilities` object
#' @example
#' zero_curve <- build_zero_curve()
# curve_specs <- CDSMarkitSpec(rating = "AAA", region = "Japan", sector = "Utilities")
# cds_curve1 <- CDSCurve(
# reference_date = zero_curve$reference_date,
# tenors = c(1, 3, 5, 7), spreads = c(0.0050, 0.0070, 0.0090, 0.0110), lgd = .6,
# premium_frequency = 4, specs = curve_specs)
# as_SurvivalProbabilities(x = cds_curve1, zero_curve = zero_curve)
#' @export
#'
as_SurvivalProbabilities.CDSCurve <- function(x,
zero_curve,
num_timesteps_pa = 12,
accrued_premium = TRUE) {
accrued_premium = TRUE, ...) {
if (x$reference_date != zero_curve$reference_date) {
stop("The reference dates for CDS Curve and the Zero Curve are different",
call. = FALSE)
Expand Down
6 changes: 5 additions & 1 deletion man/as_SurvivalProbabilities.CDSCurve.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions man/as_SurvivalProbabilities.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 39743c3

Please sign in to comment.