A basis point (bp) is 0.01%, or 0.0001. bps() creates a Bps object from a number of basis points, and as.bps() converts a rate difference, given as a decimal, to basis points. Bps extends numeric and keeps the value as a decimal, so as.numeric(bps(10)) is 0.001.

bps(x)

as.bps(x)

Arguments

x

a numeric with the number of basis points (bps()), or a rate difference as a decimal, like a SpotRate spread (as.bps()).

Value

a Bps object.

Details

Adding or subtracting basis points to a SpotRate (or a SpotRateCurve) returns the same object with the rates shifted; compounding, daycount, calendar, terms and interpolation are kept. Two Bps objects can be added or subtracted, and divided (returning a numeric). c() combines Bps objects.

Examples

bps(10)
#> [1] "10 bps"
as.numeric(bps(10))
#> [1] 0.001

sr <- spotrate(0.1375, "discrete", "business/252", "Brazil/ANBIMA")
sr + bps(10)
#> [1] "0.1385 discrete business/252 Brazil/ANBIMA"
sr - bps(c(10, 25))
#> [1] "0.1365 discrete business/252 Brazil/ANBIMA"
#> [2] "0.1350 discrete business/252 Brazil/ANBIMA"

sr2 <- spotrate(0.1325, "discrete", "business/252", "Brazil/ANBIMA")
as.bps(sr - sr2)
#> [1] "50 bps"