{"repo":"tubedude/xirr","free":true,"listed":false,"github":"https://github.com/tubedude/xirr","clone":"git clone https://github.com/tubedude/xirr.git","description":"XIRR and a finance toolkit for Ruby: internal rate of return for cash flows on arbitrary dates, plus time-value-of-money, bonds, depreciation, rate conversions, and performance metrics. Built on a safeguarded-Newton solver with an optional native extension.","language":"Ruby","stars":23,"topics":["bonds","cashflow","depreciation","finance","financial-calculations","internal-rate-of-return","irr","npv","ruby","ruby-gem"],"license":"MIT","category":"analytics","readme_excerpt":"Xirr Calculates the XIRR of a cashflow — the internal rate of return for transactions that land on arbitrary dates, the way a spreadsheet's XIRR does. The default solver is a safeguarded Newton method ( rtsafe ): it brackets the root first, then takes a Newton step when that step stays inside the bracket and a bisection step otherwise. That converges on flows the plain Newton or bisection methods struggle with — long maturities, low rates, and returns near -100% — and reports non-convergence instead of returning a wrong number. The :bisection and :newton method solvers remain available, and there is an optional native (C) build of rtsafe . See Choosing a solver. Installation Add this line to your application's Gemfile: gem 'xirr' And then execute: $ bundle install Or install it yourself as: $ gem install xirr Usage xirr returns config.replace for nil (0.0 by default) when it can't find a rate. Use xirr! when you would rather have an exception: Related figures Periodic (dateless) flows When the flows fall at equally spaced periods and the exact dates don't matter, work with a plain list of amounts. The rate is per period. More finance functions Beyond cash-flow analysis, the gem carries the usual finance toolkit, grouped into modules. Every function returns a plain number and raises ArgumentError on inputs that have no answer. Choosing a solver Four solvers are available; pick one per call with method: , or set a default globally with config.default method . They all return th","default_branch":null,"files":null,"tree":[],"storefront":"/r/tubedude","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/tubedude/xirr/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}