Skip to main content

Financial and quantitative statistical computing for Python

Project description

PyStatsFinance

Financial and quantitative statistical computing for Python.

Status: 0.1.0 — first module shipped. Return-series performance metrics are available now; more quantitative-finance methods are on the roadmap below.

PyStatsFinance is part of the open-core PyStatistics family:

Package Layer
pystatistics Fundamental, general statistics
pystatsbio Biotech / pharma statistics
pystatsclinical Clinical-trial / clinical-research statistics
pystatsgenomic Genomics / computational-biology statistics
pystatsfinance Financial / quantitative statistics
pystatsinsurance Actuarial / insurance statistics

Like its siblings, it builds on pystatistics for the general statistical layer and adds methods specific to quantitative finance.

What's available now (0.1.0)

Return-series risk and performance metrics:

from pystatsfinance import performance

returns = [0.01, -0.02, 0.03, -0.01, 0.02]

performance.sharpe_ratio(returns)              # annualized Sharpe ratio
performance.annualized_volatility(returns)     # annualized volatility
performance.max_drawdown(returns)              # worst peak-to-trough decline

sharpe_ratio annualizes mean(excess) / std(excess) (sample standard deviation; per-period risk-free rate). max_drawdown works on returns or a price series (are_prices=True) and reports the decline magnitude with its peak and trough indices. All three fail loud on empty/non-finite input, and the Sharpe ratio is raised — not returned as inf/nan — when volatility is zero.

Roadmap (candidates, not commitments)

  • Value-at-Risk and Conditional VaR (historical and parametric).
  • Extended performance ratios (Sortino, Calmar, Information) and drawdown analytics.
  • GARCH-family volatility and portfolio optimization.

Installation

pip install pystatsfinance

License

MIT © Hai-Shuo. Part of the SGCX open-core ecosystem.

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

pystatsfinance-0.1.1.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pystatsfinance-0.1.1-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file pystatsfinance-0.1.1.tar.gz.

File metadata

  • Download URL: pystatsfinance-0.1.1.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pystatsfinance-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b6e5cc012705137cb96d345ca0ac3ef02ea4e90895403cbf9462b00f29f754e2
MD5 60226de6b9a810a1f1335afb58e9b90d
BLAKE2b-256 6b2634c9b81949fbac33e056461220240689861c2c5874e1f97bc2ca53705b33

See more details on using hashes here.

Provenance

The following attestation bundles were made for pystatsfinance-0.1.1.tar.gz:

Publisher: publish.yml on sgcx-org/pystatsfinance

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pystatsfinance-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pystatsfinance-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pystatsfinance-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9ab7c868051e7c72b32a4a3036c917995884164e76c151dc068bbad9b81724b3
MD5 2d71e6822da7dca942eda8b553347bc3
BLAKE2b-256 6a70edab5892949c6dcb0f9b258f9c27667fa657ce09562e11dbf9e179c33825

See more details on using hashes here.

Provenance

The following attestation bundles were made for pystatsfinance-0.1.1-py3-none-any.whl:

Publisher: publish.yml on sgcx-org/pystatsfinance

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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