bonds_rs 0.1.1

This crate contains the most common operations in bond valuations
Documentation
  • Coverage
  • 7.69%
    1 out of 13 items documented1 out of 9 items with examples
  • Size
  • Source code size: 9.98 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.58 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • ShubhamBhut/bonds_rs
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • ShubhamBhut

bonds_rs

Crates.io Docs.rs

The bonds_rs crate provides a set of structures and methods for evaluating and dealing various financial instruments, with a focus on corporate bonds.

Usage

Add this crate to your Cargo.toml file:

[dependencies]
bonds_rs = "0.1.0"

Then, in your Rust code:

use bonds_rs::{CorporateBond, CompoundingFreq, Bond};

fn main() {
    let bond = CorporateBond::new(
        5.0, //coupon rate
        3.0, //dicount rate
        2, // maturity in years
        1000.0, // face value
        CompoundingFreq::Semiannual,
        Some(1000.0), //buying price
        Some(942.1843778588191), //current selling price
    );

    println!("Coupon Payment: {}", bond.coupon_payment());
    println!("Present Value: {}", bond.present_value());
    println!("Yield to Maturity: {}", bond.yeild_to_maturity());
    println!("Holding Period Return: {}", bond.holding_period_return());
}

For more detailed usage instructions and examples, check out the documentation.

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvement, please open an issue or a pull request.

License

This crate is licensed under the MIT License.