Skip to main content

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

Project description

Elvers

PyPI CI License Python 3.10+ Polars

Polars-native factor computation engine for quantitative research. All operators execute as Rust-backed Polars expressions with no Python loops in the hot path.

Core Abstractions

  • Panel -- Balanced (timestamp, symbol) container with strict alignment guarantees. Prevents look-ahead bias by construction.
  • Factor -- Immutable signal vector. Every operator takes Factor and returns Factor with eager evaluation.

Numerical Conventions

Convention Summary
Null semantics NaN/Inf unified to null on construction. Single missing-value type throughout.
Division by zero All divisions guarded at abs(denom) < 1e-10, returning null.
Rank range (0, 1] -- does not pass through zero. Ties use average method.
Std/Variance/Covariance ddof=0 (population). Correlation is ddof-invariant.
Rolling warmup All ts_* operators: first window-1 values are null.

Full conventions and per-operator specifications: OPERATORS.md

Installation

pip install elvers

Usage

from elvers import load, ts_rank, ts_regression, zscore, signal

panel = load()                          # built-in sample data (crypto 1d OHLCV)
close, volume = panel["close"], panel["volume"]

momentum    = ts_rank(close, 20)
vol_adj     = zscore(momentum) / zscore(ts_rank(volume, 20))
beta_resid  = ts_regression(close, volume, window=60, rettype=0)
alpha       = signal(vol_adj)

Sub-daily data is supported via the interval parameter:

panel = load("hourly.parquet", interval="1h")

Operators

72 operators. All accept and return Factor.

Time-Series -- rolling window per symbol:

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_step ts_decay_linear ts_decay_exp_window days_from_last_change ts_av_diff ts_scale ts_percentile ts_quantile ts_cv ts_autocorr ts_count_nans ts_backfill kth_element last_diff_value inst_tvr ts_delta_limit ts_regression trade_when

Cross-Sectional -- across symbols at each timestamp:

rank zscore mean median scale normalize quantile signal winsorize truncate left_tail right_tail

Neutralization and Group -- sector/industry neutralization:

vector_neut regression_neut group_neutralize group_rank group_zscore group_scale group_normalize group_mean group_median group_backfill

Math:

log sqrt sign power signed_power inverse s_log_1p maximum minimum where

Arithmetic:

add subtract multiply divide reverse densify bucket and standard operators (+ - * / ** abs)

Development

pip install -e ".[dev]"
pytest tests/ -v
ruff check elvers/

See CLAUDE.md for full development standards.

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.3.0.tar.gz (299.9 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.3.0-py3-none-any.whl (291.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for elvers-0.3.0.tar.gz
Algorithm Hash digest
SHA256 8844ddf152d740fa13e0069372420d6379ec4feaefc5cfc2dcbe857ad80bced3
MD5 54f74d82449a58d9b5ac1a6468052b0e
BLAKE2b-256 9f4dc4744303e836255012e380cc2abeec8b260d660a23bda296d7ea9d440091

See more details on using hashes here.

Provenance

The following attestation bundles were made for elvers-0.3.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.3.0-py3-none-any.whl.

File metadata

  • Download URL: elvers-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 291.9 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e1b52258fa6d0b7e761fee6e78a365c7b0e43298ec00a855ab888c0da745c6d9
MD5 1bb9d19386bd784bf8c62ac5e7533720
BLAKE2b-256 fba0c8d729b70720df65225feaf8fa29216b585b2a9286b39594ab7f613f2695

See more details on using hashes here.

Provenance

The following attestation bundles were made for elvers-0.3.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