The RQuantLib package wraps the QuantLib library, and the QuantLib library includes a function, Bond(), which will calculate both the clean and dirty price of a bond. Install the library and the package, then check out the example:

> example(Bond)

I can definitely recommend RQuantLib. It's very well done. I use it for a number of purposes.
 
Paul Teetor, Elgin, IL  USA
http://quanttrader.info/public


________________________________

To: r-sig-finance@r-project.org 
Sent: Tuesday, April 30, 2013 11:50 AM
Subject: [R-SIG-Finance] CLEAN price of Bond in r


Dear Forum

I have following details of bond_instrument

bond_data = data.frame(bond.name = c("ABC"), settlement.date = c("04/26/2013"), maturity.date = c("02/01/2014"), coupon.rate = 0.05, ytm = 0.08, redemption.value = 1.0, frequency = 2, actual = 364)


> bond_data
  bond.name settlemen.date maturity.date   coupon.rate  ytm1       ABC      04/26/2013        02/01/2014        0.05        0.08
  redemption.value frequency actual
1      100                     2        364

I need to calculate clean_price of this bond. In excel it can be calculated as 

Clean price = PRICE(settlement, maturity, rate, yld, redemption, frequency, [basis] ) 

How this can be done in R?

Regards

Katherine Gobin
    [[alternative HTML version deleted]]

_______________________________________________
R-SIG-Finance@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
	[[alternative HTML version deleted]]

