All Projects → Nyholm → effective-interest-rate

Nyholm / effective-interest-rate

Licence: MIT license
Calculate effective interest, XIRR or effective APR.

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to effective-interest-rate

Math Php
Powerful modern math library for PHP: Features descriptive statistics and regressions; Continuous and discrete probability distributions; Linear algebra with matrices and vectors, Numerical analysis; special mathematical functions; Algebra
Stars: ✭ 2,009 (+9945%)
Mutual labels:  finance, mathematics
okama
Investment portfolio and stocks analyzing tools for Python with free historical data
Stars: ✭ 87 (+335%)
Mutual labels:  finance, mathematics
Math Finance Cheat Sheet
Mathematical finance cheat sheet.
Stars: ✭ 186 (+830%)
Mutual labels:  finance, mathematics
Awesome Streamlit
The purpose of this project is to share knowledge on how awesome Streamlit is and can be
Stars: ✭ 769 (+3745%)
Mutual labels:  finance, mathematics
quantlib
The idiomatic rust implementation of the QuantLib C++ quantitative finance library
Stars: ✭ 89 (+345%)
Mutual labels:  finance, mathematics
TraderBot
No description or website provided.
Stars: ✭ 39 (+95%)
Mutual labels:  finance
Finance-Robinhood
Trade stocks and ETFs with free brokerage Robinhood and Perl
Stars: ✭ 42 (+110%)
Mutual labels:  finance
akshare
AKShare is an elegant and simple financial data interface library for Python, built for human beings! 开源财经数据接口库
Stars: ✭ 5,155 (+25675%)
Mutual labels:  finance
curve-shortening-demo
Visualize curve shortening flow in your browser.
Stars: ✭ 19 (-5%)
Mutual labels:  mathematics
Mathematics
Various math formulas coded in Java to help students all across the world!
Stars: ✭ 35 (+75%)
Mutual labels:  mathematics
manifolds
Coordinate-free hypersurfaces as Haskell types
Stars: ✭ 37 (+85%)
Mutual labels:  mathematics
tellerbot
Telegram Bot for over-the-counter trading
Stars: ✭ 17 (-15%)
Mutual labels:  finance
pwsh-prelude
PowerShell “standard” library for supercharging your productivity. Provides a powerful cross-platform scripting environment enabling efficient analysis and sustainable science in myriad contexts.
Stars: ✭ 26 (+30%)
Mutual labels:  mathematics
Chinese financial sentiment dictionary
A Chinese financial sentiment word dictionary
Stars: ✭ 67 (+235%)
Mutual labels:  finance
Project-Euler
Send PRs to contribute and see the Codemasters solving some really mind boggling questions.
Stars: ✭ 21 (+5%)
Mutual labels:  mathematics
rclc
Mathematical expression calculator with big integers, floats, common fractions, and complex numbers support
Stars: ✭ 24 (+20%)
Mutual labels:  mathematics
euclid.js
2D Euclidean geometry classes, utilities, and drawing tools
Stars: ✭ 69 (+245%)
Mutual labels:  mathematics
FinMesh
A python package that brings together financial and economic data.
Stars: ✭ 20 (+0%)
Mutual labels:  finance
IEXSharp
IEX Cloud API for C# and other .net languages. Supports SSE streaming
Stars: ✭ 87 (+335%)
Mutual labels:  finance
ir
Projeto de calculo de Imposto de Renda em operacoes na bovespa automaticamente. Tags:canal eletronico do investidor, CEI, selenium, bovespa, IRPF, IR, imposto de renda, finance, yahoo finance, acao, fii, etf, python, crawler, webscraping, calculadora ir
Stars: ✭ 120 (+500%)
Mutual labels:  finance

Effective interest rate

Latest Version Software License Build Status Code Coverage Quality Score Total Downloads

This is a library that calculates the effective interest rate. The effective interest could also be called XIRR or effective APR. This is the PHP library. You will find a JavaScript version of this library here.

Examples

Equal payments

If you are do a car loan of 100 000 Money. The loan is for 48 months and you pay 2 400 Money every month. What is the effective interest?

We guess that it is somewhere around 3%.

use Nyholm\EffectiveInterest\Calculator;

$principal = 100000;
$payment = 2400;
$numberOfMonths = 48;
$guess = 0.03;
$calculator = new Calculator();

$interest = $calculator->withEqualPayments($principal, $payment, $numberOfMonths, $guess);

echo $interest; // 0.07115

Correct answer is 7.12%

Specified payments

What if the payments are not equal? The first payment has an administration fee of 400 Money and we like to pay the rest of the loan after 36 months. So the 36th payment will be 31 200 Money.

use Nyholm\EffectiveInterest\Calculator;

$principal = 100000;
$payment = 2400;
$guess = 0.03;
$startDate = '2017-04-30';
$calculator = new Calculator();

$payments = [
    '2017-04-30' => $payment + 400,
    '2017-05-31' => $payment,
    '2017-06-30' => $payment,
    '2017-07-31' => $payment,
    // More dates
    '2019-12-31' => $payment,
    '2020-01-31' => $payment,
    '2020-02-28' => $payment,
    '2020-03-31' => 31200,
];

$interest = $calculator->withSpecifiedPayments($principal, $startDate, $payments, $guess);

echo $interest; // 0.084870

Correct answer is 8.49%

The mathematics

We are using the same formula that Excel's XIRR function is using. We are also using NewtonRaphsons method to numerically find the interest we are looking for.

Effective interest formula

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].