scripbox / ex-xirr

An Elixir package for calculating XIRR.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ExXirr

codecov Hex.pm Travis

A library to calculate xirr using the Newton Raphson method.

Usage

iex> d = [{1985, 1, 1}, {1990, 1, 1}, {1995, 1, 1}]
iex> v = [1000, -600, -200]
iex> ExXirr.xirr(d,v)
{:ok, -0.034592}

Installation

The package can be installed as:

  1. Add ex_xirr to your list of dependencies in mix.exs:

    def deps do
      [{:ex_xirr, "~> 1.0.0"}]
    end
  2. Ensure ex_xirr is started before your application:

    def application do
      [applications: [:ex_xirr]]
    end

Test

  • Run the test suite using the following
    MIX_ENV=test mix test
    

Benchmarks

  • We use benchee for the benchmark tests. Run it using the following
    mix run test/xirr_comparison_bench.exs
    
  • The reports are available here.

Credits

This application is built on the fantastic finance-elixir package. Many thanks to tubedude for his work.

About

An Elixir package for calculating XIRR.

License:MIT License


Languages

Language:HTML 98.7%Language:Elixir 1.0%Language:JavaScript 0.1%Language:CSS 0.1%