Skip to main content

High-performance multi-factor quantitative framework built on Polars.

Project description

Elvers

License Python 3.10+ Polars

ELVERS is a high-performance, strictly typed multi-factor alpha research engine powered by Polars.

Design Philosophy

Quantitative research requires rapid iteration over large universe panels without compromising execution speed. Legacy pandas-based pipelines are interpretable but inherently scale poorly. elvers addresses this through a robust two-layer abstraction:

  • Panel — A continuous, balanced panel container enforcing strict (timestamp, symbol) alignment. It mitigates look-ahead bias and standardizes index integrity across all transformations.
  • Factor — A fully evaluated, eagerly executed vector of signal exposures. Bound directly to the global panel, factors resolve native Polars expressions instantaneously utilizing highly-parallelized core routines underneath Rust and C.

The architecture guarantees that complex computational graphs—from primitive time-series aggregations to complex cross-sectional neutralizations—are resolved at theoretical hardware peaks with virtually zero Python interpreter overhead in the hot path.

Installation

pip install elvers

Quick Start

Compose factors exactly as intuitively as they are expressed mathematically:

from elvers import load, ts_rank, zscore

# Load your own data
# panel = load("your_ohlcv.csv")

# Load built-in sample dataset
panel = load()

close = panel["close"]
volume = panel["volume"]

# Define and execute expressions instantly
momentum = ts_rank(close, 20)
alpha = zscore(momentum)

# Extract native Polars DataFrame
result = alpha.df
print(result)

Both Panel and Factor expose a .df property that returns the underlying pl.DataFrame:

  • panel.df — Full panel frame with all OHLCV columns intact.
  • factor.df — Flat (T_days * N_symbols, 3) frame aligned to the original spatial coordinates:
shape: (T_days * N_symbols, 3)
┌────────────┬────────┬───────────┐
│ timestamp  ┆ symbol ┆ factor    │
│ ---        ┆ ---    ┆ ---       │
│ date       ┆ str    ┆ f64       │
╞════════════╪════════╪═══════════╡
│ 2024-01-01 ┆ BTC    ┆ null      │
│ ...        ┆ ...    ┆ ...       │
│ 2024-12-31 ┆ ETH    ┆ 1.243     │
└────────────┴────────┴───────────┘

Rows are ordered by timestamp (ascending), then symbol (ascending).

Note: Rolling window operators naturally yield null for the initial window - 1 periods per symbol. The full dense panel shape is preserved throughout all operations.

Operator Library

Category Supported Operators
Time-Series ts_delay, ts_delta, ts_mean, ts_sum, ts_std_dev, ts_min, ts_max, ts_median, ts_rank, ts_skewness, ts_kurtosis, ts_zscore, ts_corr, ts_covariance, ts_product, ts_decay_linear, ts_av_diff, ts_scale, ts_quantile, ts_cv, ts_autocorr, ts_count_nans, ts_backfill
Cross-Sectional rank, zscore, mean, median, scale, normalize, signal
Neutralization vector_neut, regression_neut, group_neutralize, group_rank, group_zscore, group_scale, group_normalize
Math log, ln, sqrt, sign, power, signed_power, inverse, s_log_1p, maximum, minimum, where, standard operators (+, -, *, /, **, abs)

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

elvers-0.2.0.tar.gz (300.3 kB view details)

Uploaded Source

Built Distribution

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

elvers-0.2.0-py3-none-any.whl (292.2 kB view details)

Uploaded Python 3

File details

Details for the file elvers-0.2.0.tar.gz.

File metadata

  • Download URL: elvers-0.2.0.tar.gz
  • Upload date:
  • Size: 300.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for elvers-0.2.0.tar.gz
Algorithm Hash digest
SHA256 410840bfa765a324ac81933fd00b1856830e342c349380382ff3ccc6abb571b8
MD5 2b07985b8e819614f5d83100c194b09b
BLAKE2b-256 554b5b781ffe0e3ae5dee34aa0c2d81d1645aac6ff7deddb58773e69ec1e301f

See more details on using hashes here.

Provenance

The following attestation bundles were made for elvers-0.2.0.tar.gz:

Publisher: publish.yml on quantbai/elvers

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

File details

Details for the file elvers-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: elvers-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 292.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for elvers-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7a1c4cf90b97424e876b63520c82d8eb1a38b2c121db9f3cfee9e8b14697c453
MD5 06a01ab26815b3a40ec00f629904acb6
BLAKE2b-256 5975cc53b2e7b9ff41476f876c376cf329ab8bf8ed98658e97fad2cabd593e80

See more details on using hashes here.

Provenance

The following attestation bundles were made for elvers-0.2.0-py3-none-any.whl:

Publisher: publish.yml on quantbai/elvers

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