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.5.10.tar.gz (372.6 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.5.10-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (611.8 kB view details)

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

walrasquant_lib-0.5.10-cp313-cp313-macosx_10_13_universal2.whl (485.8 kB view details)

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

walrasquant_lib-0.5.10-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (624.6 kB view details)

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

walrasquant_lib-0.5.10-cp312-cp312-macosx_10_13_universal2.whl (487.6 kB view details)

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

walrasquant_lib-0.5.10-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (614.9 kB view details)

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

walrasquant_lib-0.5.10-cp311-cp311-macosx_10_9_universal2.whl (488.1 kB view details)

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

File details

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

File metadata

  • Download URL: walrasquant_lib-0.5.10.tar.gz
  • Upload date:
  • Size: 372.6 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.5.10.tar.gz
Algorithm Hash digest
SHA256 c9c3502fcd8f864d912b2441b9f267651e03fff018227edd7fa43d7f78ff0abe
MD5 8ab115eaad019dc1bbb9f82dec306254
BLAKE2b-256 a9b280a403145c3ee448879040139349096bd682eb67f1c38e99cdca725a2ac6

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.5.10-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.5.10-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e87a1f7ef288e3262808a1b8621904880fab220d4253c7a696edad52b9a51ebf
MD5 5f293bd387ec0d9eca70de650fb46d3d
BLAKE2b-256 2c0c923c9c6b8f8c1ab85b7629eee2de9a5b0e563e26c1f0f0bdc5b0919c9751

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for walrasquant_lib-0.5.10-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 ee7a21ee4c05634ffd9de1edc090c39f6dfe95294e58772f9984bfc5db245f05
MD5 0a140b89fe352fd9efffa9f892be81c9
BLAKE2b-256 1a5769d8158144fd1119fa174e69b954c1d100b5ecdea45045a515e8a9a29063

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.5.10-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.5.10-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c00914412f78965cb3356cf68d22379331b8a133238986a83c2b570e1f5fbdb1
MD5 76b1b11e2918dc69b82eaa6fcd2c04bb
BLAKE2b-256 ea55a8752b7ac6fe798d55c07b97c36225393d849e982192f7e3333c73c80130

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for walrasquant_lib-0.5.10-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 12ed6adf63d92073b1ca485b7eb830ab8ee35ca0521954752a7e43c362acc5db
MD5 3e0749e1a814db0072aae8193de31bad
BLAKE2b-256 c098a61920d901fe3c484d6b76089db7d21629c04a33cc6a3968cfea2ab5707d

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.5.10-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.5.10-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 90ce75abb287e03ba4d0813335b1605be9a01e790265a854aacef04b161273f8
MD5 f23f96b63abdf3c14b1a60e0aa51c9c8
BLAKE2b-256 599b90e632d96d07f9e233a4838db800ef16567920e7ff21bf3faf5318726278

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for walrasquant_lib-0.5.10-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 45016e8d5903cabf59312172185214917271984195c8f6ace8341d65c7398e18
MD5 92c32e06a043f6800a9962ffb19201c1
BLAKE2b-256 9f2cd579a0c969786ac9c8fc8f1572dd1d4d01b7d0bea001892bb13bf066070b

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