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

Download files

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

Source Distribution

walrasquant_lib-0.6.8.tar.gz (406.7 kB view details)

Uploaded Source

Built Distributions

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

walrasquant_lib-0.6.8-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (648.5 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

walrasquant_lib-0.6.8-cp314-cp314-macosx_10_15_universal2.whl (523.8 kB view details)

Uploaded CPython 3.14macOS 10.15+ universal2 (ARM64, x86-64)

walrasquant_lib-0.6.8-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (647.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

walrasquant_lib-0.6.8-cp313-cp313-macosx_10_13_universal2.whl (521.8 kB view details)

Uploaded CPython 3.13macOS 10.13+ universal2 (ARM64, x86-64)

walrasquant_lib-0.6.8-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (660.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

walrasquant_lib-0.6.8-cp312-cp312-macosx_10_13_universal2.whl (523.6 kB view details)

Uploaded CPython 3.12macOS 10.13+ universal2 (ARM64, x86-64)

walrasquant_lib-0.6.8-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (650.9 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

walrasquant_lib-0.6.8-cp311-cp311-macosx_10_9_universal2.whl (524.1 kB view details)

Uploaded CPython 3.11macOS 10.9+ universal2 (ARM64, x86-64)

File details

Details for the file walrasquant_lib-0.6.8.tar.gz.

File metadata

  • Download URL: walrasquant_lib-0.6.8.tar.gz
  • Upload date:
  • Size: 406.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for walrasquant_lib-0.6.8.tar.gz
Algorithm Hash digest
SHA256 6bbd725e7e7093180153a224fe0e9d5d837e0dc0483b8e1818db5e49bc518b59
MD5 d37493469fffaff124cc89eabe08abad
BLAKE2b-256 df4840e3143faf573ab0fa83a03c30236a9287c7a0e09cd34e275cec7a2155a7

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.6.8-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for walrasquant_lib-0.6.8-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7fa894e6fdbf79b1f93c08225b753f90ff7c1f1d3df4dcaabae909ce55dc3e59
MD5 922b3189a28bf266800ab836ff7b30d6
BLAKE2b-256 d51924947bb3f92a7e1e50d2df92242374133390951f1b38e91297a4e4471904

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.6.8-cp314-cp314-macosx_10_15_universal2.whl.

File metadata

File hashes

Hashes for walrasquant_lib-0.6.8-cp314-cp314-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 16c6447892ec958a9cb8c570637da93d565356c79d6004b4cdeea5bf8e79e4cb
MD5 c8e8f2e3b0b6a8971216a6171cf0e30d
BLAKE2b-256 86d7d56aba558be1ec9523fa88a35db2e0d09435762c7ec019557907d8df5224

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.6.8-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for walrasquant_lib-0.6.8-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 80e0e38a0feb85e97b6a25da72d4bbf99563a917b9f6e7b27047353b639da57f
MD5 7a3bdf7bbecc6c5a6e2d6819e4a93db7
BLAKE2b-256 fe159aba497ea728663116be6892fde609a3141037d0fd133935e2885114adc0

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.6.8-cp313-cp313-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for walrasquant_lib-0.6.8-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 0d79eb0e8f70f84e677127122e59d0cce40154bece64f74381e4a70a049c47e1
MD5 b733363ef37fac0919feeddc55038823
BLAKE2b-256 74863deceaf570fdeb3a7c283505ae176c9208af2f567d79b33e755f2a41d4c5

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.6.8-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for walrasquant_lib-0.6.8-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5e0ba5a6fe0d9b65c8c918db4b773bb19a8b3df1a645a2edce43f2d8da9b163c
MD5 d2a5dca15004725f893e409173f9bec3
BLAKE2b-256 8f8701bc769d4e2417d922d55536b41557fe07ce49207b906d64f4c06ba1c678

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.6.8-cp312-cp312-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for walrasquant_lib-0.6.8-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 63586dd41d6755f52a5e18f271d8494657bf602f78d6f4b1bef17f687d8c7477
MD5 9b6d3f990522ff495e0cae22dce26fad
BLAKE2b-256 0e6471a5035b63628b41e0c8bc091a1c07dfc118abf64db8a98a690774e4b18f

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.6.8-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for walrasquant_lib-0.6.8-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 004255b8c2851afefac9f8c7b635893b977ebf05b4efb742a6b70b2ca8c8ea35
MD5 ec5bc50d08043a3066ba159268144ab1
BLAKE2b-256 1425b1bc15c8fbc84dbf5fbdaed36b1273b10ad6e2421d5bc45521a3ebc66408

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.6.8-cp311-cp311-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for walrasquant_lib-0.6.8-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 1e241d24450e4ec8cc18aeb7b05696ca702c11176c2efe33b64cc67a057e665a
MD5 0a1a6e1a61ebc490e1b5cf88d3d886de
BLAKE2b-256 148e2b153b67dbd6b06dac2bf626774e91447122adaf44dafbb786e6412e6d48

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page