[][src]Function bond::current_yield

pub fn current_yield(
    annual_dollar_coupon_interest: BigDecimal,
    price: BigDecimal
) -> BigDecimal

Returns the current yield of an instrument.

Arguments

  • 'annual_dollar_coupon_interest' - The dollar value of the annual coupon ammount
  • 'price' - The current price of the instrument

Example

extern crate bigdecimal;
use bigdecimal::BigDecimal;
use std::str::FromStr;
use bond::*;
fn main() {
    let annual_dollar_coupon_interest = BigDecimal::from_str("10.00").unwrap();
    let price = BigDecimal::from_str("102.00").unwrap();
    let curr_yield = current_yield(annual_dollar_coupon_interest, price);
}