Project

wi_xirr

0.0
No commit activity in last 3 years
No release in over 3 years
Fast Newtonian method XIRR calculator for Ruby, matches Excel implementation of XIRR formula
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

 Project Readme

WI-XIRR

A fast XIRR calulator for Ruby

Introduction

This gem uses a pure C implementation of the newtonian method for XIRR calculation.

It also uses native extensions instead of ffi so that deployed containers need not have a C compiler to run the calculation

Installation

In your Gemfile, add

gem 'wi_xirr'

And then run

bundle install

Usage

include WiXirr

# Cash Flow
amounts=[[1000, -600, -6000] 
dates=[Time.parse("1985-01-01").to_f, Time.parse("1990-01-01").to_f, Time.parse("1995-01-01").to_f] 
max_iterations=1000
initial_guess=0

result=WiXirr.calculate(amounts,dates,initial_guess,max_iterations)

Supported Versions

Ruby 2.5

References

This gem was derived from the xirr gem, which supports both newtonian and bisection methods and uses ffi for inline compilation, which might be a better fit based on your needs - https://github.com/grafeno-sa/xirr

Contributing

  • Fork it
  • Create your feature branch (git checkout -b my-new-feature)
  • Run specs (rake default)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin my-new-feature)
  • Create a new Pull Request