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.2 adds !=, &, |, ~, ts_mad, and ts_count, retaining Float64 masks. Implicit Python truth testing of expressions now raises an error; use parenthesized comparisons with &, |, and ~. See the v0.6.2 release notes for usage and 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.2

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.2
File Size Uploaded
qweave-0.6.2.tar.gz 539.1 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for qweave 0.6.2
File
qweave-0.6.2-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
qweave-0.6.2-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.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details
qweave-0.6.2-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details
qweave-0.6.2-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.2.tar.gz

Download URL qweave-0.6.2.tar.gz
Size 539.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1a4c6486a999ad8c91464a28e25c5c87098fe890f552c0ef40a1849ffbc6eba7
BLAKE2b-256 checksum
How to use checksums
5e82a2b15c230110b5964352f5abd7e8a03dc9d26428dc665a75a2242f5343e3
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 8, 2026.

Transparency log

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

Download URL qweave-0.6.2-cp310-abi3-win_amd64.whl
Size 10.4 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
eeb9327095c7b4a7f88c927ab0c6d941fbf9792f41b6296eb04edda1a017391e
BLAKE2b-256 checksum
How to use checksums
c30d6dbde76d256134f94eac18ce65d2ea6de2aa802ebde70296a9d273ac2624
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 8, 2026.

Transparency log

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

Download URL qweave-0.6.2-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
c71d57eed44347efbed5efaf4e6a58042b75354f09d28d9719eca05c324f471e
BLAKE2b-256 checksum
How to use checksums
b9684870743718f6eeebe0e5dbacde95188c2e0df062c30bb1707ce6a885026f
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 8, 2026.

Transparency log

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

Download URL qweave-0.6.2-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
7f68af68e87ff9403a2b84ec5cfa3c007983902b7b5cec06950a1d242d9f4241
BLAKE2b-256 checksum
How to use checksums
57ce6977d6e07afc56fcdd69c7d1d3f2460ad919fa562f1b99b835e9fe111a90
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 8, 2026.

Transparency log

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

Download URL qweave-0.6.2-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
230fc97714cf51d0e3fcfd6bbd9b048590a4eefd48c762e73a81ecea3d09b5cd
BLAKE2b-256 checksum
How to use checksums
8bb80d59114c7b0d56af85fb9ad58006f6835f09ce650745400936b19d386da4
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 8, 2026.

Transparency log

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

Download URL qweave-0.6.2-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
fbb46d7fd67129ff34cd59c63a17bc18124f3395a2264175ab28df5ae8e442d8
BLAKE2b-256 checksum
How to use checksums
3a22aedb156f2761a0f2b3f4e3e1e9dcef017f53f2b52f30079e04fe4347f582
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 8, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.6.2 This release

6 release files

0.6.1

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