Skip to main content

walrasquant

walrasquant is a high-performance Python framework for quantitative trading. It is designed for low-latency execution, multi-exchange connectivity, and strategy development at scale.

Highlights

  • Async-first architecture for real-time trading workflows
  • Multi-exchange support (OKX, Binance, Bybit, Hyperliquid, Bitget)
  • Built-in order and position lifecycle management
  • Strategy framework with execution algorithms (including TWAP)
  • Optional web API integration with FastAPI
  • CLI and PM2 tooling for monitoring and operations

Installation

Requirements

  • Python >=3.11,<3.14
  • Redis (recommended for monitoring and shared runtime state)

From PyPI

pip install walrasquant

From source

git clone https://github.com/walras-group/WalrasQuant.git
cd WalrasQuant
uv pip install -e .

Quick start

from decimal import Decimal

from walrasquant.constants import settings, ExchangeType, OrderSide, OrderType
from walrasquant.config import Config, BasicConfig, PublicConnectorConfig, PrivateConnectorConfig
from walrasquant.engine import Engine
from walrasquant.exchange.okx import OkxAccountType
from walrasquant.schema import BookL1, Order
from walrasquant.strategy import Strategy


OKX_API_KEY = settings.OKX.DEMO_1.api_key
OKX_SECRET = settings.OKX.DEMO_1.secret
OKX_PASSPHRASE = settings.OKX.DEMO_1.passphrase


class DemoStrategy(Strategy):
    def __init__(self):
        super().__init__()
        self.subscribe_bookl1(symbols=["BTCUSDT-PERP.OKX"])
        self.signal = True

    def on_filled_order(self, order: Order):
        print(order)

    def on_bookl1(self, bookl1: BookL1):
        if not self.signal:
            return

        self.create_order(
            symbol="BTCUSDT-PERP.OKX",
            side=OrderSide.BUY,
            type=OrderType.MARKET,
            amount=Decimal("0.1"),
        )
        self.create_order(
            symbol="BTCUSDT-PERP.OKX",
            side=OrderSide.SELL,
            type=OrderType.MARKET,
            amount=Decimal("0.1"),
        )
        self.signal = False


config = Config(
    strategy_id="okx_demo_buy_sell",
    user_id="user_test",
    strategy=DemoStrategy(),
    basic_config={
        ExchangeType.OKX: BasicConfig(
            api_key=OKX_API_KEY,
            secret=OKX_SECRET,
            passphrase=OKX_PASSPHRASE,
            testnet=True,
        )
    },
    public_conn_config={
        ExchangeType.OKX: [PublicConnectorConfig(account_type=OkxAccountType.DEMO)]
    },
    private_conn_config={
        ExchangeType.OKX: [PrivateConnectorConfig(account_type=OkxAccountType.DEMO)]
    },
)

engine = Engine(config)

if __name__ == "__main__":
    try:
        engine.start()
    finally:
        engine.dispose()

CLI tools

After installation, the following commands are available:

  • wq for PM2-based strategy process operations

Documentation

  • Local docs source: docs/

Contributing

Contributions are welcome. Please open an issue or submit a PR.

License

MIT License

Metadata

Release files for walrasquant-lib 0.6.8

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

Source distribution (sdist)

Source distribution for walrasquant-lib 0.6.8
File Size Uploaded
walrasquant_lib-0.6.8.tar.gz 406.7 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for walrasquant-lib 0.6.8
File
walrasquant_lib-0.6.8-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details
walrasquant_lib-0.6.8-cp314-cp314-macosx_10_15_universal2.whl CPython 3.14 CPython 3.14 macOS 10.15+ universal2 (ARM64, x86-64) Details
walrasquant_lib-0.6.8-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details
walrasquant_lib-0.6.8-cp313-cp313-macosx_10_13_universal2.whl CPython 3.13 CPython 3.13 macOS 10.13+ universal2 (ARM64, x86-64) Details
walrasquant_lib-0.6.8-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details
walrasquant_lib-0.6.8-cp312-cp312-macosx_10_13_universal2.whl CPython 3.12 CPython 3.12 macOS 10.13+ universal2 (ARM64, x86-64) Details
walrasquant_lib-0.6.8-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details
walrasquant_lib-0.6.8-cp311-cp311-macosx_10_9_universal2.whl CPython 3.11 CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64) Details

Total release size: 5.1 MB

Release files / walrasquant_lib-0.6.8.tar.gz

