Skip to main content

qweave

中文

CI Release Python License

A Polars-native factor research engine powered by Rust. qweave takes you from composable alpha computation and leakage-aware forward-return labels to IC, quantile, turnover, and interactive report analysis in one DataFrame pipeline.

  • ⚡ 4.8M rows × 158 factors in ~2.2 s: all Qlib Alpha158 factors on a 6,000-symbol × 800-day panel in one batch run (measured on a Ryzen 9 9950X).
  • 🆚 23.85× faster than Qlib Alpha158DL: measured on the same panel, the same factor set, and 32 threads for every engine; 2.56× faster end to end than KunQuant's JIT C++ path, with no C++ toolchain required. Commands and full data in Benchmarks.
  • 🧩 450 built-in classic factors: WorldQuant Alpha101 + Qlib Alpha158 + Guotai Junan Alpha191, with time-series and cross-sectional operators in one expression API — select, remap inputs, mix, and execute them as one batch.
  • 📊 Interactive report in one line: result.view() opens the embedded Vue + ECharts interface with per-factor quantile returns, monthly IC, and long-short diagnostics.

qweave pipeline from market data to factor report

Bring your own Polars market-data panel. Keep your data pipeline. Move the expensive factor-research loop into Rust.

qweave is for quantitative researchers who already manage data with Parquet/Polars and want fewer per-factor Python loops, repeated rolling computations, and matrix-alignment problems. It focuses on whether factors carry stable information about future returns. It is not a data vendor, matching simulator, or full investment platform.

Quick Start

Install from PyPI (Python 3.10+):

pip install qweave

v0.6.1 adds Skew, Kurt, EMA, and standard WMA, with incremental rolling Skew/Kurt. See the v0.6.1 release notes for Qlib alignment and the Rust WMA migration.

Platform-specific wheels are also available from GitHub Releases. For source builds see the Development Guide.

From Market Data To A Factor Report

The repository includes a deterministic synthetic panel with 80 assets and 320 trading days. This example mixes two classic factors with one custom expression, then creates labels, evaluates the factors, and opens the interactive report:

import polars as pl
import qweave as qw

df = pl.read_parquet("examples/data/sample_daily.parquet")

alphas = qw.worldquant_alpha101({}, alphas=["alpha13", "alpha101"])
alphas.append(
    (-(qw.col("close") / qw.col("close").delay(20) - qw.lit(1.0)))
    .alias("mean_reversion_20")
)

df = qw.with_alphas(df, "asset", "date", alphas)
df = qw.with_labels(
    df,
    symbol_col="asset",
    time_col="date",
    horizons=[1, 5, 20],
    entry_lag=1,
    tradable_col="tradable",
)

result = qw.evaluate(
    df,
    symbol_col="asset",
    time_col="date",
    factor_cols=["alpha13", "alpha101", "mean_reversion_20"],
    quantiles=5,
    min_cs_count=30,
    tradable_col="tradable_entry",
)

print(result.summary)
result.view()   # opens the interactive evaluation report in your browser

Or run the complete example directly:

python examples\quickstart.py

qweave interactive factor report: click a factor row to open its quantile-return, long-short, and IC tearsheets

Why qweave

  • DataFrame in, DataFrame out: qweave takes and returns Polars DataFrames directly — no converting the panel to NumPy arrays and stitching results back, and no migration to a dedicated data provider.
  • Cross-sectional and time-series factors in the same expression: cross-sectional operators like rank and group_neutralize live in the same DAG as rolling time-series operators, so one compute_alphas call runs everything — no staged provider/handler workflow that fetches features first and organizes cross-sectional computation separately.
  • Common time-series statistics: ts_skew, ts_kurt, mean-seeded ema, and standard linear wma use consistent period arguments; see the Qlib operator migration reference for differences.
  • Execute the whole factor batch once: expressions enter one Rust DAG with common-subexpression reuse, intermediate-slot reuse, fused elementwise chains, and node-level parallelism.
  • 450 composable classic factors: WorldQuant Alpha101, Qlib Alpha158, and Guotai Junan Alpha191 use the same API as custom expressions, so they can be selected, remapped, mixed, and executed together.
  • Reports included: result.view() opens the Vue + ECharts interactive interface with per-factor drill-down. Thousand-factor workloads can stream results to Parquet.

Performance: Head-To-Head With Qlib And KunQuant

Measured on Windows 11 / Ryzen 9 9950X (16 cores, 32 threads) / 61.7 GiB memory, on the same 6,000-symbol × 800-day (4.8M-row) synthetic OHLCV panel, 32 threads for every engine, best of three runs after one warmup. KunQuant is measured end to end in f64, including input/output DataFrame conversion and JIT compilation:

Workload qweave Competitor Takeaway
All 158 Qlib Alpha158 factors 2.24 s Qlib Alpha158DL: 53.37 s 23.85× faster, about 46% less peak RSS
WorldQuant Alpha101 (82 factors) 3.11 s KunQuant f64: 7.95 s 2.56× faster end to end, about 31% less peak RSS, no C++ toolchain

Where the speed comes from: sorting, rolling windows, cross-sectional operators, and evaluation statistics run on the Rust hot path; the whole expression batch enters one DAG with common-subexpression reuse, slot reuse, and node-level parallelism managed by the engine. Full environment, commands, and publishing conventions in Benchmarks.

