Python numpy.mirr() Examples

The following are 26 code examples for showing how to use numpy.mirr(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.

You may check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module numpy , or try the search function .

Example 1
Project: recruit   Author: Frank-qlu   File: test_financial.py    License: Apache License 2.0 6 votes vote down vote up
def test_mirr_decimal(self):
        val = [Decimal('-4500'), Decimal('-800'), Decimal('800'), Decimal('800'),
               Decimal('600'), Decimal('600'), Decimal('800'), Decimal('800'),
               Decimal('700'), Decimal('3000')]
        assert_equal(np.mirr(val, Decimal('0.08'), Decimal('0.055')),
                     Decimal('0.066597175031553548874239618'))

        val = [Decimal('-120000'), Decimal('39000'), Decimal('30000'),
               Decimal('21000'), Decimal('37000'), Decimal('46000')]
        assert_equal(np.mirr(val, Decimal('0.10'), Decimal('0.12')), Decimal('0.126094130365905145828421880'))

        val = [Decimal('100'), Decimal('200'), Decimal('-50'),
               Decimal('300'), Decimal('-200')]
        assert_equal(np.mirr(val, Decimal('0.05'), Decimal('0.06')), Decimal('0.342823387842176663647819868'))

        val = [Decimal('39000'), Decimal('30000'), Decimal('21000'), Decimal('37000'), Decimal('46000')]
        assert_(np.isnan(np.mirr(val, Decimal('0.10'), Decimal('0.12')))) 
Example 2
Project: vnpy_crypto   Author: birforce   File: test_financial.py    License: MIT License 6 votes vote down vote up
def test_mirr_decimal(self):
        val = [Decimal('-4500'), Decimal('-800'), Decimal('800'), Decimal('800'),
               Decimal('600'), Decimal('600'), Decimal('800'), Decimal('800'),
               Decimal('700'), Decimal('3000')]
        assert_equal(np.mirr(val, Decimal('0.08'), Decimal('0.055')),
                     Decimal('0.066597175031553548874239618'))

        val = [Decimal('-120000'), Decimal('39000'), Decimal('30000'),
               Decimal('21000'), Decimal('37000'), Decimal('46000')]
        assert_equal(np.mirr(val, Decimal('0.10'), Decimal('0.12')), Decimal('0.126094130365905145828421880'))

        val = [Decimal('100'), Decimal('200'), Decimal('-50'),
               Decimal('300'), Decimal('-200')]
        assert_equal(np.mirr(val, Decimal('0.05'), Decimal('0.06')), Decimal('0.342823387842176663647819868'))

        val = [Decimal('39000'), Decimal('30000'), Decimal('21000'), Decimal('37000'), Decimal('46000')]
        assert_(np.isnan(np.mirr(val, Decimal('0.10'), Decimal('0.12')))) 
Example 3
Project: Mastering-Elasticsearch-7.0   Author: PacktPublishing   File: test_financial.py    License: MIT License 6 votes vote down vote up
def test_mirr_decimal(self):
        val = [Decimal('-4500'), Decimal('-800'), Decimal('800'), Decimal('800'),
               Decimal('600'), Decimal('600'), Decimal('800'), Decimal('800'),
               Decimal('700'), Decimal('3000')]
        assert_equal(np.mirr(val, Decimal('0.08'), Decimal('0.055')),
                     Decimal('0.066597175031553548874239618'))

        val = [Decimal('-120000'), Decimal('39000'), Decimal('30000'),
               Decimal('21000'), Decimal('37000'), Decimal('46000')]
        assert_equal(np.mirr(val, Decimal('0.10'), Decimal('0.12')), Decimal('0.126094130365905145828421880'))

        val = [Decimal('100'), Decimal('200'), Decimal('-50'),
               Decimal('300'), Decimal('-200')]
        assert_equal(np.mirr(val, Decimal('0.05'), Decimal('0.06')), Decimal('0.342823387842176663647819868'))

        val = [Decimal('39000'), Decimal('30000'), Decimal('21000'), Decimal('37000'), Decimal('46000')]
        assert_(np.isnan(np.mirr(val, Decimal('0.10'), Decimal('0.12')))) 
Example 4
Project: GraphicDesignPatternByPython   Author: Relph1119   File: test_financial.py    License: MIT License 6 votes vote down vote up
def test_mirr_decimal(self):
        val = [Decimal('-4500'), Decimal('-800'), Decimal('800'), Decimal('800'),
               Decimal('600'), Decimal('600'), Decimal('800'), Decimal('800'),
               Decimal('700'), Decimal('3000')]
        assert_equal(np.mirr(val, Decimal('0.08'), Decimal('0.055')),
                     Decimal('0.066597175031553548874239618'))

        val = [Decimal('-120000'), Decimal('39000'), Decimal('30000'),
               Decimal('21000'), Decimal('37000'), Decimal('46000')]
        assert_equal(np.mirr(val, Decimal('0.10'), Decimal('0.12')), Decimal('0.126094130365905145828421880'))

        val = [Decimal('100'), Decimal('200'), Decimal('-50'),
               Decimal('300'), Decimal('-200')]
        assert_equal(np.mirr(val, Decimal('0.05'), Decimal('0.06')), Decimal('0.342823387842176663647819868'))

        val = [Decimal('39000'), Decimal('30000'), Decimal('21000'), Decimal('37000'), Decimal('46000')]
        assert_(np.isnan(np.mirr(val, Decimal('0.10'), Decimal('0.12')))) 
Example 5
def test_mirr_decimal(self):
        val = [Decimal('-4500'), Decimal('-800'), Decimal('800'), Decimal('800'),
               Decimal('600'), Decimal('600'), Decimal('800'), Decimal('800'),
               Decimal('700'), Decimal('3000')]
        assert_equal(np.mirr(val, Decimal('0.08'), Decimal('0.055')),
                     Decimal('0.066597175031553548874239618'))

        val = [Decimal('-120000'), Decimal('39000'), Decimal('30000'),
               Decimal('21000'), Decimal('37000'), Decimal('46000')]
        assert_equal(np.mirr(val, Decimal('0.10'), Decimal('0.12')), Decimal('0.126094130365905145828421880'))

        val = [Decimal('100'), Decimal('200'), Decimal('-50'),
               Decimal('300'), Decimal('-200')]
        assert_equal(np.mirr(val, Decimal('0.05'), Decimal('0.06')), Decimal('0.342823387842176663647819868'))

        val = [Decimal('39000'), Decimal('30000'), Decimal('21000'), Decimal('37000'), Decimal('46000')]
        assert_(np.isnan(np.mirr(val, Decimal('0.10'), Decimal('0.12')))) 
Example 6
Project: pySINDy   Author: luckystarufo   File: test_financial.py    License: MIT License 6 votes vote down vote up
def test_mirr_decimal(self):
        val = [Decimal('-4500'), Decimal('-800'), Decimal('800'), Decimal('800'),
               Decimal('600'), Decimal('600'), Decimal('800'), Decimal('800'),
               Decimal('700'), Decimal('3000')]
        assert_equal(np.mirr(val, Decimal('0.08'), Decimal('0.055')),
                     Decimal('0.066597175031553548874239618'))

        val = [Decimal('-120000'), Decimal('39000'), Decimal('30000'),
               Decimal('21000'), Decimal('37000'), Decimal('46000')]
        assert_equal(np.mirr(val, Decimal('0.10'), Decimal('0.12')), Decimal('0.126094130365905145828421880'))

        val = [Decimal('100'), Decimal('200'), Decimal('-50'),
               Decimal('300'), Decimal('-200')]
        assert_equal(np.mirr(val, Decimal('0.05'), Decimal('0.06')), Decimal('0.342823387842176663647819868'))

        val = [Decimal('39000'), Decimal('30000'), Decimal('21000'), Decimal('37000'), Decimal('46000')]
        assert_(np.isnan(np.mirr(val, Decimal('0.10'), Decimal('0.12')))) 
Example 7
Project: coffeegrindsize   Author: jgagneastro   File: test_financial.py    License: MIT License 6 votes vote down vote up
def test_mirr_decimal(self):
        val = [Decimal('-4500'), Decimal('-800'), Decimal('800'), Decimal('800'),
               Decimal('600'), Decimal('600'), Decimal('800'), Decimal('800'),
               Decimal('700'), Decimal('3000')]
        assert_equal(np.mirr(val, Decimal('0.08'), Decimal('0.055')),
                     Decimal('0.066597175031553548874239618'))

        val = [Decimal('-120000'), Decimal('39000'), Decimal('30000'),
               Decimal('21000'), Decimal('37000'), Decimal('46000')]
        assert_equal(np.mirr(val, Decimal('0.10'), Decimal('0.12')), Decimal('0.126094130365905145828421880'))

        val = [Decimal('100'), Decimal('200'), Decimal('-50'),
               Decimal('300'), Decimal('-200')]
        assert_equal(np.mirr(val, Decimal('0.05'), Decimal('0.06')), Decimal('0.342823387842176663647819868'))

        val = [Decimal('39000'), Decimal('30000'), Decimal('21000'), Decimal('37000'), Decimal('46000')]
        assert_(np.isnan(np.mirr(val, Decimal('0.10'), Decimal('0.12')))) 
Example 8
Project: Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda   Author: PacktPublishing   File: test_financial.py    License: MIT License 6 votes vote down vote up
def test_mirr_decimal(self):
        val = [Decimal('-4500'), Decimal('-800'), Decimal('800'), Decimal('800'),
               Decimal('600'), Decimal('600'), Decimal('800'), Decimal('800'),
               Decimal('700'), Decimal('3000')]
        assert_equal(np.mirr(val, Decimal('0.08'), Decimal('0.055')),
                     Decimal('0.066597175031553548874239618'))

        val = [Decimal('-120000'), Decimal('39000'), Decimal('30000'),
               Decimal('21000'), Decimal('37000'), Decimal('46000')]
        assert_equal(np.mirr(val, Decimal('0.10'), Decimal('0.12')), Decimal('0.126094130365905145828421880'))

        val = [Decimal('100'), Decimal('200'), Decimal('-50'),
               Decimal('300'), Decimal('-200')]
        assert_equal(np.mirr(val, Decimal('0.05'), Decimal('0.06')), Decimal('0.342823387842176663647819868'))

        val = [Decimal('39000'), Decimal('30000'), Decimal('21000'), Decimal('37000'), Decimal('46000')]
        assert_(np.isnan(np.mirr(val, Decimal('0.10'), Decimal('0.12')))) 
Example 9
Project: twitter-stock-recommendation   Author: alvarobartt   File: test_financial.py    License: MIT License 6 votes vote down vote up
def test_mirr_decimal(self):
        val = [Decimal('-4500'), Decimal('-800'), Decimal('800'), Decimal('800'),
               Decimal('600'), Decimal('600'), Decimal('800'), Decimal('800'),
               Decimal('700'), Decimal('3000')]
        assert_equal(np.mirr(val, Decimal('0.08'), Decimal('0.055')),
                     Decimal('0.066597175031553548874239618'))

        val = [Decimal('-120000'), Decimal('39000'), Decimal('30000'),
               Decimal('21000'), Decimal('37000'), Decimal('46000')]
        assert_equal(np.mirr(val, Decimal('0.10'), Decimal('0.12')), Decimal('0.126094130365905145828421880'))

        val = [Decimal('100'), Decimal('200'), Decimal('-50'),
               Decimal('300'), Decimal('-200')]
        assert_equal(np.mirr(val, Decimal('0.05'), Decimal('0.06')), Decimal('0.342823387842176663647819868'))

        val = [Decimal('39000'), Decimal('30000'), Decimal('21000'), Decimal('37000'), Decimal('46000')]
        assert_(np.isnan(np.mirr(val, Decimal('0.10'), Decimal('0.12')))) 
Example 10
Project: recruit   Author: Frank-qlu   File: test_financial.py    License: Apache License 2.0 5 votes vote down vote up
def test_mirr(self):
        val = [-4500, -800, 800, 800, 600, 600, 800, 800, 700, 3000]
        assert_almost_equal(np.mirr(val, 0.08, 0.055), 0.0666, 4)

        val = [-120000, 39000, 30000, 21000, 37000, 46000]
        assert_almost_equal(np.mirr(val, 0.10, 0.12), 0.126094, 6)

        val = [100, 200, -50, 300, -200]
        assert_almost_equal(np.mirr(val, 0.05, 0.06), 0.3428, 4)

        val = [39000, 30000, 21000, 37000, 46000]
        assert_(np.isnan(np.mirr(val, 0.10, 0.12))) 
Example 11
Project: lambda-packs   Author: ryfeus   File: test_financial.py    License: MIT License 5 votes vote down vote up
def test_mirr(self):
        val = [-4500, -800, 800, 800, 600, 600, 800, 800, 700, 3000]
        assert_almost_equal(np.mirr(val, 0.08, 0.055), 0.0666, 4)

        val = [-120000, 39000, 30000, 21000, 37000, 46000]
        assert_almost_equal(np.mirr(val, 0.10, 0.12), 0.126094, 6)

        val = [100, 200, -50, 300, -200]
        assert_almost_equal(np.mirr(val, 0.05, 0.06), 0.3428, 4)

        val = [39000, 30000, 21000, 37000, 46000]
        assert_(np.isnan(np.mirr(val, 0.10, 0.12))) 
Example 12
Project: auto-alt-text-lambda-api   Author: abhisuri97   File: test_financial.py    License: MIT License 5 votes vote down vote up
def test_mirr(self):
        val = [-4500, -800, 800, 800, 600, 600, 800, 800, 700, 3000]
        assert_almost_equal(np.mirr(val, 0.08, 0.055), 0.0666, 4)

        val = [-120000, 39000, 30000, 21000, 37000, 46000]
        assert_almost_equal(np.mirr(val, 0.10, 0.12), 0.126094, 6)

        val = [100, 200, -50, 300, -200]
        assert_almost_equal(np.mirr(val, 0.05, 0.06), 0.3428, 4)

        val = [39000, 30000, 21000, 37000, 46000]
        assert_(np.isnan(np.mirr(val, 0.10, 0.12))) 
Example 13
Project: vnpy_crypto   Author: birforce   File: test_financial.py    License: MIT License 5 votes vote down vote up
def test_mirr(self):
        val = [-4500, -800, 800, 800, 600, 600, 800, 800, 700, 3000]
        assert_almost_equal(np.mirr(val, 0.08, 0.055), 0.0666, 4)

        val = [-120000, 39000, 30000, 21000, 37000, 46000]
        assert_almost_equal(np.mirr(val, 0.10, 0.12), 0.126094, 6)

        val = [100, 200, -50, 300, -200]
        assert_almost_equal(np.mirr(val, 0.05, 0.06), 0.3428, 4)

        val = [39000, 30000, 21000, 37000, 46000]
        assert_(np.isnan(np.mirr(val, 0.10, 0.12))) 
Example 14
Project: Computable   Author: ktraunmueller   File: test_financial.py    License: MIT License 5 votes vote down vote up
def test_mirr(self):
        val = [-4500, -800, 800, 800, 600, 600, 800, 800, 700, 3000]
        assert_almost_equal(np.mirr(val, 0.08, 0.055), 0.0666, 4)

        val = [-120000, 39000, 30000, 21000, 37000, 46000]
        assert_almost_equal(np.mirr(val, 0.10, 0.12), 0.126094, 6)

        val = [100, 200, -50, 300, -200]
        assert_almost_equal(np.mirr(val, 0.05, 0.06), 0.3428, 4)

        val = [39000, 30000, 21000, 37000, 46000]
        assert_(np.isnan(np.mirr(val, 0.10, 0.12))) 
Example 15
Project: Mastering-Elasticsearch-7.0   Author: PacktPublishing   File: test_financial.py    License: MIT License 5 votes vote down vote up
def test_mirr(self):
        val = [-4500, -800, 800, 800, 600, 600, 800, 800, 700, 3000]
        assert_almost_equal(np.mirr(val, 0.08, 0.055), 0.0666, 4)

        val = [-120000, 39000, 30000, 21000, 37000, 46000]
        assert_almost_equal(np.mirr(val, 0.10, 0.12), 0.126094, 6)

        val = [100, 200, -50, 300, -200]
        assert_almost_equal(np.mirr(val, 0.05, 0.06), 0.3428, 4)

        val = [39000, 30000, 21000, 37000, 46000]
        assert_(np.isnan(np.mirr(val, 0.10, 0.12))) 
Example 16
Project: GraphicDesignPatternByPython   Author: Relph1119   File: test_financial.py    License: MIT License 5 votes vote down vote up
def test_mirr(self):
        val = [-4500, -800, 800, 800, 600, 600, 800, 800, 700, 3000]
        assert_almost_equal(np.mirr(val, 0.08, 0.055), 0.0666, 4)

        val = [-120000, 39000, 30000, 21000, 37000, 46000]
        assert_almost_equal(np.mirr(val, 0.10, 0.12), 0.126094, 6)

        val = [100, 200, -50, 300, -200]
        assert_almost_equal(np.mirr(val, 0.05, 0.06), 0.3428, 4)

        val = [39000, 30000, 21000, 37000, 46000]
        assert_(np.isnan(np.mirr(val, 0.10, 0.12))) 
Example 17
Project: cashflows   Author: jdvelasq   File: analysis.py    License: MIT License 5 votes vote down vote up
def mirr(cflo, finance_rate=0, reinvest_rate=0):
    """Computes the modified internal rate of return of a generic cashflow
    as a periodic interest rate.

    Args:
        cflo (pandas.Series): Generic cashflow.
        finance_rate (float): Periodic interest rate applied to negative values of the cashflow.
        reinvest_rate (float): Periodic interest rate applied to positive values of the cashflow.

    Returns:
        Float or list of floats.

    **Examples.**

    >>> cflo = cashflow([-200] + [100]*4, start='2000Q1', freq='Q')
    >>> mirr(cflo) # doctest: +ELLIPSIS
    18.92...

    >>> mirr([cflo, cflo]) # doctest: +ELLIPSIS
    0    18.920712
    1    18.920712
    dtype: float64


    """
    # negativos: finance_rate
    # positivos: reinvest_rate
    if isinstance(cflo, pd.Series):
        cflo = [cflo]
    retval = pd.Series([0] * len(cflo), dtype=np.float64)
    for index, xcflo in enumerate(cflo):
        retval[index] = (100 *  np.mirr(xcflo,
                                        finance_rate,
                                        reinvest_rate))

    if len(retval) == 1:
        return retval[0]
    return retval 
Example 18
def test_mirr(self):
        val = [-4500, -800, 800, 800, 600, 600, 800, 800, 700, 3000]
        assert_almost_equal(np.mirr(val, 0.08, 0.055), 0.0666, 4)

        val = [-120000, 39000, 30000, 21000, 37000, 46000]
        assert_almost_equal(np.mirr(val, 0.10, 0.12), 0.126094, 6)

        val = [100, 200, -50, 300, -200]
        assert_almost_equal(np.mirr(val, 0.05, 0.06), 0.3428, 4)

        val = [39000, 30000, 21000, 37000, 46000]
        assert_(np.isnan(np.mirr(val, 0.10, 0.12))) 
Example 19
Project: pySINDy   Author: luckystarufo   File: test_financial.py    License: MIT License 5 votes vote down vote up
def test_mirr(self):
        val = [-4500, -800, 800, 800, 600, 600, 800, 800, 700, 3000]
        assert_almost_equal(np.mirr(val, 0.08, 0.055), 0.0666, 4)

        val = [-120000, 39000, 30000, 21000, 37000, 46000]
        assert_almost_equal(np.mirr(val, 0.10, 0.12), 0.126094, 6)

        val = [100, 200, -50, 300, -200]
        assert_almost_equal(np.mirr(val, 0.05, 0.06), 0.3428, 4)

        val = [39000, 30000, 21000, 37000, 46000]
        assert_(np.isnan(np.mirr(val, 0.10, 0.12))) 
Example 20
Project: mxnet-lambda   Author: awslabs   File: test_financial.py    License: Apache License 2.0 5 votes vote down vote up
def test_mirr(self):
        val = [-4500, -800, 800, 800, 600, 600, 800, 800, 700, 3000]
        assert_almost_equal(np.mirr(val, 0.08, 0.055), 0.0666, 4)

        val = [-120000, 39000, 30000, 21000, 37000, 46000]
        assert_almost_equal(np.mirr(val, 0.10, 0.12), 0.126094, 6)

        val = [100, 200, -50, 300, -200]
        assert_almost_equal(np.mirr(val, 0.05, 0.06), 0.3428, 4)

        val = [39000, 30000, 21000, 37000, 46000]
        assert_(np.isnan(np.mirr(val, 0.10, 0.12))) 
Example 21
Project: ImageFusion   Author: pfchai   File: test_financial.py    License: MIT License 5 votes vote down vote up
def test_mirr(self):
        val = [-4500, -800, 800, 800, 600, 600, 800, 800, 700, 3000]
        assert_almost_equal(np.mirr(val, 0.08, 0.055), 0.0666, 4)

        val = [-120000, 39000, 30000, 21000, 37000, 46000]
        assert_almost_equal(np.mirr(val, 0.10, 0.12), 0.126094, 6)

        val = [100, 200, -50, 300, -200]
        assert_almost_equal(np.mirr(val, 0.05, 0.06), 0.3428, 4)

        val = [39000, 30000, 21000, 37000, 46000]
        assert_(np.isnan(np.mirr(val, 0.10, 0.12))) 
Example 22
Project: elasticintel   Author: securityclippy   File: test_financial.py    License: GNU General Public License v3.0 5 votes vote down vote up
def test_mirr(self):
        val = [-4500, -800, 800, 800, 600, 600, 800, 800, 700, 3000]
        assert_almost_equal(np.mirr(val, 0.08, 0.055), 0.0666, 4)

        val = [-120000, 39000, 30000, 21000, 37000, 46000]
        assert_almost_equal(np.mirr(val, 0.10, 0.12), 0.126094, 6)

        val = [100, 200, -50, 300, -200]
        assert_almost_equal(np.mirr(val, 0.05, 0.06), 0.3428, 4)

        val = [39000, 30000, 21000, 37000, 46000]
        assert_(np.isnan(np.mirr(val, 0.10, 0.12))) 
Example 23
Project: coffeegrindsize   Author: jgagneastro   File: test_financial.py    License: MIT License 5 votes vote down vote up
def test_mirr(self):
        val = [-4500, -800, 800, 800, 600, 600, 800, 800, 700, 3000]
        assert_almost_equal(np.mirr(val, 0.08, 0.055), 0.0666, 4)

        val = [-120000, 39000, 30000, 21000, 37000, 46000]
        assert_almost_equal(np.mirr(val, 0.10, 0.12), 0.126094, 6)

        val = [100, 200, -50, 300, -200]
        assert_almost_equal(np.mirr(val, 0.05, 0.06), 0.3428, 4)

        val = [39000, 30000, 21000, 37000, 46000]
        assert_(np.isnan(np.mirr(val, 0.10, 0.12))) 
Example 24
Project: Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda   Author: PacktPublishing   File: test_financial.py    License: MIT License 5 votes vote down vote up
def test_mirr(self):
        val = [-4500, -800, 800, 800, 600, 600, 800, 800, 700, 3000]
        assert_almost_equal(np.mirr(val, 0.08, 0.055), 0.0666, 4)

        val = [-120000, 39000, 30000, 21000, 37000, 46000]
        assert_almost_equal(np.mirr(val, 0.10, 0.12), 0.126094, 6)

        val = [100, 200, -50, 300, -200]
        assert_almost_equal(np.mirr(val, 0.05, 0.06), 0.3428, 4)

        val = [39000, 30000, 21000, 37000, 46000]
        assert_(np.isnan(np.mirr(val, 0.10, 0.12))) 
Example 25
Project: twitter-stock-recommendation   Author: alvarobartt   File: test_financial.py    License: MIT License 5 votes vote down vote up
def test_mirr(self):
        val = [-4500, -800, 800, 800, 600, 600, 800, 800, 700, 3000]
        assert_almost_equal(np.mirr(val, 0.08, 0.055), 0.0666, 4)

        val = [-120000, 39000, 30000, 21000, 37000, 46000]
        assert_almost_equal(np.mirr(val, 0.10, 0.12), 0.126094, 6)

        val = [100, 200, -50, 300, -200]
        assert_almost_equal(np.mirr(val, 0.05, 0.06), 0.3428, 4)

        val = [39000, 30000, 21000, 37000, 46000]
        assert_(np.isnan(np.mirr(val, 0.10, 0.12))) 
Example 26
Project: keras-lambda   Author: sunilmallya   File: test_financial.py    License: MIT License 5 votes vote down vote up
def test_mirr(self):
        val = [-4500, -800, 800, 800, 600, 600, 800, 800, 700, 3000]
        assert_almost_equal(np.mirr(val, 0.08, 0.055), 0.0666, 4)

        val = [-120000, 39000, 30000, 21000, 37000, 46000]
        assert_almost_equal(np.mirr(val, 0.10, 0.12), 0.126094, 6)

        val = [100, 200, -50, 300, -200]
        assert_almost_equal(np.mirr(val, 0.05, 0.06), 0.3428, 4)

        val = [39000, 30000, 21000, 37000, 46000]
        assert_(np.isnan(np.mirr(val, 0.10, 0.12)))