Skip to main content

Polars-native factor signal validation toolkit for quantitative finance

Project description

factrix

Tests one factor. Screens a thousand.

A polars-native factor validator. It answers the core question — Does this factor possess predictive edge?

Where factrix fits

factrix is the first Python framework to dispatch primary statistical tests by factor type — cross-sectional, event, and common factor each get the test that fits their data-generating process.

factor construction  →  factrix (verdict)  →  strategy construction  →  backtest  →  live trading
                            ▲ you are here

For each candidate factor factrix answers — is the predictive power real? — and corrects for multiple testing when you screen at scale. Kill fakes before they cost you a backtest.

Why factrix?

  • Type-routed evaluation — Information Coefficient + Fama-MacBeth for cross-sectional factors; Cumulative Average Abnormal Return for events. Each type ships its own multi-metric diagnostic battery.
  • Batch factor screening — screen hundreds of candidate factors with cross-test multiple-testing correction in a single API call.
  • Financial statistics built in — autocorrelation-robust standard errors (Newey-West), overlapping-forward-return correction, persistent-predictor flagging (Stambaugh bias), false-discovery-rate control across batches (Benjamini-Hochberg-Yekutieli). Hand-rolled Information Coefficient loops typically run scipy.stats.ttest_1samp on the IC series and ignore the autocorrelation induced by overlapping forward returns.
  • Polars-native — modern Polars alternative to the pandas-based alphalens.

factrix stops at the verdict — primary test plus diagnostic battery. It does not size positions, model slippage, optimise weights, or compose alphas; those belong to the later stages of the pipeline above.

Is factrix the right tool?

You want to… Use this
Verdict on a factor (cross-sectional / event / common factor) factrix
Screen many factors with multiple-testing correction factrix
Backtest with positions / slippage / margin zipline-reloaded, backtrader, bt, vectorbt, nautilus_trader
Optimise portfolio weights skfolio, riskfolio-lib
Returns-level tear-sheet (P&L diagnostics) pyfolio-reloaded, QuantStats
Familiar cross-sectional tear-sheet alphalens-reloaded
End-to-end machine-learning pipeline qlib
Deflated / probabilistic Sharpe today (commercial) mlfinlab

Where factrix fits — full comparison →

Installation

pip install factrix
# or
uv add factrix

See the installation guide for version pinning and development setup.

Typical usage

Single factor — IC evaluation

import factrix as fl
from factrix.preprocess import compute_forward_return

raw   = fl.datasets.make_cs_panel(n_assets=100, n_dates=500, ic_target=0.08, seed=2024)
panel = compute_forward_return(raw, forward_periods=5)

cfg     = fl.AnalysisConfig.individual_continuous(metric=fl.Metric.IC, forward_periods=5)
profile = fl.evaluate(panel, cfg)

print(profile.verdict(), '| primary_p =', round(profile.primary_p, 4))
print(profile.diagnose())   # WarningCode / InfoCode list

Multi-factor BHY screening

profiles  = [fl.evaluate(p, cfg) for p in [panel_a, panel_b, panel_c, panel_d, panel_e]]
survivors = fl.multi_factor.bhy(profiles, threshold=0.05)

Single-asset (timeseries) fallback

cfg     = fl.AnalysisConfig.individual_continuous(metric=fl.Metric.IC, forward_periods=5)
profile = fl.evaluate(single_asset_panel, cfg)  # mode auto-switches to TIMESERIES
print(profile.stats.get(fl.StatCode.TS_BETA))

Documentation

  • Get Started — install, quickstart, three-axis concepts
  • Guides — PANEL vs TIMESERIES, BHY batch screening, choosing a metric
  • Reference — applicability tables, formulas, statistical methods
  • Development — architecture, contributing

License

Released under the Apache License 2.0.

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

factrix-0.10.0.tar.gz (218.8 kB view details)

Uploaded Source

Built Distribution

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

factrix-0.10.0-py3-none-any.whl (176.9 kB view details)

Uploaded Python 3

File details

Details for the file factrix-0.10.0.tar.gz.

File metadata

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

File hashes

Hashes for factrix-0.10.0.tar.gz
Algorithm Hash digest
SHA256 d3d2f2a18bc26ba92a9fb40f6f6a6e77464dcaa9c99346fae85a1e4693985cf1
MD5 e5e2d8ff62330825d09ab67436aca5dc
BLAKE2b-256 aac1fc558d602b3df6c2fefb4f32649871e5a82d4f7d56b87ecca9532dfa54e1

See more details on using hashes here.

Provenance

The following attestation bundles were made for factrix-0.10.0.tar.gz:

Publisher: release.yml on awwesomeman/factrix

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

File details

Details for the file factrix-0.10.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for factrix-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 404a8a227eaeba6ad2b59e8419352620a35a0ab287b8f5f93570511206bbd069
MD5 f0277c3dac8736cc0ff6f23761f63943
BLAKE2b-256 613ac681cfa2776251c56d4fca074e5af24e0179a9fb2b1df29cf958a0dd1335

See more details on using hashes here.

Provenance

The following attestation bundles were made for factrix-0.10.0-py3-none-any.whl:

Publisher: release.yml on awwesomeman/factrix

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