Factor Evaluation: Leakage-Free, Everything In One Run

Signal T ── entry_lag ──> Entry T+1 ── horizon h ──> Exit T+1+h
  • T+1 entry by default, no look-ahead; halts and missing rows cannot silently shorten the holding period, and entry-day tradability is aligned back to the signal day automatically.
  • One evaluate call produces IC/RankIC, quantile returns, turnover, rank autocorrelation, and long-short diagnostics, with Newey–West t-statistics correcting overlapping-horizon significance.
  • result.view() opens the interactive report directly; thousand-factor runs can stream to Parquet.

See Factor Evaluation for exact calibers and parameters.

When To Choose qweave

  • Your market data already lives in a Parquet/Polars pipeline and you do not want to migrate to a platform-specific data format or a staged provider/handler workflow just to compute factors.
  • You compute and evaluate tens to thousands of factors at a time, and per-factor Python loops have become the bottleneck of research iteration.
  • You are building automated factor mining or a research agent: an easy-to-write expression API, high-throughput batch execution, and unified evaluation calibers make qweave a natural kernel for an agent's "generate → compute → evaluate" experiment loop.

When you need a full platform with data ingestion, model training, and backtest experiment management, Qlib is the better fit — and qweave can be embedded in such platforms or agent systems as the factor computation and evaluation kernel. See Comparison for details.

Roadmap

  • An experiment kernel for research agents: an easy-to-write expression API, high-throughput batch execution, and unified evaluation calibers powering the automated "generate factors → batch compute → strict evaluate" factor-mining loop.
  • Expand the built-in factor libraries and time-series/cross-section operators.
  • Keep improving the interactive report as the default way to inspect evaluation results.

Documentation Path

Follow the documentation home in order:

  1. Runnable example
  2. Python Expression API
  3. WorldQuant 101 / Qlib Alpha158 / Guotai Junan Alpha191
  4. Factor Evaluation
  5. Architecture / Benchmarks

Project Status

The factor-computation, labeling, evaluation, and reporting workflow is usable today, while the API remains pre-1.0.

See CONTRIBUTING to contribute. This project is not affiliated with Guotai Junan Securities, WorldQuant, Microsoft, Qlib, or KunQuant.

License

MIT. See LICENSE.

Metadata

Release files for qweave 0.6.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qweave 0.6.1
File Size Uploaded
qweave-0.6.1.tar.gz 535.7 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for qweave 0.6.1
File
qweave-0.6.1-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
qweave-0.6.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details
qweave-0.6.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details
qweave-0.6.1-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details
qweave-0.6.1-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details

Total release size: 54.8 MB

Release files / qweave-0.6.1.tar.gz

Download URL qweave-0.6.1.tar.gz
Size 535.7 kB
Tags Source
SHA-256 checksum
How to use checksums
1d8a3e9557be56ff2c893deb46ad79c0b252215c375700cf9bc41a51384e0c67
BLAKE2b-256 checksum
How to use checksums
18d59b5b8b7ddfa3a171cee01ba3a66a08111db7d5e797097695c509b158590e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.

Transparency log

Release files / qweave-0.6.1-cp310-abi3-win_amd64.whl

Download URL qweave-0.6.1-cp310-abi3-win_amd64.whl
Size 10.4 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
b15659bd7a2f42ea4e2da9cec6ad924b81e90f36be2ec6c482d56d60639bdfc0
BLAKE2b-256 checksum
How to use checksums
b409904c177044740866cf620d5fd1b679eddb8dc6105f8031e4dabd112014aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.

Transparency log

Release files / qweave-0.6.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL qweave-0.6.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 11.4 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
160f2c411857bccb640fc266fed392127b9650f09a293f8ccfe4e54c6a2e3982
BLAKE2b-256 checksum
How to use checksums
2b202d39f567449c0e3d13f959891537ac17051e223b8921b046d2abbb3ff394
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.

Transparency log

Release files / qweave-0.6.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL qweave-0.6.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 11.9 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
000602edbc453394a16908ec70cd5b3c591a032791b785a1c9a7b6a7836cc9c9
BLAKE2b-256 checksum
How to use checksums
00c85232e67129eea2bd78693f5095f41b21e3a26c1e49bca171b5a53691618d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.

Transparency log

Release files / qweave-0.6.1-cp310-abi3-macosx_11_0_arm64.whl

Download URL qweave-0.6.1-cp310-abi3-macosx_11_0_arm64.whl
Size 10.0 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
a93ad67e84329d952142b27a4e6af20a2f42ac54bf7769f217fc4f0ba7ad968e
BLAKE2b-256 checksum
How to use checksums
bf546eb5bd2c3320635a1aec3f975c760b8c0e362a6c79128e45b60651b2f7a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.

Transparency log

Release files / qweave-0.6.1-cp310-abi3-macosx_10_12_x86_64.whl

Download URL qweave-0.6.1-cp310-abi3-macosx_10_12_x86_64.whl
Size 10.5 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
2801718c57d8d808c6849f0f639780ebada754db498877e361ebbbc580e28a5b
BLAKE2b-256 checksum
How to use checksums
5a6dec9c2cc818a99586618fae131eb5fd36e43fbcda9852f7124006ad5543be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.

Transparency log

Release history Release notifications | RSS feed

0.6.2

6 release files

This release

0.6.1 This release

6 release files

0.6.0

6 release files

0.5.0

6 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page