4 releases

0.2.2 May 4, 2023
0.2.1 Apr 15, 2023
0.2.0 Apr 14, 2023
0.1.0 Apr 11, 2023

#132 in Finance

Download history 1/week @ 2024-02-22 8/week @ 2024-02-29 42/week @ 2024-03-07 15/week @ 2024-03-14

66 downloads per month

MIT license

11KB
131 lines

Rustnance

Downloads Version License

Synopsis

A crate that provides functionality within the space of financial analysis

Explanation

This crate is meant to provide calculations as well as metrics and should not be seen as any financial or investing advice. The intent is to firstly develop calculation for fundamental analysis but technical analysis related functionality may be added. Some of the existing functions you will find consist of:

  • Calculate intrinsic value
  • Calculate compound interest

Usage

Inside your Cargo.toml

[dependencies]
rustnance = "0.2.1" # Latest version

Example usage

use rustnance::value; // Bring module into scope
fn main() {
    let free_cash_flow: Vec<f32> = vec![1000.0, 2000.0, 3000.0, 4000.0, 5000.0]; // Historical free cash flow
    let expected_return: f32 = 0.15; // The return you expect to achieve from an investment
    let outstanding_shares: f32 = 1_000.0; // Amount of shares that excist for the specific company
    let margin_of_safety: f32 = 0.3; // A margin of safety to take into account for the uncertainty of any calculation
    
    let intrinsic_value: f32 = value::calculate_intrinsic_value(&free_cash_flow, &expected_return);
    let intrinsic_value_per_share: f32 = value::intrinsic_value_per_stock(&intrinsic_value, &outstanding_shares);
    let share_buy_price: f32 = value::margin_of_safety(&intrinsic_value_per_share, &margin_of_safety);
    println!("A reasonable price would be: {}", share_buy_price);
}

Module structure

Output of cargo modules generate tree

Find a bug?

If you found a bug, an issue, an improvement or a potential addition to this project, please submit an issue(if it hasn't already been raised) using the issue tab towards the top. I intend to fix issues as they arise as well as add requested functionality.

No runtime deps