Download URL walrasquant_lib-0.6.8.tar.gz
Size 406.7 kB
Tags Source
SHA-256 checksum
How to use checksums
6bbd725e7e7093180153a224fe0e9d5d837e0dc0483b8e1818db5e49bc518b59
BLAKE2b-256 checksum
How to use checksums
df4840e3143faf573ab0fa83a03c30236a9287c7a0e09cd34e275cec7a2155a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / walrasquant_lib-0.6.8-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL walrasquant_lib-0.6.8-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 648.5 kB
Tags CPython 3.14 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
7fa894e6fdbf79b1f93c08225b753f90ff7c1f1d3df4dcaabae909ce55dc3e59
BLAKE2b-256 checksum
How to use checksums
d51924947bb3f92a7e1e50d2df92242374133390951f1b38e91297a4e4471904
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / walrasquant_lib-0.6.8-cp314-cp314-macosx_10_15_universal2.whl

Download URL walrasquant_lib-0.6.8-cp314-cp314-macosx_10_15_universal2.whl
Size 523.8 kB
Tags CPython 3.14 macOS 10.15+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
16c6447892ec958a9cb8c570637da93d565356c79d6004b4cdeea5bf8e79e4cb
BLAKE2b-256 checksum
How to use checksums
86d7d56aba558be1ec9523fa88a35db2e0d09435762c7ec019557907d8df5224
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / walrasquant_lib-0.6.8-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL walrasquant_lib-0.6.8-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 647.7 kB
Tags CPython 3.13 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
80e0e38a0feb85e97b6a25da72d4bbf99563a917b9f6e7b27047353b639da57f
BLAKE2b-256 checksum
How to use checksums
fe159aba497ea728663116be6892fde609a3141037d0fd133935e2885114adc0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / walrasquant_lib-0.6.8-cp313-cp313-macosx_10_13_universal2.whl

Download URL walrasquant_lib-0.6.8-cp313-cp313-macosx_10_13_universal2.whl
Size 521.8 kB
Tags CPython 3.13 macOS 10.13+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
0d79eb0e8f70f84e677127122e59d0cce40154bece64f74381e4a70a049c47e1
BLAKE2b-256 checksum
How to use checksums
74863deceaf570fdeb3a7c283505ae176c9208af2f567d79b33e755f2a41d4c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / walrasquant_lib-0.6.8-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL walrasquant_lib-0.6.8-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 660.6 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
5e0ba5a6fe0d9b65c8c918db4b773bb19a8b3df1a645a2edce43f2d8da9b163c
BLAKE2b-256 checksum
How to use checksums
8f8701bc769d4e2417d922d55536b41557fe07ce49207b906d64f4c06ba1c678
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / walrasquant_lib-0.6.8-cp312-cp312-macosx_10_13_universal2.whl

Download URL walrasquant_lib-0.6.8-cp312-cp312-macosx_10_13_universal2.whl
Size 523.6 kB
Tags CPython 3.12 macOS 10.13+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
63586dd41d6755f52a5e18f271d8494657bf602f78d6f4b1bef17f687d8c7477
BLAKE2b-256 checksum
How to use checksums
0e6471a5035b63628b41e0c8bc091a1c07dfc118abf64db8a98a690774e4b18f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / walrasquant_lib-0.6.8-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL walrasquant_lib-0.6.8-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 650.9 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
004255b8c2851afefac9f8c7b635893b977ebf05b4efb742a6b70b2ca8c8ea35
BLAKE2b-256 checksum
How to use checksums
1425b1bc15c8fbc84dbf5fbdaed36b1273b10ad6e2421d5bc45521a3ebc66408
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / walrasquant_lib-0.6.8-cp311-cp311-macosx_10_9_universal2.whl

Download URL walrasquant_lib-0.6.8-cp311-cp311-macosx_10_9_universal2.whl
Size 524.1 kB
Tags CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
1e241d24450e4ec8cc18aeb7b05696ca702c11176c2efe33b64cc67a057e665a
BLAKE2b-256 checksum
How to use checksums
148e2b153b67dbd6b06dac2bf626774e91447122adaf44dafbb786e6412e6d48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.6.8 This release

9 release files

0.6.7

9 release files

0.6.6

9 release files

0.6.5

9 release files

0.6.4

9 release files

0.6.3

9 release files

0.6.2

7 release files

0.6.1

7 release files

0.6.0

7 release files

0.5.12

7 release files

0.5.11

7 release files

0.5.10

7 release files

0.5.9

7 release files

0.5.8

2 release files

0.5.7

2 release files

0.5.6

2 release files

0.5.5

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.28

2 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