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.0.tar.gz (395.0 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.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (636.5 kB view details)

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

walrasquant_lib-0.6.0-cp313-cp313-macosx_10_13_universal2.whl (510.5 kB view details)

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

walrasquant_lib-0.6.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (649.3 kB view details)

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

walrasquant_lib-0.6.0-cp312-cp312-macosx_10_13_universal2.whl (512.3 kB view details)

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

walrasquant_lib-0.6.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (639.6 kB view details)

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

walrasquant_lib-0.6.0-cp311-cp311-macosx_10_9_universal2.whl (512.8 kB view details)

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

File details

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

File metadata

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

File hashes

Hashes for walrasquant_lib-0.6.0.tar.gz
Algorithm Hash digest
SHA256 6cbb664f3c71232983bf94cd31ca338995aeb518c71714943dfbe3e5c5fa7024
MD5 d824f33bc8266a964b6021d151e73cfe
BLAKE2b-256 f09deae8be29c6a0ac16b3a795224037d1b69dcc3120cf5f10b431e252d9d274

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.6.0-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.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 eea2fc50a9e93c1fee94472bfb3b26efa77b568bc2ed5a570676d6bc3eb824f0
MD5 5e92379cd4b0ac3f729ccee5d5929266
BLAKE2b-256 926dc702944657bcea4a8e32acbb74fe1f55de6910757fd02766500c2e2ac574

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for walrasquant_lib-0.6.0-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 3dec8ef60a77455349ad280bd051d7b3342e654356800589d57e42aed4475723
MD5 0d93edb074dc8435ed4daf8b2e4a8ddc
BLAKE2b-256 9ad0bb9581ec5538d6c1aa9726f3aff07e742dda6c267d72cfe47a25e8b88549

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.6.0-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.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e9a398143ec678a200f0c0fc84cab92073e3322ae5ed958f24313a21b460772e
MD5 816ce1ca86abcc63a1324005e661c041
BLAKE2b-256 ada798d20a3462fe487abb4947758db94607edfe7f4a41934a9b0b5ff5543a67

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for walrasquant_lib-0.6.0-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 6ba5633d22292ef4390290f6c0eb7b2b3de9c4be3faad61854bf39b424cad401
MD5 0b8edc837a1ed735da3538c9d48c8c17
BLAKE2b-256 67a26a1f345306f5010352e0523bfa800111aedc51f8c31e33c4ce80397ba65e

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.6.0-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.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5cb30b6de5f2bf9ad3ab916d5b79eaaab0b9f44c32f048885b92e8a7b7283f9c
MD5 bc655c7fc1f40e1c8daa2864b3743f40
BLAKE2b-256 8f5c78a1697a07ab8c11cc6c6930b7baa10c0592d50641439000df2f42830e07

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for walrasquant_lib-0.6.0-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 329a410f4e2ccd87b05d5b5871221696dbbf4e00853385063e22e8d0a5fe1d4e
MD5 932eb67ea21a66b66234adca4057e4df
BLAKE2b-256 f5a75ecfae42e9111a79e5bcf80160cef6cbae89c27d511a8217408b2a73b804

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