Harbor format: 14 coding_additions tasks (part 9)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- .gitattributes+2
- tasks/tasksmith-a7e859277e7a/environment/source/pyproject.tomlAdded+64
- tasks/tasksmith-a7e859277e7a/instruction.mdAdded+25
- tasks/tasksmith-a7e859277e7a/solution/reference/benchmarks/benchmarks.pyAdded+31
- tasks/tasksmith-a7e859277e7a/solution/reference/numpy_financial/_financial.pyAdded+1041
- tasks/tasksmith-a7e859277e7a/solution/solve.shAdded+6
- tasks/tasksmith-a7e859277e7a/task.tomlAdded+226
- tasks/tasksmith-a7e859277e7a/tests/DockerfileAdded+10
- tasks/tasksmith-a7e859277e7a/tests/contract.jsonAdded+1
- tasks/tasksmith-a7e859277e7a/tests/grade.pyAdded+196
- tasks/tasksmith-a7e859277e7a/tests/source/.github/CODE_OF_CONDUCT.mdAdded+9
- tasks/tasksmith-a7e859277e7a/tests/source/.github/ISSUE_TEMPLATE/bug-report.ymlAdded+63
- tasks/tasksmith-a7e859277e7a/tests/source/.github/ISSUE_TEMPLATE/config.ymlAdded+7
- tasks/tasksmith-a7e859277e7a/tests/source/.github/ISSUE_TEMPLATE/documentation.ymlAdded+23
- tasks/tasksmith-a7e859277e7a/tests/source/.github/ISSUE_TEMPLATE/feature-request.ymlAdded+22
- tasks/tasksmith-a7e859277e7a/tests/source/.github/workflows/lint.ymlAdded+53
- tasks/tasksmith-a7e859277e7a/tests/source/.github/workflows/publish_docs_to_pages.ymlAdded+76
- tasks/tasksmith-a7e859277e7a/tests/source/.github/workflows/pythonpackage.ymlAdded+25
- tasks/tasksmith-a7e859277e7a/tests/source/.gitignoreAdded+113
- tasks/tasksmith-a7e859277e7a/tests/source/DockerfileAdded+8
- tasks/tasksmith-a7e859277e7a/tests/source/LICENSE.txtAdded+30
- tasks/tasksmith-a7e859277e7a/tests/source/README.mdAdded+21
- tasks/tasksmith-a7e859277e7a/tests/source/asv.conf.jsonAdded+193
- tasks/tasksmith-a7e859277e7a/tests/source/benchmarks/__init__.pyAdded
- tasks/tasksmith-a7e859277e7a/tests/source/benchmarks/benchmarks.pyAdded+49
- tasks/tasksmith-a7e859277e7a/tests/source/doc/MakefileAdded+20
- tasks/tasksmith-a7e859277e7a/tests/source/doc/make.batAdded+35
- tasks/tasksmith-a7e859277e7a/tests/source/doc/source/_static/numpy_financial_favicon.pngAdded
- tasks/tasksmith-a7e859277e7a/tests/source/doc/source/_static/numpy_financial_logov.svgAdded
- tasks/tasksmith-a7e859277e7a/tests/source/doc/source/conf.pyAdded+67
- tasks/tasksmith-a7e859277e7a/tests/source/doc/source/dev/building_with_poetry.mdAdded+67
- tasks/tasksmith-a7e859277e7a/tests/source/doc/source/dev/getting_the_code.mdAdded+43
- tasks/tasksmith-a7e859277e7a/tests/source/doc/source/dev/running_the_benchmarks.mdAdded+55
- tasks/tasksmith-a7e859277e7a/tests/source/doc/source/fv.rstAdded+8
- tasks/tasksmith-a7e859277e7a/tests/source/doc/source/generate_rst_function_files.pyAdded+27
- tasks/tasksmith-a7e859277e7a/tests/source/doc/source/index.rstAdded+79
- tasks/tasksmith-a7e859277e7a/tests/source/doc/source/ipmt.rstAdded+8
- tasks/tasksmith-a7e859277e7a/tests/source/doc/source/irr.rstAdded+8
- tasks/tasksmith-a7e859277e7a/tests/source/doc/source/mirr.rstAdded+8
- tasks/tasksmith-a7e859277e7a/tests/source/doc/source/nper.rstAdded+8
- tasks/tasksmith-a7e859277e7a/tests/source/doc/source/npv.rstAdded+8
- tasks/tasksmith-a7e859277e7a/tests/source/doc/source/pmt.rstAdded+8
- tasks/tasksmith-a7e859277e7a/tests/source/doc/source/ppmt.rstAdded+8
- tasks/tasksmith-a7e859277e7a/tests/source/doc/source/pv.rstAdded+8
- tasks/tasksmith-a7e859277e7a/tests/source/doc/source/rate.rstAdded+8
- tasks/tasksmith-a7e859277e7a/tests/source/doc/source/release-notes.rstAdded+20
- tasks/tasksmith-a7e859277e7a/tests/source/docweb/README.txtAdded+3
- tasks/tasksmith-a7e859277e7a/tests/source/docweb/css/home.cssAdded+128
- tasks/tasksmith-a7e859277e7a/tests/source/docweb/images/numpy_financial_favicon.pngAdded
- tasks/tasksmith-a7e859277e7a/tests/source/docweb/images/numpy_financial_logoh.svgAdded
143 unmodified lines144145146143 unmodified linestasks/tasksmith-87860368c397/tests/source/tests/pdfs/pdffill-demo.pdf filter=lfs diff=lfs merge=lfs -texttasks/tasksmith-87860368c397/tests/source/tests/pdfs/pr-136-example.pdf filter=lfs diff=lfs merge=lfs -texttasks/tasksmith-87860368c397/tests/source/tests/pdfs/table-curves-example.pdf filter=lfs diff=lfs merge=lfs -text143 unmodified lines144145146147148143 unmodified linestasks/tasksmith-87860368c397/tests/source/tests/pdfs/pdffill-demo.pdf filter=lfs diff=lfs merge=lfs -texttasks/tasksmith-87860368c397/tests/source/tests/pdfs/pr-136-example.pdf filter=lfs diff=lfs merge=lfs -texttasks/tasksmith-87860368c397/tests/source/tests/pdfs/table-curves-example.pdf filter=lfs diff=lfs merge=lfs -texttasks/tasksmith-ca08ab4caec6/environment/source/etc/NYSE-Historical-Closings.pdf filter=lfs diff=lfs merge=lfs -texttasks/tasksmith-ca08ab4caec6/tests/source/etc/NYSE-Historical-Closings.pdf filter=lfs diff=lfs merge=lfs -text
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364[build-system]requires = ["poetry-core"]build-backend = "poetry.core.masonry.api"
[tool.poetry]name = "numpy-financial"version = "2.0.0"description = "Simple financial functions"license = "BSD-3-Clause"authors = ["Travis E. Oliphant et al."]maintainers = ["Numpy Financial Developers <numpy-discussion@python.org>"]readme = "README.md"homepage = "https://numpy.org/numpy-financial/latest/"repository = "https://github.com/numpy/numpy-financial"documentation = "https://numpy.org/numpy-financial/latest/#functions"classifiers = [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Intended Audience :: Financial and Insurance Industry", "License :: OSI Approved :: BSD License", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3 :: Only", "Topic :: Software Development", "Topic :: Office/Business :: Financial :: Accounting", "Topic :: Office/Business :: Financial :: Investment", "Topic :: Office/Business :: Financial :: Spreadsheet", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Operating System :: Unix", "Operating System :: MacOS",]packages = [{include = "numpy_financial"}]
[tool.poetry.dependencies]python = "^3.10"numpy = "^1.23"numba = "^0.59.1"
[tool.poetry.group.test.dependencies]pytest = "^8.0"hypothesis = {extras = ["numpy"], version = "^6.99.11"}pytest-xdist = {extras = ["psutil"], version = "^3.5.0"}
[tool.poetry.group.docs.dependencies]sphinx = "^7.0"numpydoc = "^1.5"pydata-sphinx-theme = "^0.14.3"myst-parser = "^2.0.0"
[tool.poetry.group.lint.dependencies]ruff = "^0.3"
[tool.poetry.group.bench.dependencies]asv = "^0.6"
12345678910111213141516171819202122232425Rework `npf.npv(rate, values)` to support broadcasting over multiple rates and cashflow series.
**New behavior:**
- When `rate` is a 1-D array of length *R* and `values` is a 2-D array of shape *(C, T)*, `npv` must return an array of shape *(R, C)* where entry `[i, j]` is the NPV of cashflow row `j` discounted at `rates[i]`.- When either argument is a scalar / 1-D cashflow (single series), the result should be squeezed: a scalar when only one rate and one cashflow, a 1-D array otherwise.- A `rate` whose array representation has `ndim > 1` (e.g. a 2-D list or a 3-D array) must raise `ValueError`.- A `values` input whose array representation has `ndim > 2` (e.g. a 3-D list or array) must raise `ValueError`.- When `rate` is exactly `-1` (integer or float), the function must return `nan` instead of raising an error.
**Preserved behavior:** `npv(scalar_rate, 1d_cashflow)` continues to return a scalar with the same formula: `sum(values[t] / (1 + rate)**t for t in range(T))`.
**Example:**```pythonrates = [0.00, 0.05, 0.10]cashflows = [[-4_000, 500, 800], [-5_000, 600, 900]]npf.npv(rates, cashflows)# array([[-2700. , -3500. ],# [-2798.19, -3612.24],# [-2884.3 , -3710.74]])```
Work in `/workspace`. Submit your fix in Python source files under `numpy_financial`, `benchmarks/benchmarks.py`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the relevant repository tests in a fresh environment, using your submitted source files.12345678910111213141516171819202122232425262728293031import numpy as np
import numpy_financial as npf
class Npv2D:
param_names = ["n_cashflows", "cashflow_lengths", "rates_lengths"] params = [ (1, 10, 100), (1, 10, 100), (1, 10, 100), ]
def __init__(self): self.rates = None self.cashflows = None
def setup(self, n_cashflows, cashflow_lengths, rates_lengths): rng = np.random.default_rng(0) cf_shape = (n_cashflows, cashflow_lengths) self.cashflows = rng.standard_normal(cf_shape) self.rates = rng.standard_normal(rates_lengths)
def time_for_loop(self, n_cashflows, cashflow_lengths, rates_lengths): for rate in self.rates: for cashflow in self.cashflows: npf.npv(rate, cashflow)
def time_broadcast(self, n_cashflows, cashflow_lengths, rates_lengths): npf.npv(self.rates, self.cashflows)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041"""Some simple financial calculations.
patterned after spreadsheet computations.
There is some complexity in each functionso that the functions behave like ufuncs withbroadcasting and being able to be called with scalarsor arrays (or other sequences).
Functions support the :class:`decimal.Decimal` type unlessotherwise stated."""
from decimal import Decimal
import numba as nbimport numpy as np
__all__ = ['fv', 'pmt', 'nper', 'ipmt', 'ppmt', 'pv', 'rate', 'irr', 'npv', 'mirr', 'NoRealSolutionError', 'IterationsExceededError']
_when_to_num = {'end': 0, 'begin': 1, 'e': 0, 'b': 1, 0: 0, 1: 1, 'beginning': 1, 'start': 1, 'finish': 0}
class NoRealSolutionError(Exception): """No real solution to the problem."""
class IterationsExceededError(Exception): """Maximum number of iterations reached."""
def _get_output_array_shape(*arrays): return tuple(array.shape[0] for array in arrays)
def _ufunc_like(array): try: # If size of array is one, return scalar return array.item() except ValueError: # Otherwise, return entire array return array.squeeze()
def _convert_when(when): # Test to see if when has already been converted to ndarray # This will happen if one function calls another, for example ppmt if isinstance(when, np.ndarray): return when try: return _when_to_num[when] except (KeyError, TypeError): return [_when_to_num[x] for x in when]
def fv(rate, nper, pmt, pv, when='end'): """Compute the future value.
Given: * a present value, `pv` * an interest `rate` compounded once per period, of which there are * `nper` total * a (fixed) payment, `pmt`, paid either * at the beginning (`when` = {'begin', 1}) or the end (`when` = {'end', 0}) of each period
Return: the value at the end of the `nper` periods
Parameters ---------- rate : scalar or array_like of shape(M, ) Rate of interest as decimal (not per cent) per period nper : scalar or array_like of shape(M, ) Number of compounding periods pmt : scalar or array_like of shape(M, ) Payment pv : scalar or array_like of shape(M, ) Present value when : {{'begin', 1}, {'end', 0}}, {string, int}, optional When payments are due ('begin' (1) or 'end' (0)). Defaults to {'end', 0}.
Returns ------- out : ndarray Future values. If all input is scalar, returns a scalar float. If any input is array_like, returns future values for each input element. If multiple inputs are array_like, they all must have the same shape.
Notes ----- The future value is computed by solving the equation::
fv + pv*(1+rate)**nper + pmt*(1 + rate*when)/rate*((1 + rate)**nper - 1) == 0
or, when ``rate == 0``::
fv + pv + pmt * nper == 0
References ---------- .. [WRW] Wheeler, D. A., E. Rathke, and R. Weir (Eds.) (2009, May). Open Document Format for Office Applications (OpenDocument)v1.2, Part 2: Recalculated Formula (OpenFormula) Format - Annotated Version, Pre-Draft 12. Organization for the Advancement of Structured Information Standards (OASIS). Billerica, MA, USA. [ODT Document]. Available: http://www.oasis-open.org/committees/documents.php?wg_abbrev=office-formula OpenDocument-formula-20090508.odt
Examples -------- >>> import numpy as np >>> import numpy_financial as npf
What is the future value after 10 years of saving $100 now, with an additional monthly savings of $100. Assume the interest rate is 5% (annually) compounded monthly?
>>> npf.fv(0.05/12, 10*12, -100, -100) 15692.92889433575
By convention, the negative sign represents cash flow out (i.e. money not available today). Thus, saving $100 a month at 5% annual interest leads to $15,692.93 available to spend in 10 years.
If any input is array_like, returns an array of equal shape. Let's compare different interest rates from the example above.
>>> a = np.array((0.05, 0.06, 0.07))/12 >>> npf.fv(a, 10*12, -100, -100) array([15692.92889434, 16569.87435405, 17509.44688102])
""" when = _convert_when(when) rate, nper, pmt, pv, when = np.broadcast_arrays(rate, nper, pmt, pv, when)
fv_array = np.empty_like(rate) zero = rate == 0 nonzero = ~zero
fv_array[zero] = -(pv[zero] + pmt[zero] * nper[zero])
rate_nonzero = rate[nonzero] temp = (1 + rate_nonzero) ** nper[nonzero] fv_array[nonzero] = ( - pv[nonzero] * temp - pmt[nonzero] * (1 + rate_nonzero * when[nonzero]) / rate_nonzero * (temp - 1) )
if np.ndim(fv_array) == 0: # Follow the ufunc convention of returning scalars for scalar # and 0d array inputs. return fv_array.item(0) return fv_array
def pmt(rate, nper, pv, fv=0, when='end'): """Compute the payment against loan principal plus interest.
Given: * a present value, `pv` (e.g., an amount borrowed) * a future value, `fv` (e.g., 0) * an interest `rate` compounded once per period, of which there are * `nper` total * and (optional) specification of whether payment is made at the beginning (`when` = {'begin', 1}) or the end (`when` = {'end', 0}) of each period
Return: the (fixed) periodic payment.
Parameters ---------- rate : array_like Rate of interest (per period) nper : array_like Number of compounding periods pv : array_like Present value fv : array_like, optional Future value (default = 0) when : {{'begin', 1}, {'end', 0}}, {string, int} When payments are due ('begin' (1) or 'end' (0))
Returns ------- out : ndarray Payment against loan plus interest. If all input is scalar, returns a scalar float. If any input is array_like, returns payment for each input element. If multiple inputs are array_like, they all must have the same shape.
Notes ----- The payment is computed by solving the equation::
fv + pv*(1 + rate)**nper + pmt*(1 + rate*when)/rate*((1 + rate)**nper - 1) == 0
or, when ``rate == 0``::
fv + pv + pmt * nper == 0
for ``pmt``.
Note that computing a monthly mortgage payment is only one use for this function. For example, pmt returns the periodic deposit one must make to achieve a specified future balance given an initial deposit, a fixed, periodically compounded interest rate, and the total number of periods.
References ---------- .. [WRW] Wheeler, D. A., E. Rathke, and R. Weir (Eds.) (2009, May). Open Document Format for Office Applications (OpenDocument)v1.2, Part 2: Recalculated Formula (OpenFormula) Format - Annotated Version, Pre-Draft 12. Organization for the Advancement of Structured Information Standards (OASIS). Billerica, MA, USA. [ODT Document]. Available: http://www.oasis-open.org/committees/documents.php ?wg_abbrev=office-formulaOpenDocument-formula-20090508.odt
Examples -------- >>> import numpy_financial as npf
What is the monthly payment needed to pay off a $200,000 loan in 15 years at an annual interest rate of 7.5%?
>>> npf.pmt(0.075/12, 12*15, 200000) -1854.0247200054619
In order to pay-off (i.e., have a future-value of 0) the $200,000 obtained today, a monthly payment of $1,854.02 would be required. Note that this example illustrates usage of `fv` having a default value of 0.
""" when = _convert_when(when) (rate, nper, pv, fv, when) = map(np.array, [rate, nper, pv, fv, when]) temp = (1 + rate) ** nper mask = (rate == 0) masked_rate = np.where(mask, 1, rate) fact = np.where(mask != 0, nper, (1 + masked_rate * when) * (temp - 1) / masked_rate) return -(fv + pv * temp) / fact
def nper(rate, pmt, pv, fv=0, when='end'): """Compute the number of periodic payments.
:class:`decimal.Decimal` type is not supported.
Parameters ---------- rate : array_like Rate of interest (per period) pmt : array_like Payment pv : array_like Present value fv : array_like, optional Future value when : {{'begin', 1}, {'end', 0}}, {string, int}, optional When payments are due ('begin' (1) or 'end' (0))
Notes ----- The number of periods ``nper`` is computed by solving the equation::
fv + pv*(1+rate)**nper + pmt*(1+rate*when)/rate*((1+rate)**nper-1) = 0
but if ``rate = 0`` then::
fv + pv + pmt*nper = 0
Examples -------- >>> import numpy as np >>> import numpy_financial as npf
If you only had $150/month to pay towards the loan, how long would it take to pay-off a loan of $8,000 at 7% annual interest?
>>> print(np.round(npf.nper(0.07/12, -150, 8000), 5)) 64.07335
So, over 64 months would be required to pay off the loan.
The same analysis could be done with several different interest rates and/or payments and/or total amounts to produce an entire table.
>>> npf.nper(*(np.ogrid[0.07/12: 0.08/12: 0.01/12, ... -150 : -99 : 50 , ... 8000 : 9001 : 1000])) array([[[ 64.07334877, 74.06368256], [108.07548412, 127.99022654]], <BLANKLINE> [[ 66.12443902, 76.87897353], [114.70165583, 137.90124779]]]) """ when = _convert_when(when) rate, pmt, pv, fv, when = np.broadcast_arrays(rate, pmt, pv, fv, when) nper_array = np.empty_like(rate, dtype=np.float64)
zero = rate == 0 nonzero = ~zero
with np.errstate(divide='ignore'): # Infinite numbers of payments are okay, so ignore the # potential divide by zero. nper_array[zero] = -(fv[zero] + pv[zero]) / pmt[zero]
nonzero_rate = rate[nonzero] z = pmt[nonzero] * (1 + nonzero_rate * when[nonzero]) / nonzero_rate nper_array[nonzero] = ( np.log((-fv[nonzero] + z) / (pv[nonzero] + z)) / np.log(1 + nonzero_rate) )
return nper_array
def _value_like(arr, value): entry = arr.item(0) if isinstance(entry, Decimal): return Decimal(value) return np.array(value, dtype=arr.dtype).item(0)
def ipmt(rate, per, nper, pv, fv=0, when='end'): """Compute the interest portion of a payment.
Parameters ---------- rate : scalar or array_like of shape(M, ) Rate of interest as decimal (not per cent) per period per : scalar or array_like of shape(M, ) Interest paid against the loan changes during the life or the loan. The `per` is the payment period to calculate the interest amount. nper : scalar or array_like of shape(M, ) Number of compounding periods pv : scalar or array_like of shape(M, ) Present value fv : scalar or array_like of shape(M, ), optional Future value when : {{'begin', 1}, {'end', 0}}, {string, int}, optional When payments are due ('begin' (1) or 'end' (0)). Defaults to {'end', 0}.
Returns ------- out : ndarray Interest portion of payment. If all input is scalar, returns a scalar float. If any input is array_like, returns interest payment for each input element. If multiple inputs are array_like, they all must have the same shape.
See Also -------- ppmt, pmt, pv
Notes ----- The total payment is made up of payment against principal plus interest.
``pmt = ppmt + ipmt``
Examples -------- >>> import numpy as np >>> import numpy_financial as npf
What is the amortization schedule for a 1 year loan of $2500 at 8.24% interest per year compounded monthly?
>>> principal = 2500.00
The 'per' variable represents the periods of the loan. Remember that financial equations start the period count at 1!
>>> per = np.arange(1*12) + 1 >>> ipmt = npf.ipmt(0.0824/12, per, 1*12, principal) >>> ppmt = npf.ppmt(0.0824/12, per, 1*12, principal)
Each element of the sum of the 'ipmt' and 'ppmt' arrays should equal 'pmt'.
>>> pmt = npf.pmt(0.0824/12, 1*12, principal) >>> np.allclose(ipmt + ppmt, pmt) True
>>> fmt = '{0:2d} {1:8.2f} {2:8.2f} {3:8.2f}' >>> for payment in per: ... index = payment - 1 ... principal = principal + ppmt[index] ... print(fmt.format(payment, ppmt[index], ipmt[index], principal)) 1 -200.58 -17.17 2299.42 2 -201.96 -15.79 2097.46 3 -203.35 -14.40 1894.11 4 -204.74 -13.01 1689.37 5 -206.15 -11.60 1483.22 6 -207.56 -10.18 1275.66 7 -208.99 -8.76 1066.67 8 -210.42 -7.32 856.25 9 -211.87 -5.88 644.38 10 -213.32 -4.42 431.05 11 -214.79 -2.96 216.26 12 -216.26 -1.49 -0.00
>>> interestpd = np.sum(ipmt) >>> np.round(interestpd, 2) -112.98
""" when = _convert_when(when) rate, per, nper, pv, fv, when = np.broadcast_arrays(rate, per, nper, pv, fv, when)
total_pmt = pmt(rate, nper, pv, fv, when) ipmt_array = np.array(_rbl(rate, per, total_pmt, pv, when) * rate)
# Payments start at the first period, so payments before that # don't make any sense. ipmt_array[per < 1] = _value_like(ipmt_array, np.nan) # If payments occur at the beginning of a period and this is the # first period, then no interest has accrued. per1_and_begin = (when == 1) & (per == 1) ipmt_array[per1_and_begin] = _value_like(ipmt_array, 0) # If paying at the beginning we need to discount by one period. per_gt_1_and_begin = (when == 1) & (per > 1) ipmt_array[per_gt_1_and_begin] = ( ipmt_array[per_gt_1_and_begin] / (1 + rate[per_gt_1_and_begin]) )
if np.ndim(ipmt_array) == 0: # Follow the ufunc convention of returning scalars for scalar # and 0d array inputs. return ipmt_array.item(0) return ipmt_array
def _rbl(rate, per, pmt, pv, when): """Remaining balance on loan.
This function is here to simply have a different name for the 'fv' function to not interfere with the 'fv' keyword argument within the 'ipmt' function. It is the 'remaining balance on loan' which might be useful as it's own function, but is easily calculated with the 'fv' function. """ return fv(rate, (per - 1), pmt, pv, when)
def ppmt(rate, per, nper, pv, fv=0, when='end'): """Compute the payment against loan principle.
Parameters ---------- rate : array_like Rate of interest (per period) per : array_like, int Amount paid against the loan changes. The `per` is the period of interest. nper : array_like Number of compounding periods pv : array_like Present value fv : array_like, optional Future value when : {{'begin', 1}, {'end', 0}}, {string, int} When payments are due ('begin' (1) or 'end' (0))
See Also -------- pmt, pv, ipmt
""" total = pmt(rate, nper, pv, fv, when) return total - ipmt(rate, per, nper, pv, fv, when)
def pv(rate, nper, pmt, fv=0, when='end'): """Compute the present value.
Given: * a future value, `fv` * an interest `rate` compounded once per period, of which there are * `nper` total * a (fixed) payment, `pmt`, paid either * at the beginning (`when` = {'begin', 1}) or the end (`when` = {'end', 0}) of each period
Return: the value now
Parameters ---------- rate : array_like Rate of interest (per period) nper : array_like Number of compounding periods pmt : array_like Payment fv : array_like, optional Future value when : {{'begin', 1}, {'end', 0}}, {string, int}, optional When payments are due ('begin' (1) or 'end' (0))
Returns ------- out : ndarray, float Present value of a series of payments or investments.
Notes ----- The present value is computed by solving the equation::
fv + pv*(1 + rate)**nper + pmt*(1 + rate*when)/rate*((1 + rate)**nper - 1) = 0
or, when ``rate = 0``::
fv + pv + pmt * nper = 0
for `pv`, which is then returned.
References ---------- .. [WRW] Wheeler, D. A., E. Rathke, and R. Weir (Eds.) (2009, May). Open Document Format for Office Applications (OpenDocument)v1.2, Part 2: Recalculated Formula (OpenFormula) Format - Annotated Version, Pre-Draft 12. Organization for the Advancement of Structured Information Standards (OASIS). Billerica, MA, USA. [ODT Document]. Available: http://www.oasis-open.org/committees/documents.php?wg_abbrev=office-formula OpenDocument-formula-20090508.odt
Examples -------- >>> import numpy as np >>> import numpy_financial as npf
What is the present value (e.g., the initial investment) of an investment that needs to total $15692.93 after 10 years of saving $100 every month? Assume the interest rate is 5% (annually) compounded monthly.
>>> npf.pv(0.05/12, 10*12, -100, 15692.93) -100.00067131625819
By convention, the negative sign represents cash flow out (i.e., money not available today). Thus, to end up with $15,692.93 in 10 years saving $100 a month at 5% annual interest, one's initial deposit should also be $100.
If any input is array_like, ``pv`` returns an array of equal shape. Let's compare different interest rates in the example above:
>>> a = np.array((0.05, 0.04, 0.03))/12 >>> npf.pv(a, 10*12, -100, 15692.93) array([ -100.00067132, -649.26771385, -1273.78633713])
So, to end up with the same $15692.93 under the same $100 per month "savings plan," for annual interest rates of 4% and 3%, one would need initial investments of $649.27 and $1273.79, respectively.
""" when = _convert_when(when) (rate, nper, pmt, fv, when) = map(np.asarray, [rate, nper, pmt, fv, when]) temp = (1 + rate) ** nper fact = np.where(rate == 0, nper, (1 + rate * when) * (temp - 1) / rate) return -(fv + pmt * fact) / temp
# Computed with Sage# (y + (r + 1)^n*x + p*((r + 1)^n - 1)*(r*w + 1)/r)/(n*(r + 1)^(n - 1)*x -# p*((r + 1)^n - 1)*(r*w + 1)/r^2 + n*p*(r + 1)^(n - 1)*(r*w + 1)/r +# p*((r + 1)^n - 1)*w/r)
def _g_div_gp(r, n, p, x, y, w): # Evaluate g(r_n)/g'(r_n), where g = # fv + pv*(1+rate)**nper + pmt*(1+rate*when)/rate * ((1+rate)**nper - 1) t1 = (r + 1) ** n t2 = (r + 1) ** (n - 1) g = y + t1 * x + p * (t1 - 1) * (r * w + 1) / r gp = (n * t2 * x - p * (t1 - 1) * (r * w + 1) / (r ** 2) + n * p * t2 * (r * w + 1) / r + p * (t1 - 1) * w / r) return g / gp
# Use Newton's iteration until the change is less than 1e-6# for all values or a maximum of 100 iterations is reached.# Newton's rule is# r_{n+1} = r_{n} - g(r_n)/g'(r_n)# where# g(r) is the formula# g'(r) is the derivative with respect to r.def rate( nper, pmt, pv, fv, when='end', guess=None, tol=None, maxiter=100, *, raise_exceptions=False): """Compute the rate of interest per period.
Parameters ---------- nper : array_like Number of compounding periods pmt : array_like Payment pv : array_like Present value fv : array_like Future value when : {{'begin', 1}, {'end', 0}}, {string, int}, optional When payments are due ('begin' (1) or 'end' (0)) guess : Number, optional Starting guess for solving the rate of interest, default 0.1 tol : Number, optional Required tolerance for the solution, default 1e-6 maxiter : int, optional Maximum iterations in finding the solution raise_exceptions: bool, optional Flag to raise an exception when at least one of the rates cannot be computed due to having reached the maximum number of iterations (IterationsExceededException). Set to False as default, thus returning NaNs for those rates.
Notes ----- The rate of interest is computed by iteratively solving the (non-linear) equation::
fv + pv*(1+rate)**nper + pmt*(1+rate*when)/rate * ((1+rate)**nper - 1) = 0
for ``rate``.
References ---------- Wheeler, D. A., E. Rathke, and R. Weir (Eds.) (2009, May). Open Document Format for Office Applications (OpenDocument)v1.2, Part 2: Recalculated Formula (OpenFormula) Format - Annotated Version, Pre-Draft 12. Organization for the Advancement of Structured Information Standards (OASIS). Billerica, MA, USA. [ODT Document]. Available: http://www.oasis-open.org/committees/documents.php?wg_abbrev=office-formula OpenDocument-formula-20090508.odt
""" when = _convert_when(when) default_type = Decimal if isinstance(pmt, Decimal) else float
# Handle casting defaults to Decimal if/when pmt is a Decimal and # guess and/or tol are not given default values if guess is None: guess = default_type('0.1')
if tol is None: tol = default_type('1e-6')
(nper, pmt, pv, fv, when) = map(np.asarray, [nper, pmt, pv, fv, when])
rn = guess iterator = 0 close = False while (iterator < maxiter) and not np.all(close): rnp1 = rn - _g_div_gp(rn, nper, pmt, pv, fv, when) diff = abs(rnp1 - rn) close = diff < tol iterator += 1 rn = rnp1
if not np.all(close): if np.isscalar(rn): if raise_exceptions: raise IterationsExceededError('Maximum number of iterations exceeded.') return default_type(np.nan) else: # Return nan's in array of the same shape as rn # where the solution is not close to tol. if raise_exceptions: raise IterationsExceededError(f'Maximum iterations exceeded in ' f'{len(close) - close.sum()} rate(s).') rn[~close] = np.nan return rn
def irr(values, *, guess=None, tol=1e-12, maxiter=100, raise_exceptions=False): r"""Return the Internal Rate of Return (IRR).
This is the "average" periodically compounded rate of return that gives a net present value of 0.0; for a more complete explanation, see Notes below.
:class:`decimal.Decimal` type is not supported.
Parameters ---------- values : array_like, shape(N,) Input cash flows per time period. By convention, net "deposits" are negative and net "withdrawals" are positive. Thus, for example, at least the first element of `values`, which represents the initial investment, will typically be negative. guess : float, optional Initial guess of the IRR for the iterative solver. If no guess is given an heuristic is used to estimate the guess through the ratio of positive to negative cash lows tol : float, optional Required tolerance to accept solution. Default is 1e-12. maxiter : int, optional Maximum iterations to perform in finding a solution. Default is 100. raise_exceptions: bool, optional Flag to raise an exception when the irr cannot be computed due to either having all cashflows of the same sign (NoRealSolutionException) or having reached the maximum number of iterations (IterationsExceededException). Set to False as default, thus returning NaNs in the two previous cases.
Returns ------- out : float Internal Rate of Return for periodic input values.
Notes ----- The IRR is perhaps best understood through an example (illustrated using np.irr in the Examples section below). Suppose one invests 100 units and then makes the following withdrawals at regular (fixed) intervals: 39, 59, 55, 20. Assuming the ending value is 0, one's 100 unit investment yields 173 units; however, due to the combination of compounding and the periodic withdrawals, the "average" rate of return is neither simply 0.73/4 nor (1.73)^0.25-1. Rather, it is the solution (for :math:`r`) of the equation:
.. math:: -100 + \\frac{39}{1+r} + \\frac{59}{(1+r)^2} + \\frac{55}{(1+r)^3} + \\frac{20}{(1+r)^4} = 0
In general, for `values` :math:`= [v_0, v_1, ... v_M]`, irr is the solution of the equation: [G]_
.. math:: \\sum_{t=0}^M{\\frac{v_t}{(1+irr)^{t}}} = 0
References ---------- .. [G] L. J. Gitman, "Principles of Managerial Finance, Brief," 3rd ed., Addison-Wesley, 2003, pg. 348.
Examples -------- >>> import numpy_financial as npf
>>> round(npf.irr([-100, 39, 59, 55, 20]), 5) 0.28095 >>> round(npf.irr([-100, 0, 0, 74]), 5) -0.0955 >>> round(npf.irr([-100, 100, 0, -7]), 5) -0.0833 >>> round(npf.irr([-100, 100, 0, 7]), 5) 0.06206 >>> round(npf.irr([-5, 10.5, 1, -8, 1]), 5) 0.0886
""" values = np.atleast_1d(values) if values.ndim != 1: raise ValueError("Cashflows must be a rank-1 array")
# If all values are of the same sign no solution exists # we don't perform any further calculations and exit early same_sign = np.all(values > 0) if values[0] > 0 else np.all(values < 0) if same_sign: if raise_exceptions: raise NoRealSolutionError('No real solution exists for IRR since all ' 'cashflows are of the same sign.') return np.nan
# If no value is passed for `guess`, then make a heuristic estimate if guess is None: positive_cashflow = values > 0 inflow = values.sum(where=positive_cashflow) outflow = -values.sum(where=~positive_cashflow) guess = inflow / outflow - 1
# We aim to solve eirr such that NPV is exactly zero. This can be framed as # simply finding the closest root of a polynomial to a given initial guess # as follows: # V0 V1 V2 V3 # NPV = ---------- + ---------- + ---------- + ---------- + ... = 0 # (1+eirr)^0 (1+eirr)^1 (1+eirr)^2 (1+eirr)^3 # # by letting g = (1+eirr), we substitute to get # # NPV = V0 * 1/g^0 + V1 * 1/g^1 + V2 * 1/x^2 + V3 * 1/g^3 + ... = 0 # # Multiplying by g^N this becomes # # V0 * g^N + V1 * g^{N-1} + V2 * g^{N-2} + V3 * g^{N-3} + ... = 0 # # which we solve using Newton-Raphson and then reverse out the solution # as eirr = g - 1 (if we are close enough to a solution) npv_ = np.polynomial.Polynomial(values[::-1]) d_npv = npv_.deriv() g = 1 + guess
for _ in range(maxiter): delta = npv_(g) / d_npv(g) if abs(delta) < tol: return g - 1 g -= delta
if raise_exceptions: raise IterationsExceededError('Maximum number of iterations exceeded.')
return np.nan
@nb.njitdef _npv_native(rates, values, out): for i in range(rates.shape[0]): for j in range(values.shape[0]): acc = 0.0 for t in range(values.shape[1]): if rates[i] == -1.0: acc = np.nan break else: acc += values[j, t] / ((1.0 + rates[i]) ** t) out[i, j] = acc
def npv(rate, values): r"""Return the NPV (Net Present Value) of a cash flow series.
Parameters ---------- rate : scalar or array_like shape(K, ) The discount rate. values : array_like, shape(M, ) or shape(M, N) The values of the time series of cash flows. The (fixed) time interval between cash flow "events" must be the same as that for which `rate` is given (i.e., if `rate` is per year, then precisely a year is understood to elapse between each cash flow event). By convention, investments or "deposits" are negative, income or "withdrawals" are positive; `values` must begin with the initial investment, thus `values[0]` will typically be negative.
Returns ------- out : float or array shape(K, M) The NPV of the input cash flow series `values` at the discount `rate`. `out` follows the ufunc convention of returning scalars instead of single element arrays.
Warnings -------- ``npv`` considers a series of cashflows starting in the present (t = 0). NPV can also be defined with a series of future cashflows, paid at the end, rather than the start, of each period. If future cashflows are used, the first cashflow `values[0]` must be zeroed and added to the net present value of the future cashflows. This is demonstrated in the examples.
Notes ----- Returns the result of: [G]_
.. math :: \\sum_{t=0}^{M-1}{\\frac{values_t}{(1+rate)^{t}}}
References ---------- .. [G] L. J. Gitman, "Principles of Managerial Finance, Brief," 3rd ed., Addison-Wesley, 2003, pg. 346.
Examples -------- >>> import numpy as np >>> import numpy_financial as npf
Consider a potential project with an initial investment of $40 000 and projected cashflows of $5 000, $8 000, $12 000 and $30 000 at the end of each period discounted at a rate of 8% per period. To find the project's net present value:
>>> rate, cashflows = 0.08, [-40_000, 5_000, 8_000, 12_000, 30_000] >>> np.round(npf.npv(rate, cashflows), 5) 3065.22267
It may be preferable to split the projected cashflow into an initial investment and expected future cashflows. In this case, the value of the initial cashflow is zero and the initial investment is later added to the future cashflows net present value:
>>> initial_cashflow = cashflows[0] >>> cashflows[0] = 0 >>> np.round(npf.npv(rate, cashflows) + initial_cashflow, 5) 3065.22267
The NPV calculation may be applied to several ``rates`` and ``cashflows`` simulatneously. This produces an array of shape ``(len(rates), len(cashflows))``. >>> rates = [0.00, 0.05, 0.10] >>> cashflows = [[-4_000, 500, 800], [-5_000, 600, 900]] >>> npf.npv(rates, cashflows).round(2) array([[-2700. , -3500. ], [-2798.19, -3612.24], [-2884.3 , -3710.74]])
""" values_inner = np.atleast_2d(values) rate_inner = np.atleast_1d(rate)
if rate_inner.ndim != 1: msg = "invalid shape for rates. Rate must be either a scalar or 1d array" raise ValueError(msg)
if values_inner.ndim != 2: msg = "invalid shape for values. Values must be either a 1d or 2d array" raise ValueError(msg)
output_shape = _get_output_array_shape(rate_inner, values_inner) out = np.empty(output_shape) _npv_native(rate_inner, values_inner, out) return _ufunc_like(out)
def mirr(values, finance_rate, reinvest_rate, *, raise_exceptions=False): r""" Return the Modified Internal Rate of Return (MIRR).
MIRR is a financial metric that takes into account both the cost of the investment and the return on reinvested cash flows. It is useful for evaluating the profitability of an investment with multiple cash inflows and outflows.
Parameters ---------- values : array_like Cash flows, where the first value is considered a sunk cost at time zero. It must contain at least one positive and one negative value. finance_rate : scalar Interest rate paid on the cash flows. reinvest_rate : scalar Interest rate received on the cash flows upon reinvestment. raise_exceptions: bool, optional Flag to raise an exception when the MIRR cannot be computed due to having all cash flows of the same sign (NoRealSolutionException). Set to False as default,thus returning NaNs in the previous case.
Returns ------- out : float Modified internal rate of return
Notes ----- The MIRR formula is as follows:
.. math::
MIRR = \\left( \\frac{{FV_{positive}}}{{PV_{negative}}} \\right)^{\\frac{{1}}{{n-1}}} * (1+r) - 1
where: - \(FV_{positive}\) is the future value of positive cash flows, - \(PV_{negative}\) is the present value of negative cash flows, - \(n\) is the number of periods. - \(r\) is the reinvestment rate.
Examples -------- >>> import numpy_financial as npf
Consider a project with an initial investment of -$100 and projected cash flows of $50, -$60, and $70 at the end of each period. The project has a finance rate of 10% and a reinvestment rate of 12%.
>>> npf.mirr([-100, 50, -60, 70], 0.10, 0.12) -0.03909366594356467
Now, let's consider the scenario where all cash flows are negative.
>>> npf.mirr([-100, -50, -60, -70], 0.10, 0.12) nan
Finally, let's explore the situation where all cash flows are positive, and the `raise_exceptions` parameter is set to True.
>>> npf.mirr([ ... 100, 50, 60, 70], ... 0.10, 0.12, ... raise_exceptions=True ... ) #doctest: +NORMALIZE_WHITESPACE Traceback (most recent call last): ... numpy_financial._financial.NoRealSolutionError: No real solution exists for MIRR since all cashflows are of the same sign. """ values = np.asarray(values) n = values.size
# Without this explicit cast the 1/(n - 1) computation below # becomes a float, which causes TypeError when using Decimal # values. if isinstance(finance_rate, Decimal): n = Decimal(n)
pos = values > 0 neg = values < 0 if not (pos.any() and neg.any()): if raise_exceptions: raise NoRealSolutionError('No real solution exists for MIRR since' ' all cashflows are of the same sign.') return np.nan numer = np.abs(npv(reinvest_rate, values * pos)) denom = np.abs(npv(finance_rate, values * neg)) return (numer / denom) ** (1 / (n - 1)) * (1 + reinvest_rate) - 1123456#!/bin/shset -eumkdir -p -- /workspace/benchmarkscp /solution/reference/benchmarks/benchmarks.py /workspace/benchmarks/benchmarks.pymkdir -p -- /workspace/numpy_financialcp /solution/reference/numpy_financial/_financial.py /workspace/numpy_financial/_financial.py123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226schema_version = "1.3"
[task]name = "repo2rlenv/tasksmith-a7e859277e7a"
[metadata.repo2env]recipe = "tasksmith"recipe_version = "1"source_url = "https://github.com/numpy/numpy-financial/pull/108"source_head = "6b54195dadf216a7cb0e90238bdc4be042b06b1c"source_base = "68960080799bad56c7c563497048051f97717f30"workspace_strategy = "head_minus_source_patch"source_diff_sha256 = "484414d0104267015b5bc89907d8cfe83ef316867ed2f0ac5958bf730a7fcdad"acceptance_profile = "practical-generation-v1"upstream_test_policy = "retain"reward_kinds = [ "test_execution",]quality_status = "exported"fail_to_pass_count = 9pass_to_pass_count = 3tracked_files = [ "environment/Dockerfile", "environment/source/.github/CODE_OF_CONDUCT.md", "environment/source/.github/ISSUE_TEMPLATE/bug-report.yml", "environment/source/.github/ISSUE_TEMPLATE/config.yml", "environment/source/.github/ISSUE_TEMPLATE/documentation.yml", "environment/source/.github/ISSUE_TEMPLATE/feature-request.yml", "environment/source/.github/workflows/lint.yml", "environment/source/.github/workflows/publish_docs_to_pages.yml", "environment/source/.github/workflows/pythonpackage.yml", "environment/source/Dockerfile", "environment/source/LICENSE.txt", "environment/source/README.md", "environment/source/benchmarks/__init__.py", "environment/source/benchmarks/benchmarks.py", "environment/source/doc/Makefile", "environment/source/doc/make.bat", "environment/source/doc/source/_static/numpy_financial_favicon.png", "environment/source/doc/source/_static/numpy_financial_logov.svg", "environment/source/doc/source/conf.py", "environment/source/doc/source/dev/building_with_poetry.md", "environment/source/doc/source/dev/getting_the_code.md", "environment/source/doc/source/dev/running_the_benchmarks.md", "environment/source/doc/source/fv.rst", "environment/source/doc/source/generate_rst_function_files.py", "environment/source/doc/source/index.rst", "environment/source/doc/source/ipmt.rst", "environment/source/doc/source/irr.rst", "environment/source/doc/source/mirr.rst", "environment/source/doc/source/nper.rst", "environment/source/doc/source/npv.rst", "environment/source/doc/source/pmt.rst", "environment/source/doc/source/ppmt.rst", "environment/source/doc/source/pv.rst", "environment/source/doc/source/rate.rst", "environment/source/doc/source/release-notes.rst", "environment/source/docweb/README.txt", "environment/source/docweb/css/home.css", "environment/source/docweb/images/numpy_financial_favicon.png", "environment/source/docweb/images/numpy_financial_logoh.svg", "environment/source/docweb/index.html", "environment/source/numpy_financial/__init__.py", "environment/source/numpy_financial/_financial.py", "environment/source/pyproject.toml", "solution/reference/benchmarks/benchmarks.py", "solution/reference/numpy_financial/_financial.py", "solution/solve.sh", "tests/Dockerfile", "tests/contract.json", "tests/grade.py", "tests/source/.github/CODE_OF_CONDUCT.md", "tests/source/.github/ISSUE_TEMPLATE/bug-report.yml", "tests/source/.github/ISSUE_TEMPLATE/config.yml", "tests/source/.github/ISSUE_TEMPLATE/documentation.yml", "tests/source/.github/ISSUE_TEMPLATE/feature-request.yml", "tests/source/.github/workflows/lint.yml", "tests/source/.github/workflows/publish_docs_to_pages.yml", "tests/source/.github/workflows/pythonpackage.yml", "tests/source/.gitignore", "tests/source/Dockerfile", "tests/source/LICENSE.txt", "tests/source/README.md", "tests/source/asv.conf.json", "tests/source/benchmarks/__init__.py", "tests/source/benchmarks/benchmarks.py", "tests/source/doc/Makefile", "tests/source/doc/make.bat", "tests/source/doc/source/_static/numpy_financial_favicon.png", "tests/source/doc/source/_static/numpy_financial_logov.svg", "tests/source/doc/source/conf.py", "tests/source/doc/source/dev/building_with_poetry.md", "tests/source/doc/source/dev/getting_the_code.md", "tests/source/doc/source/dev/running_the_benchmarks.md", "tests/source/doc/source/fv.rst", "tests/source/doc/source/generate_rst_function_files.py", "tests/source/doc/source/index.rst", "tests/source/doc/source/ipmt.rst", "tests/source/doc/source/irr.rst", "tests/source/doc/source/mirr.rst", "tests/source/doc/source/nper.rst", "tests/source/doc/source/npv.rst", "tests/source/doc/source/pmt.rst", "tests/source/doc/source/ppmt.rst", "tests/source/doc/source/pv.rst", "tests/source/doc/source/rate.rst", "tests/source/doc/source/release-notes.rst", "tests/source/docweb/README.txt", "tests/source/docweb/css/home.css", "tests/source/docweb/images/numpy_financial_favicon.png", "tests/source/docweb/images/numpy_financial_logoh.svg", "tests/source/docweb/index.html", "tests/source/numpy_financial/__init__.py", "tests/source/numpy_financial/_financial.py", "tests/source/pyproject.toml", "tests/source/tests/__init__.py", "tests/source/tests/tasksmith_behavior.py", "tests/source/tests/test_financial.py", "tests/test.sh", "tests/test_driver.py", "tests/test_results.py",]executable_files = [ "solution/solve.sh", "tests/test.sh",]bundle_hash = "sha256:5555bab1d34b5856c8d7248c1f7705f8b87d03c21f5ddd9aaa522e4b3cc98fe7"
[metadata.repo2env.evaluation]schema_version = "1"status = "verified"stage = "complete"reason_codes = [ "quality_verified",]detail = "Reviewed controls, semantic probes and blind rollout passed the quality profile."checked_at = "2026-11-20T08:51:20.293964Z"provenance = "unknown"subject_bundle_hash = "sha256:5555bab1d34b5856c8d7248c1f7705f8b87d03c21f5ddd9aaa522e4b3cc98fe7"profile = "evidence-review-v2"source_task_path = "/Users/ben/.t3/projects/harness-adapters-data/runs/apex-agents-gap/phase2/batch/candidates/abec33f28a9f/candidates/a7e859277e7a/quality/revisions/r0/tasksmith-a7e859277e7a"source_task_toml_sha256 = "e7d7e762aae6e7f50bf52ad35a3415d97b7b90173749755e7b9f013038b8918f"
[[metadata.repo2env.evaluation.evidence]]kind = "quality_result"path = "/Users/ben/.t3/projects/harness-adapters-data/runs/apex-agents-gap/phase2/batch/candidates/abec33f28a9f/candidates/a7e859277e7a/quality/result.json"sha256 = "9c9daf5f84e1215481be46b3d906594d52a87c7c955091f8e1a1471189957fbf"subject_bundle_hash = "sha256:5555bab1d34b5856c8d7248c1f7705f8b87d03c21f5ddd9aaa522e4b3cc98fe7"
[[metadata.repo2env.evaluation.evidence]]kind = "baseline"path = "/Users/ben/.t3/projects/harness-adapters-data/runs/apex-agents-gap/phase2/batch/candidates/abec33f28a9f/candidates/a7e859277e7a/quality/trials/r0-baseline/tsbatch-195cc094e760-abec33f28a9f-q-a7e85927-r0-baseline/tasksmith-a7e859277e7a__PhjDxM2/result.json"sha256 = "316ab4334889c85afcf1ce2cc2438d1aa78e5d30427286206369bfbd001ee0f4"subject_bundle_hash = "sha256:5555bab1d34b5856c8d7248c1f7705f8b87d03c21f5ddd9aaa522e4b3cc98fe7"harbor_task_checksum = "23d7489f6910f577e46d7b27371c8fed06f8138172cc75315b03e6f2a086ed21"
[[metadata.repo2env.evaluation.evidence]]kind = "oracle"path = "/Users/ben/.t3/projects/harness-adapters-data/runs/apex-agents-gap/phase2/batch/candidates/abec33f28a9f/candidates/a7e859277e7a/quality/trials/r0-oracle/tsbatch-195cc094e760-abec33f28a9f-q-a7e85927-r0-oracle/tasksmith-a7e859277e7a__b3oEZJF/result.json"sha256 = "28b08ef41fe31d18c572fc389d4cfd62c5697e3c4d9ab7acb8df461193a02380"subject_bundle_hash = "sha256:5555bab1d34b5856c8d7248c1f7705f8b87d03c21f5ddd9aaa522e4b3cc98fe7"harbor_task_checksum = "23d7489f6910f577e46d7b27371c8fed06f8138172cc75315b03e6f2a086ed21"
[[metadata.repo2env.evaluation.evidence]]kind = "probe"path = "/Users/ben/.t3/projects/harness-adapters-data/runs/apex-agents-gap/phase2/batch/candidates/abec33f28a9f/candidates/a7e859277e7a/quality/trials/r0-probe0/tsbatch-195cc094e760-abec33f28a9f-q-a7e85927-r0-probe0/tasksmith-a7e859277e7a__XA3QBFN/result.json"sha256 = "465fe1b6f8885bb3ec3f569b793c6f807cfd9c57049bb2c064b0c3ae5346d6cf"subject_bundle_hash = "sha256:17e651606673a8cbcd967907d56b5ecf6b13343c1cbe64ec93f361a3e87568fa"harbor_task_checksum = "f36345ed8cf96a20703e4e72fe4f49b948dbae0d8d9d83ee5e3bcc6393a6789d"
[[metadata.repo2env.evaluation.evidence]]kind = "probe"path = "/Users/ben/.t3/projects/harness-adapters-data/runs/apex-agents-gap/phase2/batch/candidates/abec33f28a9f/candidates/a7e859277e7a/quality/trials/r0-probe1/tsbatch-195cc094e760-abec33f28a9f-q-a7e85927-r0-probe1/tasksmith-a7e859277e7a__DyGRRoP/result.json"sha256 = "a668473c46dcbf0412e4a274ca80301f995c4c0d37b5e5ea2b0a891c8194ecef"subject_bundle_hash = "sha256:02e509deecac50d60168c13cb2195a966ed5bda9303aeb8d3a0dc94300964571"harbor_task_checksum = "baacfaffd5bab7a849cb8f2c5fdb3ded6f8bf708058171b3568d1e094924634e"
[[metadata.repo2env.evaluation.evidence]]kind = "rollout"path = "/Users/ben/.t3/projects/harness-adapters-data/runs/apex-agents-gap/phase2/batch/candidates/abec33f28a9f/candidates/a7e859277e7a/quality/trials/r0-rollout/tsbatch-195cc094e760-abec33f28a9f-q-a7e85927-r0-rollout/tasksmith-a7e859277e7a__RyeHJuX/result.json"sha256 = "0439947b3add72f8781322759173cee583335a01d336c78d683f2df3631ed05f"subject_bundle_hash = "sha256:5555bab1d34b5856c8d7248c1f7705f8b87d03c21f5ddd9aaa522e4b3cc98fe7"harbor_task_checksum = "23d7489f6910f577e46d7b27371c8fed06f8138172cc75315b03e6f2a086ed21"
[metadata.repo2env.quality_requirements]probe_focus = [ "general",]
[environment]cpus = 1memory_mb = 2048build_timeout_sec = 600network_mode = "no-network"
[agent]timeout_sec = 600user = "learner"network_mode = "no-network"
[verifier]timeout_sec = 210user = "root"network_mode = "no-network"environment_mode = "separate"
[verifier.environment]network_mode = "no-network"cpus = 2memory_mb = 2048
[[artifacts]]source = "/workspace/numpy_financial"exclude = [ "__pycache__", "*.pyc", ".pytest_cache",]
[[artifacts]]source = "/workspace/benchmarks/benchmarks.py"exclude = [ "__pycache__", "*.pyc", ".pytest_cache",]12345678910FROM python:3.12-slimWORKDIR /workspaceRUN python -m pip install --no-cache-dir poetry-core==1.9.1 numba==0.68.1 llvmlite==0.50.0 numpy==2.5.5 pytest==8.3.5 'hypothesis[numpy]==6.99.11' 'pytest-xdist[psutil]==3.5.0'COPY source /workspaceRUN python -m pip install --no-cache-dir -e .ENV PYTHONDONTWRITEBYTECODE=1 PYTEST_DISABLE_PLUGIN_AUTOLOAD=1ENV HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=1 HF_DATASETS_OFFLINE=1RUN useradd -m -u 1001 graderCOPY grade.py test_driver.py test_results.py contract.json test.sh /tests/RUN chmod 755 /tests && chmod 644 /tests/*1{"expected_passes": ["tests.tasksmith_behavior::test_npv_broadcasting_shape_and_values", "tests.tasksmith_behavior::test_npv_multiple_rates_single_cashflow_returns_1d", "tests.test_financial.TestNpv::test_fuzz", "tests.test_financial.TestNpv::test_invalid_cashflows_shape[cf0]", "tests.test_financial.TestNpv::test_invalid_cashflows_shape[cf1]", "tests.test_financial.TestNpv::test_invalid_rates_shape[rates0]", "tests.test_financial.TestNpv::test_invalid_rates_shape[rates1]", "tests.test_financial.TestNpv::test_rate_of_negative_one_returns_nan[-1.0]", "tests.test_financial.TestNpv::test_rate_of_negative_one_returns_nan[-1]", "tests.tasksmith_behavior::test_npv_scalar_rate_1d_cashflow_returns_scalar", "tests.tasksmith_behavior::test_npv_single_rate_multiple_cashflows_returns_1d", "tests.test_financial.TestNpv::test_npv"], "immutable_assets": {}, "optional_files": [], "pytest_args": [], "submitted_files": ["benchmarks/benchmarks.py", "numpy_financial/__init__.py", "numpy_financial/_financial.py"], "submitted_roots": ["numpy_financial"], "test_paths": ["tests/test_financial.py::TestNpv", "tests/tasksmith_behavior.py"], "timeout_sec": 180}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196"""Standalone trusted entry point; copied into each separate verifier image.
No Repo2RLEnv installation is needed to grade an exported task. Submitted Pythonruns as an unprivileged user; this parent owns the result parser and reward file."""
from __future__ import annotations
import hashlibimport importlib.utilimport jsonimport osimport signalimport statimport subprocessimport sysimport tempfilefrom pathlib import Path
def child_environment(temporary: str) -> dict[str, str]: """Preserve prepared runtime assets without inheriting controller credentials.""" return { **{ key: os.environ[key] for key in ( "LD_LIBRARY_PATH", "CUDA_VISIBLE_DEVICES", "NVIDIA_VISIBLE_DEVICES", "NVIDIA_DRIVER_CAPABILITIES", "NCCL_SOCKET_IFNAME", "GLOO_SOCKET_IFNAME", "HF_HOME", "HF_HUB_CACHE", "HF_HUB_OFFLINE", "TRANSFORMERS_OFFLINE", "HF_DATASETS_OFFLINE", ) if key in os.environ }, "PATH": str(Path(sys.executable).parent) + ":/usr/local/bin:/usr/bin:/bin", "HOME": temporary, "PYTHONDONTWRITEBYTECODE": "1", "PYTEST_DISABLE_PLUGIN_AUTOLOAD": "1", }
def validate_submission(workspace: Path, contract: dict) -> None: """Validate private staging and remove inert backups before importing Python.""" submitted = set(contract["submitted_files"]) backups: set[str] = set() optional = submitted & set(contract.get("optional_files", [])) paths = submitted - optional for relative in optional: path = workspace / relative if any(component.is_symlink() for component in (path, *path.parents)): raise ValueError("Submitted source contains a symlink") # Added standalone modules may be absent in the baseline. If supplied, # apply the same regular-file and size checks as every required module. if path.exists(): paths.add(relative) roots = contract.get("submitted_roots", []) immutable = contract.get("immutable_assets", {}) paths.update(immutable) for relative in roots: root = workspace / relative if root.is_symlink() or not root.is_dir(): raise ValueError("Submitted source root is missing or linked") for path in root.rglob("*"): if path.is_symlink(): raise ValueError("Submitted source contains a symlink") if path.is_dir(): continue name = path.relative_to(workspace).as_posix() if path.suffix != ".py" and name not in immutable: if name not in submitted and path.name.endswith((".py.bak", ".py~")): backups.add(name) else: raise ValueError("Only Python source files may be added") paths.add(name) for relative in sorted(paths): path = workspace / relative for component in (path, *path.parents): if component.is_symlink(): raise ValueError("Submitted source contains a symlink") if ( not path.is_file() or not stat.S_ISREG(path.stat().st_mode) or path.stat().st_size > 8 * 1024 * 1024 ): raise ValueError("Submitted source is not a bounded regular file") if ( relative in immutable and hashlib.sha256(path.read_bytes()).hexdigest() != immutable[relative] ): raise ValueError("Non-Python source assets must remain unchanged") if relative not in backups: # os.chown doesn't exist on Windows. This module only ever runs for # real inside the Linux verifier container (every other path here # is an absolute container path); the guard exists so the tests # that call validate_submission() directly can run on a Windows # host without touching real container-only ownership semantics. if sys.platform != "win32": os.chown(path, 0, 0) path.chmod(0o644) # Only the verifier's collected copy is cleaned. The learner workspace and # archived submission retain their bytes. Validate every path first so a # backup cannot bypass linked, oversized, required, or immutable file checks. for relative in sorted(backups): (workspace / relative).unlink()
def main() -> None: directory = Path("/tests") parser_spec = importlib.util.spec_from_file_location( "test_results", directory / "test_results.py" ) parser = importlib.util.module_from_spec(parser_spec) sys.modules[parser_spec.name] = parser parser_spec.loader.exec_module(parser) contract = json.loads((directory / "contract.json").read_text()) logs = Path("/logs/verifier") logs.mkdir(parents=True, exist_ok=True) logs.chmod(0o755) reward = logs / "reward.txt" reward.write_text("0\n") reward.chmod(0o644) try: validate_submission(Path("/workspace"), contract) except (ValueError, OSError) as exc: (logs / "result.json").write_text(json.dumps({"passed": False, "reason": str(exc)})) return with tempfile.TemporaryDirectory(prefix="r2e-grade-") as temporary: working = Path(temporary) if sys.platform != "win32": # os.chown doesn't exist on Windows; see above os.chown(working, 1001, 1001) working.chmod(0o700) report = working / "results.xml" command = [ sys.executable, "-I", "/tests/test_driver.py", *contract["test_paths"], *contract.get("pytest_args", []), "-q", "--tb=short", "-p", "no:cacheprovider", f"--junitxml={report}", ] with (logs / "stdout.txt").open("w") as stdout, (logs / "stderr.txt").open("w") as stderr: process = subprocess.Popen( command, cwd="/workspace", stdout=stdout, stderr=stderr, user=1001, group=1001, extra_groups=[], start_new_session=True, env=child_environment(temporary), ) try: code = process.wait(timeout=contract["timeout_sec"]) finally: # Terminate descendants too: they must not keep modifying the # child-owned report while the trusted parent checks it. try: os.killpg(process.pid, signal.SIGKILL) except ProcessLookupError: pass process.wait() if report.is_symlink() or not report.is_file() or report.stat().st_size > 16 * 1024 * 1024: (logs / "result.json").write_text( json.dumps({"passed": False, "returncode": code, "reason": "invalid_report"}) ) return text = report.read_text() (logs / "results.xml").write_text(text) try: parsed = parser.parse_junit(text, returncode=code) except ValueError as exc: (logs / "result.json").write_text( json.dumps({"passed": False, "returncode": code, "reason": str(exc)}) ) return expected = set(contract["expected_passes"]) passed = code == 0 and bool(expected) and parsed.passed == expected (logs / "result.json").write_text( json.dumps({"passed": passed, "returncode": code, "statuses": parsed.statuses}) ) reward.write_text("1\n" if passed else "0\n")
if __name__ == "__main__": main()123456789All NumPy-Financial participants are expected to honor the NumPy Code of Conduct.
This code of conduct applies to all spaces managed by the NumPy project, including all public and private mailing lists, issue trackers, wikis, blogs, Twitter, and any other communication channel used by our community. The NumPy project does not organise in-person events, however events related to our community should have a code of conduct similar in spirit to this one.
This code of conduct should be honored by everyone who participates in the NumPy community formally or informally, or claims any affiliation with the project, in any project-related activities and especially when representing the project, in any role.
This code is not exhaustive or complete. It serves to distill our common understanding of a collaborative, shared environment and goals. Please try to follow this code in spirit as much as in letter, to create a friendly and productive environment that enriches the surrounding community.
To view the full Code of Conduct, please see: https://numpy.org/code-of-conduct/123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263name: Bug reportdescription: Report a bug. For security vulnerabilities see Report a security vulnerability in the templates.title: "BUG: <Please write a comprehensive title after the 'BUG: ' prefix>"labels: [00 - Bug]
body:- type: markdown attributes: value: > Thank you for taking the time to file a bug report. Before creating a new issue, please make sure to take a few minutes to check the issue tracker for existing issues about the bug.
- type: textarea attributes: label: "Describe the issue:" validations: required: true
- type: textarea attributes: label: "Reproduce the code example:" description: > A short code example that reproduces the problem/missing feature. It should be self-contained, i.e., can be copy-pasted into the Python interpreter or run as-is via `python myproblem.py`. placeholder: | import numpy_financial as npf << your code here >> render: python validations: required: true
- type: textarea attributes: label: "Error message:" description: > Please include full error message, if any. If you are reporting a segfault please include a GDB traceback, which you can generate by following [these instructions](https://github.com/numpy/numpy/blob/main/doc/source/dev/development_environment.rst#debugging). placeholder: | << Full traceback starting from `Traceback: ...` >> render: shell
- type: textarea attributes: label: "Runtime information:" description: > Output from `import sys, numpy; print(numpy.__version__); print(sys.version)` If you are running NumPy 1.24+, also show `print(numpy.show_runtime())` validations: required: true
- type: textarea attributes: label: "Context for the issue:" description: | Please explain how this issue affects your work or why it should be prioritized. placeholder: | << your explanation here >> validations: required: false1234567contact_links: - name: Question/Help/Support url: https://numpy.org/gethelp/ about: "If you have a question, please look at the listed resources available on the website." - name: Development-related matters url: https://numpy.org/community/ about: "If you would like to discuss development-related matters or need help from the NumPy team, see our community's communication channels."1234567891011121314151617181920212223name: Documentationdescription: Report an issue related to the NumPy-Financial documentation.title: "DOC: <Please write a comprehensive title after the 'DOC: ' prefix>"labels: [04 - Documentation]
body:- type: textarea attributes: label: "Issue with current documentation:" description: > Please make sure to leave a reference to the document/code you're referring to. You can also check the development version of the documentation and see if this issue has already been addressed at https://numpy.org/devdocs.
- type: textarea attributes: label: "Idea or request for content:" description: > Please describe as clearly as possible what topics you think are missing from the current documentation. Make sure to check https://github.com/numpy/numpy-tutorials and see if this issue might be more appropriate there.12345678910111213141516171819202122name: Feature requestdescription: Check instructions for submitting your idea on the mailing list first.title: "ENH: <Please write a comprehensive title after the 'ENH: ' prefix>"
body:- type: markdown attributes: value: > If you're looking to request a new feature or change in functionality, including adding or changing the meaning of arguments to an existing function, please post your idea on the [numpy-discussion mailing list](https://mail.python.org/mailman/listinfo/numpy-discussion) to explain your reasoning in addition to opening an issue or pull request. You can also check out our [Contributor Guide](https://github.com/numpy/numpy/blob/main/doc/source/dev/index.rst) if you need more information.
- type: textarea attributes: label: "Proposed new feature or change:" validations: required: true1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253name: Lint
on: push: branches: - "*" pull_request: branches: - main
permissions: contents: read # to fetch code (actions/checkout)
concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true
jobs: test_lint: name: Lint # If using act to run CI locally the github object does not exist and the usual skipping should not be enforced if: "github.repository == 'numpy/numpy-financial' || github.repository == ''" runs-on: ubuntu-22.04 strategy: matrix: python-version: ['3.11']
steps: - uses: actions/checkout@v3 with: fetch-depth: 0 submodules: recursive
- name: Setup Python uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }}
- name: Install Python packages run: | python -m pip install --upgrade pip poetry poetry env use ${{ matrix.python-version }} poetry install --with=lint
- name: Lint with Ruff run: | set -euo pipefail # Tell us what version we are using poetry run ruff version # Check the source file, ignore type annotations (ANN) for now. poetry run ruff check numpy_financial/ --ignore F403 --select E,F,B,I # Check the test and benchmark files poetry run ruff check tests/ benchmarks/ --select E,F,B,I12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576name: Publish docs to gh-pages
on: push: branches: - master
jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - uses: actions/setup-python@v1 with: python-version: '3.7' - name: Install dependencies run: | export DEBIAN_FRONTEND=noninteractive sudo apt-get -q -y install dvipng texlive-latex-extra python -m pip install --upgrade pip pip install -r requirements.txt pip install sphinx pip install numpydoc - name: Install numpy-financial run: | pip install . - name: Build documentation with Sphinx run: | cd doc make html mv build/html /tmp cd .. - name: Deploy to gh-pages branch env: GH_ACTION_PAGES_DEPLOY_KEY: ${{ secrets.GH_ACTION_PAGES_DEPLOY_KEY }} run: | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Set up SSH key # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - mkdir -p ~/.ssh/ echo "$GH_ACTION_PAGES_DEPLOY_KEY" > ~/.ssh/id_rsa chmod 600 ~/.ssh/id_rsa ssh-keyscan github.com >> ~/.ssh/known_hosts # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Reconfigure the git remote to use SSH # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - git remote rm origin git remote add origin git@github.com:numpy/numpy-financial.git # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Configure the git user # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - git config user.name "${GITHUB_ACTOR}" git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Go to work on gh-pages... # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - echo "Fetching gh-pages" git fetch origin gh-pages echo "Checking out gh-pages branch" git checkout gh-pages echo "Removing old dev documentation" git clean -xdf . cd dev git rm -r '*' cd .. echo "Committing emptied dev directory" git commit -m "Remove old dev documentation" mkdir dev cd dev echo "Copying /tmp/html here" cp -v -r /tmp/html/* . echo "Adding new dev documentation" git add -A . git commit -m "Add new dev documentation" echo "Pushing new documentation to origin" git push -v origin gh-pages12345678910111213141516171819202122232425name: Python package
on: [push, pull_request]
jobs: build: runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] python-version: ["3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | python -m pip install --upgrade pip poetry poetry env use ${{ matrix.python-version }} poetry install --with=test - name: Test with pytest run: | poetry run pytest --doctest-modules123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113# Editor temporary/working/backup files ##########################################.#*[#]*#*~*$*.bak*.diff.idea/*.iml*.ipr*.iws*.org.projectpmip*.rej.settings/.*.sw[nop].sw[nop]*.tmp*.vim.vscodetagscscope.out# gnu globalGPATHGRTAGSGSYMSGTAGS.cache
# Compiled source ####################*.a*.com*.class*.dll*.exe*.o*.o.d*.py[ocd]*.so
# Packages ############## it's better to unpack these files and commit the raw source# git has its own built in compression methods*.7z*.bz2*.bzip2*.dmg*.gz*.iso*.jar*.rar*.tar*.tbz2*.tgz*.zip
# Python files ################## setup.py working directorybuild# sphinx build directory_build# setup.py dist directorydistdoc/builddoc/cdoc/build# Egg metadata*.egg-info# The shelf plugin uses this dir./.shelfMANIFEST.cache
# Paver generated files ##########################/release
# Logs and databases #######################*.log*.sql*.sqlite
# Patches ############*.patch*.diff
# OS generated files #######################.DS_Store*.VolumeIcon.icns.fseventsdIcon?.gdb_historyehthumbs.dbThumbs.db.directory
# pytest generated files ###########################/.pytest_cache
# Poetry lock file #####################poetry.lock
# Things specific to this project ####################################12345678FROM python:3.12-slimWORKDIR /workspaceRUN python -m pip install --no-cache-dir poetry-core==1.9.1 numba==0.68.1 llvmlite==0.50.0 numpy==2.5.5 pytest==8.3.5 'hypothesis[numpy]==6.99.11' 'pytest-xdist[psutil]==3.5.0'COPY . /workspaceRUN python -m pip install --no-cache-dir -e .RUN rm -rf /workspace/.git /root/.cache/pipENV PYTHONDONTWRITEBYTECODE=1 PYTEST_DISABLE_PLUGIN_AUTOLOAD=1ENV HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=1 HF_DATASETS_OFFLINE=1123456789101112131415161718192021222324252627282930Copyright (c) 2005-2019, NumPy Developers.All rights reserved.
Redistribution and use in source and binary forms, with or withoutmodification, are permitted provided that the following conditions aremet:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the NumPy Developers nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOTLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FORA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHTOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOTLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANYTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USEOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.123456789101112131415161718192021# NumPy Financial
The `numpy-financial` package contains a collection of elementary financialfunctions.
The [financial functions in NumPy](https://numpy.org/doc/1.17/reference/routines.financial.html)are deprecated and eventually will be removed from NumPy; see[NEP-32](https://numpy.org/neps/nep-0032-remove-financial-functions.html)for more information. This package is the replacement for the originalNumPy financial functions.
The source code for this package is available at https://github.com/numpy/numpy-financial.
The importable name of the package is `numpy_financial`. The recommendedalias is `npf`. For example,
```>>> import numpy_financial as npf>>> npf.irr([-250000, 100000, 150000, 200000, 250000, 300000])0.5672303344358536```123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193{ // The version of the config file format. Do not change, unless // you know what you are doing. "version": 1,
// The name of the project being benchmarked "project": "NumPy-Financial",
// The project's homepage "project_url": "https://numpy.org/numpy-financial//",
// The URL or local path of the source code repository for the // project being benchmarked "repo": ".",
// The Python project's subdirectory in your repo. If missing or // the empty string, the project is assumed to be located at the root // of the repository. // "repo_subdir": "",
// Customizable commands for building the project. // See asv.conf.json documentation. // To build the package using pyproject.toml (PEP518), uncomment the following lines "build_command": [ "python -m pip install build", "python -m build", "PIP_NO_BUILD_ISOLATION=false python -mpip wheel --no-deps --no-index -w {build_cache_dir} {build_dir}" ], // To build the package using setuptools and a setup.py file, uncomment the following lines // "build_command": [ // "python setup.py build", // "PIP_NO_BUILD_ISOLATION=false python -mpip wheel --no-deps --no-index -w {build_cache_dir} {build_dir}" // ],
// Customizable commands for installing and uninstalling the project. // See asv.conf.json documentation. // "install_command": ["in-dir={env_dir} python -mpip install {wheel_file}"], // "uninstall_command": ["return-code=any python -mpip uninstall -y {project}"],
// List of branches to benchmark. If not provided, defaults to "master" // (for git) or "default" (for mercurial). "branches": ["main"],
// The DVCS being used. If not set, it will be automatically // determined from "repo" by looking at the protocol in the URL // (if remote), or by looking for special directories, such as // ".git" (if local). "dvcs": "git",
// The tool to use to create environments. May be "conda", // "virtualenv", "mamba" (above 3.8) // or other value depending on the plugins in use. // If missing or the empty string, the tool will be automatically // determined by looking for tools on the PATH environment // variable. "environment_type": "virtualenv",
// timeout in seconds for installing any dependencies in environment // defaults to 10 min //"install_timeout": 600,
// the base URL to show a commit for the project. // "show_commit_url": "http://github.com/owner/project/commit/",
// The Pythons you'd like to test against. If not provided, defaults // to the current version of Python used to run `asv`. // "pythons": ["2.7", "3.8"],
// The list of conda channel names to be searched for benchmark // dependency packages in the specified order // "conda_channels": ["conda-forge", "defaults"],
// A conda environment file that is used for environment creation. // "conda_environment_file": "environment.yml",
// The matrix of dependencies to test. Each key of the "req" // requirements dictionary is the name of a package (in PyPI) and // the values are version numbers. An empty list or empty string // indicates to just test against the default (latest) // version. null indicates that the package is to not be // installed. If the package to be tested is only available from // PyPi, and the 'environment_type' is conda, then you can preface // the package name by 'pip+', and the package will be installed // via pip (with all the conda available packages installed first, // followed by the pip installed packages). // // The ``@env`` and ``@env_nobuild`` keys contain the matrix of // environment variables to pass to build and benchmark commands. // An environment will be created for every combination of the // cartesian product of the "@env" variables in this matrix. // Variables in "@env_nobuild" will be passed to every environment // during the benchmark phase, but will not trigger creation of // new environments. A value of ``null`` means that the variable // will not be set for the current combination. // // "matrix": { // "req": { // "numpy": ["1.6", "1.7"], // "six": ["", null], // test with and without six installed // "pip+emcee": [""] // emcee is only available for install with pip. // }, // "env": {"ENV_VAR_1": ["val1", "val2"]}, // "env_nobuild": {"ENV_VAR_2": ["val3", null]}, // },
// Combinations of libraries/python versions can be excluded/included // from the set to test. Each entry is a dictionary containing additional // key-value pairs to include/exclude. // // An exclude entry excludes entries where all values match. The // values are regexps that should match the whole string. // // An include entry adds an environment. Only the packages listed // are installed. The 'python' key is required. The exclude rules // do not apply to includes. // // In addition to package names, the following keys are available: // // - python // Python version, as in the *pythons* variable above. // - environment_type // Environment type, as above. // - sys_platform // Platform, as in sys.platform. Possible values for the common // cases: 'linux2', 'win32', 'cygwin', 'darwin'. // - req // Required packages // - env // Environment variables // - env_nobuild // Non-build environment variables // // "exclude": [ // {"python": "3.2", "sys_platform": "win32"}, // skip py3.2 on windows // {"environment_type": "conda", "req": {"six": null}}, // don't run without six on conda // {"env": {"ENV_VAR_1": "val2"}}, // skip val2 for ENV_VAR_1 // ], // // "include": [ // // additional env for python2.7 // {"python": "2.7", "req": {"numpy": "1.8"}, "env_nobuild": {"FOO": "123"}}, // // additional env if run on windows+conda // {"platform": "win32", "environment_type": "conda", "python": "2.7", "req": {"libpython": ""}}, // ],
// The directory (relative to the current directory) that benchmarks are // stored in. If not provided, defaults to "benchmarks" // "benchmark_dir": "benchmarks",
// The directory (relative to the current directory) to cache the Python // environments in. If not provided, defaults to "env" "env_dir": ".asv/env",
// The directory (relative to the current directory) that raw benchmark // results are stored in. If not provided, defaults to "results". "results_dir": ".asv/results",
// The directory (relative to the current directory) that the html tree // should be written to. If not provided, defaults to "html". "html_dir": ".asv/html",
// The number of characters to retain in the commit hashes. // "hash_length": 8,
// `asv` will cache results of the recent builds in each // environment, making them faster to install next time. This is // the number of builds to keep, per environment. // "build_cache_size": 2,
// The commits after which the regression search in `asv publish` // should start looking for regressions. Dictionary whose keys are // regexps matching to benchmark names, and values corresponding to // the commit (exclusive) after which to start looking for // regressions. The default is to start from the first commit // with results. If the commit is `null`, regression detection is // skipped for the matching benchmark. // // "regressions_first_commits": { // "some_benchmark": "352cdf", // Consider regressions only after this commit // "another_benchmark": null, // Skip regression detection altogether // },
// The thresholds for relative change in results, after which `asv // publish` starts reporting regressions. Dictionary of the same // form as in ``regressions_first_commits``, with values // indicating the thresholds. If multiple entries match, the // maximum is taken. If no entry matches, the default is 5%. // // "regressions_thresholds": { // "some_benchmark": 0.01, // Threshold of 1% // "another_benchmark": 0.5, // Threshold of 50% // },}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849from decimal import Decimal
import numpy as np
import numpy_financial as npf
def _to_decimal_array_1d(array): return np.array([Decimal(x) for x in array.tolist()])
def _to_decimal_array_2d(array): decimals = [Decimal(x) for row in array.tolist() for x in row] return np.array(decimals).reshape(array.shape)
class Npv2D:
param_names = ["n_cashflows", "cashflow_lengths", "rates_lengths"] params = [ (1, 10, 100), (1, 10, 100), (1, 10, 100), ]
def __init__(self): self.rates_decimal = None self.rates = None self.cashflows_decimal = None self.cashflows = None
def setup(self, n_cashflows, cashflow_lengths, rates_lengths): rng = np.random.default_rng(0) cf_shape = (n_cashflows, cashflow_lengths) self.cashflows = rng.standard_normal(cf_shape) self.rates = rng.standard_normal(rates_lengths) self.cashflows_decimal = _to_decimal_array_2d(self.cashflows) self.rates_decimal = _to_decimal_array_1d(self.rates)
def time_for_loop(self, n_cashflows, cashflow_lengths, rates_lengths): for rate in self.rates: for cashflow in self.cashflows: npf.npv(rate, cashflow)
def time_for_loop_decimal(self, n_cashflows, cashflow_lengths, rates_lengths): for rate in self.rates_decimal: for cashflow in self.cashflows_decimal: npf.npv(rate, cashflow)
1234567891011121314151617181920# Minimal makefile for Sphinx documentation#
# You can set these variables from the command line, and also# from the environment for the first two.SPHINXOPTS ?=SPHINXBUILD ?= sphinx-buildSOURCEDIR = sourceBUILDDIR = build
# Put it first so that "make" without argument is like "make help".help: @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).%: Makefile @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)1234567891011121314151617181920212223242526272829303132333435@ECHO OFF
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build
if "%1" == "" goto help
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
:end
popd12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667# Configuration file for the Sphinx documentation builder.## This file only contains a selection of the most common options. For a full# list see the documentation:# https://www.sphinx-doc.org/en/master/usage/configuration.html
import numpy_financial
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,# add these directories to sys.path here. If the directory is relative to the# documentation root, use os.path.abspath to make it absolute, like shown here.## import os# import sys# sys.path.insert(0, os.path.abspath('.'))
# -- Project information -----------------------------------------------------
project = 'numpy-financial'copyright = '2023, numpy-financial developers'author = 'numpy-financial developers'
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom# ones.extensions = [ 'sphinx.ext.autodoc', 'numpydoc', 'sphinx.ext.mathjax', 'myst_parser',]
# Add any paths that contain templates here, relative to this directory.templates_path = ['_templates']
# List of patterns, relative to source directory, that match files and# directories to ignore when looking for source files.# This pattern also affects html_static_path and html_extra_path.exclude_patterns = []
version = numpy_financial.__version__
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for# a list of builtin themes.#html_theme = 'pydata_sphinx_theme'html_copy_source = False
# Add any paths that contain custom static files (such as style sheets) here,# relative to this directory. They are copied after the builtin static files,# so a file named "default.css" will overwrite the builtin "default.css".html_static_path = ['_static']
html_logo = "_static/numpy_financial_logov.svg"html_favicon = "_static/numpy_financial_favicon.png"
html_sidebars = { '**': ['localtoc.html', 'searchbox.html'],}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667# Building with poetry
## Installing poetrynumpy-financial uses [poetry](https://python-poetry.org/) to manage dependencies, build wheels and sdists, and publish to PyPI this page documentshow to work with poetry.
To install poetry follow their [official guide](https://python-poetry.org/docs/#installing-with-the-official-installer)it is recommended to use the official installer for local development.
To check your installation try to check the version of poetry:
```shellpoetry -V```
## Setting up a virtual environment using poetry
Once poetry is installed it is time to set up the virtual environment. To dothis run:
```shellpoetry install```
``poetry install`` looks for dependencies in the ``pyproject.toml`` file,resolves them to the most recent version and installs the dependenciesin a virtual environment. It is now possible to launch an interactive REPLby running the following command:
```shellpoetry run python```
## Running the test suite
numpy-financial has an extensive test suite, which can be run with thefollowing command:
```shellpoetry run pytest```
## Building distributions
It is possible to manually build distributions for numpy-financial usingpoetry. This is possible via the `build` command:
```shellpoetry build```
The `build` command creates a `dist` directory containing a wheel and sdistfile.
## Publishing to PyPI
poetry provides support to publish packages to PyPI. This is possible usingthe ``publish`` command:
```shellpoetry publish --build --username <your username> --password <your password>```
Note that this builds the package before publishing it. You will need to provide the correct username and password for PyPI.12345678910111213141516171819202122232425262728293031323334353637383940414243# Getting the code
This document explains how to get the source code for NumPy-Financial using Git.
## Code Location
NumPy-Financial is hosted on GitHub. The repository URL is https://github.com/numpy/numpy-financial.
## Creating a fork
To create a fork click the green "fork" button at the top right of the page. This creates a new repository on yourGitHub profile. This will have the URL: https://github.com/<your_username>/numpy-financial.
## Cloning the repository
Now that you have forked the repository you will need to clone it. This copies the repository from GitHub to the localmachine. To clone a repository enter the following commands in the terminal.
```shellgit clone https://github.com/<your_username>/numpy-financial.git```
Hooray! You now have a working copy of NumPy-Financial.
## Updating the code with other's changes
From time to time you may want to pull down the latest code. Do this with:
```shellgit fetch```
The `git fetch` command downloads commits, files and refs from a remote repo into your local repo.
Then run:
```shellgit merge --ff-only```
The `git merge` command is Git's way of putting independent branches back together. The `--ff-only` flag tells git touse `fast-forward` merges. This is preferable as fast-forward merge avoids creating merge commits.12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455# Running the benchmarks
This document outlines how to setup and run the benchmarks using [asv](https://asv.readthedocs.io/en/v0.6.1/).
## Installing asv
`asv` can be installed with poetry via the `bench` group to install the bench group run:
```shellpoetry install --with=bench```
This will install ``asv`` into your poetry environment.
## Running the benchmarks
To run the benchmarks with ``asv``, simply enter:
```shellpoetry run asv run```
## Viewing the results
There are two steps to viewing the results locally. The results need to be published and the launched in a local web browser.
To publish the results use:
```shellpoetry run asv publish```
And then to view the results:
```shellpoetry run asv preview```
This will launch a local web browser from which you can view the results
## Dry runs
One common use case is to use ``asv`` in development, there are several useful flags that should be used:
```shellpoetry run asv --python=same --quick --dry-run```
We are adding three flags, these flags are:
1. `--python=same` uses the same environment as your development environment (saves time to avoid building environments)2. `--quick` only runs the benchmarks once3. `--dry-run` to not save the results of the benchmarks
These can be useful for getting quick feedback during development, but should not be used as anything other than a rough guide.12345678fv==
.. currentmodule:: numpy_financial
.. toctree::
.. autofunction:: fv123456789101112131415161718192021222324252627
# This script was used to generate the rst function stubs# numpy_financial.fv.rst, numpy_financial.ipmt.rst, etc.# It requires that numpy_financial is already installed,# although it could just as easily use a hard-coded list# of function names.
import numpy_financial as nf
def generate_rst_function_files(): names = [name for name in dir(nf) if not name.startswith('_')] for name in names: with open(name + '.rst', 'w') as f: f.write('''{name}{underline}
.. currentmodule:: numpy_financial
.. toctree::
.. autofunction:: {name}'''.format(name=name, underline='='*len(name)))
if __name__ == "__main__": generate_rst_function_files()12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
numpy-financial |version|=========================
The `numpy-financial` package is a collection of elementary financialfunctions.
The `financial functions in NumPy <https://numpy.org/doc/1.17/reference/routines.financial.html>`_are deprecated and eventually will be removed from NumPy; see`NEP-32 <https://numpy.org/neps/nep-0032-remove-financial-functions.html>`_for more information. This package is the replacement for the deprecatedNumPy financial functions.
The source code for this package is available at https://github.com/numpy/numpy-financial.
The importable name of the package is `numpy_financial`. The recommendedalias is `npf`. For example,
>>> import numpy_financial as npf>>> npf.irr([-250000, 100000, 150000, 200000, 250000, 300000])0.5672303344358536
Functions---------
.. currentmodule:: numpy_financial
.. toctree:: :maxdepth: 4
.. autosummary::
fv ipmt irr mirr nper npv pmt ppmt pv rate
.. The following "hidden" toctree is a hack to prevent Sphinx warnings about "document isn't included in any toctree"
.. toctree:: :hidden:
fv ipmt irr mirr nper npv pmt ppmt pv rate
Development===========
.. toctree:: :maxdepth: 1
dev/getting_the_code.md dev/building_with_poetry.md dev/running_the_benchmarks.md
.. include:: release-notes.rst
Index and Search================
* :ref:`genindex`* :ref:`search`12345678ipmt====
.. currentmodule:: numpy_financial
.. toctree::
.. autofunction:: ipmt12345678irr===
.. currentmodule:: numpy_financial
.. toctree::
.. autofunction:: irr12345678mirr====
.. currentmodule:: numpy_financial
.. toctree::
.. autofunction:: mirr12345678nper====
.. currentmodule:: numpy_financial
.. toctree::
.. autofunction:: nper12345678npv===
.. currentmodule:: numpy_financial
.. toctree::
.. autofunction:: npv12345678pmt===
.. currentmodule:: numpy_financial
.. toctree::
.. autofunction:: pmt12345678ppmt====
.. currentmodule:: numpy_financial
.. toctree::
.. autofunction:: ppmt12345678pv==
.. currentmodule:: numpy_financial
.. toctree::
.. autofunction:: pv12345678rate====
.. currentmodule:: numpy_financial
.. toctree::
.. autofunction:: rate1234567891011121314151617181920Release Notes-------------1.1.0~~~~~* **1.1.0 is not released yet.**
1.0.0~~~~~* The transition of the source code from NumPy to this package is complete.
0.2.0~~~~~* Removed the use of `numpy.core.overrides.array_function_dispatch` to create wrappers of the financial functions.* Support NumPy versions back to 1.15.
0.1.0~~~~~* This is the initial release of numpy-financial. The functions were copied from NumPy 1.17.123This directory contains the files for the top-level online documentation.If these files are changed, the changes must be copied over to the top directoryof the gh-pages branch.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
body { margin: auto; padding-right: 1em; padding-left: 1em; max-width: 48em; color: black; font-family: sans-serif; font-size: 100%; line-height: 125%; color: #333; }pre { border: 1px dotted gray; background-color: #E8E8E8; color: #101010; padding: 0.5em;}code { font-family: monospace; font-size: 130%; font-weight: bold;}h1 a, h2 a, h3 a, h4 a, h5 a { text-decoration: none; color: #336699; }h1, h2, h3, h4, h5 { font-family: sans-serif; font-weight: bold; color: #336699; }
h1 { font-size: 130%;}
h2 { font-size: 110%; font-style: italic;}
h3 { font-size: 95%; font-style: italic;}
h4 { font-size: 90%; font-style: italic;}
h5 { font-size: 90%; font-style: italic;}
h1.title { font-size: 200%; font-weight: bold; padding-top: 0.2em; padding-bottom: 0.2em; text-align: left; border: none;}
dt code { font-weight: bold;}dd p { margin-top: 0;}
ul { padding: 0px 0px 0px 16px;}
ul li { margin: 0px; padding: 0px;}
.link2 { border: solid 1px #000; border-radius: 3x; -moz-border-radius: 3px; -webkit-border-radius: 3px; background-color: #FFF; color: #336699; text-decoration: none; text-align: center; width: 180px; margin: 0px 0px 2px 0px; padding: 2px 0 0px 0px; display: inline-block;}.link2:hover { background-color: #FFF060; }
aside h3 { margin: 10px 0px 2px 0px;}
/* * Specific id styles. */
#logo { border: solid 1px #000; padding: 5px 5px 3px 5px; background-color: #FFFFEA;}
#asidelinks { width: 25%; float: right; color: black; background-color: #E8F4FF; padding: 0px 10px 10px 10px; border: solid 1px #000; margin: 0em 0.75em 0em 0.5em; box-shadow: 5px 8px 9px #b0b0b0;}
#footer { padding-top: 1em; font-size: 70%; color: gray; text-align: center;}.gitattributes+2
tasks/tasksmith-a7e859277e7a/environment/source/pyproject.tomlAdded+64
tasks/tasksmith-a7e859277e7a/instruction.mdAdded+25
tasks/tasksmith-a7e859277e7a/solution/reference/benchmarks/benchmarks.pyAdded+31
tasks/tasksmith-a7e859277e7a/solution/reference/numpy_financial/_financial.pyAdded+1041
tasks/tasksmith-a7e859277e7a/solution/solve.shAdded+6
tasks/tasksmith-a7e859277e7a/task.tomlAdded+226
tasks/tasksmith-a7e859277e7a/tests/DockerfileAdded+10
tasks/tasksmith-a7e859277e7a/tests/contract.jsonAdded+1
tasks/tasksmith-a7e859277e7a/tests/grade.pyAdded+196
tasks/tasksmith-a7e859277e7a/tests/source/.github/CODE_OF_CONDUCT.mdAdded+9
tasks/tasksmith-a7e859277e7a/tests/source/.github/ISSUE_TEMPLATE/bug-report.ymlAdded+63
tasks/tasksmith-a7e859277e7a/tests/source/.github/ISSUE_TEMPLATE/config.ymlAdded+7
tasks/tasksmith-a7e859277e7a/tests/source/.github/ISSUE_TEMPLATE/documentation.ymlAdded+23
tasks/tasksmith-a7e859277e7a/tests/source/.github/ISSUE_TEMPLATE/feature-request.ymlAdded+22
tasks/tasksmith-a7e859277e7a/tests/source/.github/workflows/lint.ymlAdded+53
tasks/tasksmith-a7e859277e7a/tests/source/.github/workflows/publish_docs_to_pages.ymlAdded+76
tasks/tasksmith-a7e859277e7a/tests/source/.github/workflows/pythonpackage.ymlAdded+25
tasks/tasksmith-a7e859277e7a/tests/source/.gitignoreAdded+113
tasks/tasksmith-a7e859277e7a/tests/source/DockerfileAdded+8
tasks/tasksmith-a7e859277e7a/tests/source/LICENSE.txtAdded+30
tasks/tasksmith-a7e859277e7a/tests/source/README.mdAdded+21
tasks/tasksmith-a7e859277e7a/tests/source/asv.conf.jsonAdded+193
tasks/tasksmith-a7e859277e7a/tests/source/benchmarks/__init__.pyAdded
tasks/tasksmith-a7e859277e7a/tests/source/benchmarks/benchmarks.pyAdded+49
tasks/tasksmith-a7e859277e7a/tests/source/doc/MakefileAdded+20
tasks/tasksmith-a7e859277e7a/tests/source/doc/make.batAdded+35
tasks/tasksmith-a7e859277e7a/tests/source/doc/source/_static/numpy_financial_favicon.pngAdded
Large File Pointer Details
- SHA256: 28f9fc915f503b23ec5f8c8fd088f608140cc457bff13fd0361ab7b1e48b1519
- Pointer size: 128 Bytes
- Size of remote file: 170 Bytes
tasks/tasksmith-a7e859277e7a/tests/source/doc/source/_static/numpy_financial_logov.svgAdded
tasks/tasksmith-a7e859277e7a/tests/source/doc/source/conf.pyAdded+67
tasks/tasksmith-a7e859277e7a/tests/source/doc/source/dev/building_with_poetry.mdAdded+67
tasks/tasksmith-a7e859277e7a/tests/source/doc/source/dev/getting_the_code.mdAdded+43
tasks/tasksmith-a7e859277e7a/tests/source/doc/source/dev/running_the_benchmarks.mdAdded+55
tasks/tasksmith-a7e859277e7a/tests/source/doc/source/fv.rstAdded+8
tasks/tasksmith-a7e859277e7a/tests/source/doc/source/generate_rst_function_files.pyAdded+27
tasks/tasksmith-a7e859277e7a/tests/source/doc/source/index.rstAdded+79
tasks/tasksmith-a7e859277e7a/tests/source/doc/source/ipmt.rstAdded+8
tasks/tasksmith-a7e859277e7a/tests/source/doc/source/irr.rstAdded+8
tasks/tasksmith-a7e859277e7a/tests/source/doc/source/mirr.rstAdded+8
tasks/tasksmith-a7e859277e7a/tests/source/doc/source/nper.rstAdded+8
tasks/tasksmith-a7e859277e7a/tests/source/doc/source/npv.rstAdded+8
tasks/tasksmith-a7e859277e7a/tests/source/doc/source/pmt.rstAdded+8
tasks/tasksmith-a7e859277e7a/tests/source/doc/source/ppmt.rstAdded+8
tasks/tasksmith-a7e859277e7a/tests/source/doc/source/pv.rstAdded+8
tasks/tasksmith-a7e859277e7a/tests/source/doc/source/rate.rstAdded+8
tasks/tasksmith-a7e859277e7a/tests/source/doc/source/release-notes.rstAdded+20
tasks/tasksmith-a7e859277e7a/tests/source/docweb/README.txtAdded+3
tasks/tasksmith-a7e859277e7a/tests/source/docweb/css/home.cssAdded+128
tasks/tasksmith-a7e859277e7a/tests/source/docweb/images/numpy_financial_favicon.pngAdded
Large File Pointer Details
- SHA256: 28f9fc915f503b23ec5f8c8fd088f608140cc457bff13fd0361ab7b1e48b1519
- Pointer size: 128 Bytes
- Size of remote file: 170 Bytes
tasks/tasksmith-a7e859277e7a/tests/source/docweb/images/numpy_financial_logoh.svgAdded