Comments (2)
Here is another example:
dates= [date(2017,11,30),date(2018,1,31),date(2018,2,28),date(2018,3,31),date(2018,4,30),date(2018,5,31),date(2018,7,28),date(2018,7,31),date(2018,8,30),date(2018,8,30),date(2018,8,31),date(2018,8,31),date(2018,10,30),date(2018,10,30),date(2018,11,30),date(2018,12,31),date(2018,12,31),date(2018,12,31),date(2019,2,28),date(2019,3,31),date(2019,5,31),date(2020,1,28),date(2021,3,31),date(2021,10,30),date(2021,10,30),date(2022,2,28),date(2022,2,28),date(2022,4,30),date(2022,6,30),date(2022,10,28),date(2022,11,28),date(2022,11,28),date(2022,11,30)]
cashflow=[-1000,-1050,-1000,-650,-500,-1085,1472.5,1180,1600,7.5,1547.5,132.5,874,100.2,-1500,-1200,-500,1735,-1000,2080,-500,1900,1491.25,3300,1030,-1000,-500,1667.5,-21457.5,1808.71,1043.23,0.01,9153.25]
xirr(dates, cashflow)
xirr with a guess of 0.1 is 0.1798; in excel with the same guess is -0.6488
from pyxirr.
Hi @isagarzazu, sorry for the late response.
I've checked the data, pyxirr
returns the correct result. This can be proven using the xnpv
function. By the definition, xirr
is equals to the rate at which xnpv
= 0. If you use the result from Excel, xnpv
will not be equal to 0.
# must be close to zero
xnpv(xirr(dates, cashflow), dates, cashflow)
Excel sometimes gives the wrong result.
Basically xirr
is a solution to the minimization problem. I think Excel returns "garbage" if the algorithm does not converge. At the same time, pyxirr
has additional checks and returns None
if xnpv != 0
.
I also checked the calculation in libreoffice and it matched the result of pyxirr
.
from pyxirr.
Related Issues (20)
- `ipmt()` and `ppmt()` do not accept an array as `per` HOT 4
- surpress error messages when running in groupby or in loop HOT 1
- Following input leads to None output HOT 2
- Negative IRR HOT 4
- Payment scenarios where IRR returns None HOT 2
- Can't install from wheels for 3.10 on arm linux (inside M1 host docker) HOT 4
- Publish new version with updated metadata HOT 2
- Add support for different day count conventions HOT 5
- New release? HOT 2
- Missing InvalidPaymentsError exception declaration in .pyi causes mypy missing import error HOT 1
- No module name error on glue aws HOT 2
- XIRR for a pd.Series HOT 1
- Using silent in xnfv HOT 1
- How to use with Dataframe & datetime64[ns]
- Interest in adding private equity metrics? HOT 4
- Dependency Issue
- Conflicting sub-dependencies with other libraries HOT 8
- IRR function args for tolerance and max iterations HOT 3
- Wrong irr values HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyxirr.