yield: 'yield'

View source: R/yieldToMaturity.R

yieldR Documentation

yield

Description

Function which calculates the yield to maturity (YTM) for passed contract types.

Usage

yield(x, price, isPercentage, from)

Arguments

x

a contract type, for which to calculate the YTM.

price

a numeric, indicating the price used for calculating the YTM.

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.

Value

a numeric, representing the yield to maturity (YTM) of the contract.

Examples

b <- bond("2013-12-31", maturity = "5 years", nominal = 50000, 
           coupon = 0.02, couponFreq = "1 years")
ytm <- yield(b, price = 100) 


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