priceVsYieldPlot: 'priceVsYieldPlot'

View source: R/priceVsYield.R

priceVsYieldPlotR Documentation

priceVsYieldPlot

Description

Function which calculates the yield to maturities (YTMs) for a passed contract type and a vector of prices.

Usage

priceVsYieldPlot(x, prices, isPercentage, from, drawDuration, drawConvexity)

Arguments

x

a contract type, for which to calculate the YTMs.

prices

a numeric vector, indicating the price used for calculating the YTMs.

isPercentage

a logical, indicating if the 'price' is passed as percentage or not. (default is TRUE).

from

a character indicating the date as for which the YTM is calculated.

drawDuration

a logical indicating if the duration should also be plotted.

drawConvexity

a logical indicating if the convexity should also be plotted..

Examples

b <- bond("2013-12-31", maturity = "5 years", nominal = 50000, 
           coupon = 0.02, couponFreq = "1 years")
priceVsYieldPlot(b, prices = c(80, 90, 100))
priceVsYieldPlot(b, prices = c(80, 90, 100), drawDuration=TRUE, drawConvexity=TRUE)


wbreymann/FEMS documentation built on Dec. 8, 2022, 9:43 a.m.