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.

Installation

Install directly from GitHub Releases (CPython 3.10+ stable ABI):

# Windows x64
python -m pip install https://github.com/GaomingOrion/qweave/releases/download/v0.6.0/qweave-0.6.0-cp310-abi3-win_amd64.whl
# Linux x86_64
pip install https://github.com/GaomingOrion/qweave/releases/download/v0.6.0/qweave-0.6.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

# macOS arm64
pip install https://github.com/GaomingOrion/qweave/releases/download/v0.6.0/qweave-0.6.0-cp310-abi3-macosx_11_0_arm64.whl

Wheels for other platforms (Linux aarch64, macOS x86_64) are on the Releases page. 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.
  • 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.
  • Publish to PyPI so installation becomes a single pip install qweave.
  • 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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qweave-0.6.0.tar.gz (530.8 kB view details)

Uploaded Source

Built Distributions

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

qweave-0.6.0-cp310-abi3-win_amd64.whl (10.2 MB view details)

Uploaded CPython 3.10+Windows x86-64

qweave-0.6.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.4 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

qweave-0.6.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (11.9 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

qweave-0.6.0-cp310-abi3-macosx_11_0_arm64.whl (10.0 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

qweave-0.6.0-cp310-abi3-macosx_10_12_x86_64.whl (10.5 MB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

Details for the file qweave-0.6.0.tar.gz.

File metadata

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

File hashes

Hashes for qweave-0.6.0.tar.gz
Algorithm Hash digest
SHA256 ed93ce6f285034b570e82d9a1bae206247f54376352688b09f8e8eb1e5eddb55
MD5 1fa3439a49113fe8f59dfe8c57d4aee9
BLAKE2b-256 d863f51c896a61ab04f260a1a3d2b53c8d7540f4c10ffe281229a46c8101f1f8

See more details on using hashes here.

Provenance

The following attestation bundles were made for qweave-0.6.0.tar.gz:

Publisher: release.yml on GaomingOrion/qweave

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

File details

Details for the file qweave-0.6.0-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: qweave-0.6.0-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 10.2 MB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for qweave-0.6.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 4a5f0b3606446eb710211e312ecc0ad99f92834bc9068cebe8f9832c9c813908
MD5 b11ba28035a7343505801c5659b17ba5
BLAKE2b-256 9ff8c1d79dc11357b68274ca680b467d12528dc2f7c535bf3da02e76acd8771c

See more details on using hashes here.

Provenance

The following attestation bundles were made for qweave-0.6.0-cp310-abi3-win_amd64.whl:

Publisher: release.yml on GaomingOrion/qweave

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

File details

Details for the file qweave-0.6.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qweave-0.6.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 677f1731d55f68cfe742a73cbb839e5020b701e0aa1d94f3ce2fce9428752018
MD5 8d68875533ecaf7e47fcd7917222492b
BLAKE2b-256 27298fcc03ed1fe357ff78b8338f7dbb6a78f3b9a79feda7acdc993d9ae3b373

See more details on using hashes here.

Provenance

The following attestation bundles were made for qweave-0.6.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on GaomingOrion/qweave

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

File details

Details for the file qweave-0.6.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for qweave-0.6.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 963766d520914f2e4fcc4ec67fc882c140a3c972d447a115972f17e2b0c24f5d
MD5 8b73755dc418c5b5a34649c4867ca060
BLAKE2b-256 f3c263b0011010541a7d1370f8a95b87677657b611eeeee41fcedcfb11404129

See more details on using hashes here.

Provenance

The following attestation bundles were made for qweave-0.6.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on GaomingOrion/qweave

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

File details

Details for the file qweave-0.6.0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for qweave-0.6.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bce53aa6944b006ae6e502cc27f2cbbe110a6779b9346fb46d816750b8b999a5
MD5 e31dde0425ff17b741bd396c45e624f6
BLAKE2b-256 d32efa39f6db84af0737499e47b67d82d8e991d7e8bc32bc45a931ae19adcc4c

See more details on using hashes here.

Provenance

The following attestation bundles were made for qweave-0.6.0-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on GaomingOrion/qweave

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

File details

Details for the file qweave-0.6.0-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for qweave-0.6.0-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 488112ad7c1aa7bde8d792d1db4e1156f8774347c652af67fcc3c453547e693c
MD5 1e7a772905af65a2a4f26be23076e6a6
BLAKE2b-256 e41f7b17523ca5cae55f39c76b6256dd57286a19a3818ae92e5ae6e108bf8d6f

See more details on using hashes here.

Provenance

The following attestation bundles were made for qweave-0.6.0-cp310-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on GaomingOrion/qweave

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

Release history Release notifications | RSS feed

This release

0.6.0 This release

6 files

0.5.0

6 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