Skip to main content

Rust-powered collection of financial functions.

Project description

PyXIRR

Rust-powered collection of financial functions.

Installation

pip install pyxirr

Usage

xirr

Function signature:

# You have two options:
# 1. Two iterables for dates and amounts
# 2. Single iterable of tuples (date, amount)

DateLike = Union[datetime.date, datetime.datetime]
Amount = Union[int, foat, Decimal]

def xirr(
    dates: Union[Iterable[DateLike], Iterable[Tuple[DateLike, Amount]]]
    amounts Optional[Iterable[Amount]] = None
    guess: Optional[float] = None
)

Example:

from datetime import date
from pyxirr import xirr

dates = [date(2020, 1, 1), date(2020, 2, 1)]
amounts = [-100, 125]

xirr(dates, amounts)

# list of tuples is also possible:
xirr(zip(dates, amounts))

xnpv

Function signature:

# similar to xirr: iterable of tuples or two iterables

def xnpv(
    rate: float,
    dates: Union[Iterable[DateLike], Iterable[Tuple[DateLike, Amount]]]
    amounts Optional[Iterable[Amount]] = None
)

Example:

xnpv(0.1, dates, amounts)
xnpv(0.1, zip(dates, amounts))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyxirr-0.2.0.tar.gz (6.5 kB view hashes)

Uploaded Source

Built Distributions

pyxirr-0.2.0-cp39-cp39-manylinux2010_x86_64.whl (174.1 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

pyxirr-0.2.0-cp38-cp38-manylinux2010_x86_64.whl (174.0 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

pyxirr-0.2.0-cp37-cp37m-manylinux2010_x86_64.whl (173.9 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

pyxirr-0.2.0-cp36-cp36m-manylinux2010_x86_64.whl (173.8 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page