Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8239047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T20:00:50+00:00 2026-06-07T20:00:50+00:00

numpy has irr and npv function, but I need xirr and xnpv function. this

  • 0

numpy has irr and npv function, but I need xirr and xnpv function.

this link points out that xirr and xnpv will be coming soon.
http://www.projectdirigible.com/documentation/spreadsheet-functions.html#coming-soon

Is there any python library that has those two functions? tks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T20:00:53+00:00Added an answer on June 7, 2026 at 8:00 pm

    With the help of various implementations I found in the net, I came up with a python implementation:

    def xirr(transactions):
        years = [(ta[0] - transactions[0][0]).days / 365.0 for ta in transactions]
        residual = 1
        step = 0.05
        guess = 0.05
        epsilon = 0.0001
        limit = 10000
        while abs(residual) > epsilon and limit > 0:
            limit -= 1
            residual = 0.0
            for i, ta in enumerate(transactions):
                residual += ta[1] / pow(guess, years[i])
            if abs(residual) > epsilon:
                if residual > 0:
                    guess += step
                else:
                    guess -= step
                    step /= 2.0
        return guess-1
    
    from datetime import date
    tas = [ (date(2010, 12, 29), -10000),
        (date(2012, 1, 25), 20),
        (date(2012, 3, 8), 10100)]
    print xirr(tas) #0.0100612640381
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Numpy has a basic pxd that declares its c interface to cython. Is there
I have a numpy array like this: x = np.array([[1,2,3],[4,5,6],[7,8,9]]) I need to create
numpy has a function to set the specified elements to be some value a=numpy.zeros(10)
Has anyone tried compiling SciPy 0.7.1 on Windows using numpy-1.3.0 that was built with
I would like to create a two dimensional numpy array of arrays that has
I have a csv file that looks something like this (actual file has many
NumPy has the efficient function/method nonzero() to identify the indices of non-zero elements in
I realize that there is a griddata for NumPy via Matplotlib , but is
I've been using Numpy's numpy.random.exponential function for a while. I now see that Python's
I need to write a function which will detect if the input contains at

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.