Bondie is a simple calculator for the bond properties. It can calculate Yield To Maturity (YTM), interest payments dates or price based on YTM.
Add this line to your application's Gemfile:
gem 'bondie'
And then execute:
$ bundle
Or install it yourself as:
$ gem install bondie
Calculation YTM based on price and date:
issue = Bondie::Issue.new(coupon: 0.0622, maturity_date: Date.parse('2016-08-22'), coupon_frequency: 4)
issue.ytm(Date.parse('2015-09-07'), price: 100.8)
It will not count exact yield, but it will approximate it - you can set maximum approximation error by adding approximation_error
parameter to the method.
You can also check interest payments dates:
issue = Bondie::Issue.new(coupon: 0.0622, maturity_date: Date.parse('2016-08-22'), coupon_frequency: 4)
issue.interest_payments(Date.parse('2015-09-07'))
Currently it will not skip weekends or other days without bond quotations, so it can be inaccurate.
Also it's possible to check price on which it will generate given yield:
issue = Bondie::Issue.new(coupon: 0.0622, maturity_date: Date.parse('2016-08-22'), coupon_frequency: 4)
issue.price(0.05156, Date.parse('2015-09-07'))
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request