This release is a pre-release and may not be stable for production use.
Finalytics is a portfolio analytics engine: it keeps the books of a multi-currency portfolio from its transactions, measures performance and risk, and optimises portfolios under real-world constraints. The engine is written in Rust; this package is a typed Python layer over it.
Status: 1.0 is in active development. Until 1.0.0 is released,
pip install finalyticsgives 0.9; install a 1.0 pre-release withpip install --pre finalytics.
pip install finalytics # with NumPy
pip install "finalytics[pandas]" # with pandas conversions
Quick start
Estimate risk and return from a year of monthly returns, then find the portfolio with the highest
Sharpe ratio that holds between 10% and 60% of each asset: This example uses pandas
(pip install "finalytics[pandas]"); NumPy arrays work as well.
>>> import pandas as pd
>>> import finalytics as fl
>>> from finalytics import opt
>>> returns = pd.DataFrame({ # twelve months of returns for three assets
... "Equities": [-0.028, 0.021, -0.044, 0.043, -0.021, 0.020, 0.055, -0.028, -0.009, 0.017, 0.044, 0.014],
... "Bonds": [-0.009, 0.020, 0.002, 0.021, -0.013, 0.005, 0.014, 0.002, -0.001, -0.011, -0.028, 0.032],
... "Gold": [-0.013, -0.029, 0.004, 0.069, -0.009, 0.000, 0.017, 0.005, -0.030, 0.003, 0.057, -0.001],
... })
>>> estimate = fl.risk.covariance(returns, method="ledoit_wolf")
>>> problem = opt.Problem.from_covariance(
... fl.risk.scaled(estimate.matrix, 12), # annualised
... expected_returns=returns.mean() * 12,
... constraints=opt.Constraints(bounds=opt.Bound(min=0.1, max=0.6)),
... )
>>> solution = problem.solve(opt.MaximumSharpe(risk_free_rate=0.02))
>>> dict(zip(solution.labels, [round(w, 3) for w in solution.weights]))
{'Equities': 0.444, 'Bonds': 0.18, 'Gold': 0.375}
>>> round(solution.expected_return, 4), round(solution.volatility, 4)
(0.0709, 0.067)
The same example is in the READMEs of the Rust crate and the npm package, and it runs as a test, so the results shown are the engine's.
Books, performance and risk
import finalytics as fl
portfolio = fl.Portfolio.from_csv(
instruments="instruments.csv", transactions="transactions.csv", base_currency="USD"
)
market = fl.MarketData.from_csv(prices="prices.csv", fx="fx.csv")
books = portfolio.books(market)
books.valuation("2026-10-30") # positions and cash, valued in local and base currency
performance = books.performance() # daily time-weighted returns
performance.period("YTD") # cumulative and, for a year or more, annualised
performance.contributions() # by holding; they add up to the return
fl.risk.statistics(performance.returns, risk_free_rate=0.03)
fl.risk.tail_risk(performance.returns, confidence=0.99, method="cornish_fisher")
fl.reports.performance(books) # everything a performance screen shows, ready for charts
Results are frozen dataclasses with documented fields (see finalytics.types). Invalid input
raises finalytics.ValidationError, whose issues list every problem with where it is.
Wheels are published for Linux, macOS and Windows and work with Python 3.10 and later.
- Source and issues: https://github.com/sigmafieldlabs/finalytics
- Licence: MIT OR Apache-2.0
Metadata
Release files for finalytics 1.0.0a0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| finalytics-1.0.0a0.tar.gz | 539.6 kB | Without provenance | Details for finalytics-1.0.0a0.tar.gz |
Built distributions (wheels)
Total release size: 18.6 MB
Release files / finalytics-1.0.0a0.tar.gz
| Download URL | finalytics-1.0.0a0.tar.gz |
|---|---|
| Size | 539.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d59318dffdd2c7230459f899160f15f272caf75a2dc52c4a3edce916d6ea0c76
|
|
BLAKE2b-256 checksum How to use checksums |
f63dd53ee11cdc80dcaf3120d000c419ddfdcf4c40f47833a31fde7d6dd29144
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / finalytics-1.0.0a0-cp310-abi3-win_amd64.whl
| Download URL | finalytics-1.0.0a0-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 2.6 MB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
b66d32d372bb6eff46b3724fe42c5644ba227cdb7e064bc2689ec7405877691c
|
|
BLAKE2b-256 checksum How to use checksums |
ca500944e80d628e623bde360fefe42c9311d50c1bcb454d59af2fe358d29758
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / finalytics-1.0.0a0-cp310-abi3-musllinux_1_2_x86_64.whl
| Download URL | finalytics-1.0.0a0-cp310-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 2.9 MB |
| Tags | CPython 3.10 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
0cb958572c91db447f37569267e730b4d170b824dd1a0bfffc08ca404f3d3235
|
|
BLAKE2b-256 checksum How to use checksums |
68514c0c6ff26ad3bc96c308bc7da9d45775b8c85051b9422e371b4b92fcd271
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / finalytics-1.0.0a0-cp310-abi3-musllinux_1_2_aarch64.whl
| Download URL | finalytics-1.0.0a0-cp310-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 2.6 MB |
| Tags | CPython 3.10 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
1be52d439f9f9c01691cfb4ab2ac9fc41ae8b13e5f5d8876a6006cb8d0752b33
|
|
BLAKE2b-256 checksum How to use checksums |
91cbc814cc7f768f29e97a79cbe71a7d8f56d7a1dbf0a40386d3a3ce7d53c2f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / finalytics-1.0.0a0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | finalytics-1.0.0a0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 2.6 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
2bc19cbf5a95e308b0316b87f10eff83d252834f9c085182b0dd00cb32dd91d0
|
|
BLAKE2b-256 checksum How to use checksums |
a170e856a5615c4b4b47abaa7f16f7008b9d6d496182537e7f4bc5fbaeb05891
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / finalytics-1.0.0a0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
| Download URL | finalytics-1.0.0a0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
|---|---|
| Size | 2.4 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
c74e79a37a27dae0e59473e572de98a58e56e8e52dc42c2702d727acdeeaabb2
|
|
BLAKE2b-256 checksum How to use checksums |
a8ed6f16d7c4e841edeab40e5ecd440d754822c61b8dd874dbbf58bde59e4d50
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / finalytics-1.0.0a0-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | finalytics-1.0.0a0-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.3 MB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
8e24e87b7f69fe40f55b16f06769751ded705c37d708a8759385cc5368a20a70
|
|
BLAKE2b-256 checksum How to use checksums |
0ee8c24f03538f984db7d3b451870ba29917593dcfb3390d9858fc6a113f5f10
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / finalytics-1.0.0a0-cp310-abi3-macosx_10_12_x86_64.whl
| Download URL | finalytics-1.0.0a0-cp310-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 2.6 MB |
| Tags | CPython 3.10 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
f6351cf2db022e26d9fd52e25ca63e8e8ce8430715f88346ed538312879a7e4c
|
|
BLAKE2b-256 checksum How to use checksums |
c060562e80031074a715321ecef3bfd2105918757096f710fe46c5119f425136
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for finalytics 1.0.0a0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.