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.11.tar.gz (372.8 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.11-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (612.0 kB view details)

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

walrasquant_lib-0.5.11-cp313-cp313-macosx_10_13_universal2.whl (486.0 kB view details)

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

walrasquant_lib-0.5.11-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (624.8 kB view details)

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

walrasquant_lib-0.5.11-cp312-cp312-macosx_10_13_universal2.whl (487.8 kB view details)

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

walrasquant_lib-0.5.11-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (615.1 kB view details)

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

walrasquant_lib-0.5.11-cp311-cp311-macosx_10_9_universal2.whl (488.4 kB view details)

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

File details

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

File metadata

  • Download URL: walrasquant_lib-0.5.11.tar.gz
  • Upload date:
  • Size: 372.8 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.11.tar.gz
Algorithm Hash digest
SHA256 a3ea29883b35b27516d596a3ab35ed1b090b29ce4215abf98a516b537f97b21f
MD5 b90f1319b45114dfc1fe40ed50a254ed
BLAKE2b-256 d1c0a2a51ce05f38123cd17554de1d7ecf1294baf9e6090567d125fbabe5d5e0

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.5.11-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.11-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6576a5abdc52cf5c41231b25123d5ac11fdb974c59059ab8880b21d1e05248ae
MD5 4901bdff761ba7a9cbf2f142228110e9
BLAKE2b-256 9dacfcc6ac14ae3575ecfac5635a3e30102137a90d1a24a48f479bad461b668c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for walrasquant_lib-0.5.11-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 4e3f3b7adfb7c5745ec6c37bf7e4a858db12199ea4696773d8a39448c2ca8dd5
MD5 b2d7ecc88bf13337f447fded7bdc168b
BLAKE2b-256 01cdfa2508630cbded5336b0f2705260ea8bb8c3c4c965a75c3add08c797fdc4

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.5.11-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.11-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 225598508fbcf1ff72c511efe10d3dccc0dd8c68d5bc21318d290a6f322473cb
MD5 a8d8d21f34fd9283c2042ed00df8f526
BLAKE2b-256 2ba30b078f63c881ba79be8ed37d1add3e875d21e7adaf1a22ea1250134782f2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for walrasquant_lib-0.5.11-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 abb3f5afb3cb188341fad228afcfd3aecff72bc2daa2898d376b98fb0d53aff6
MD5 cc84365f500bd03f4975855ad1a4a339
BLAKE2b-256 3b12f1cead0d4275959288442d61d9a256b6845cff73053f293dbc64444a0eb5

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.5.11-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.11-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8911901ebcc4cdd5fc92c2e01a4c2660c9b4f9b0375b388df904befa1b4677d7
MD5 c9c5b599d6e966135a077ef4c1315db0
BLAKE2b-256 5897f10b174b2a9d6282d9d16b8a64d8ae978afd69d125585ad5da1714fbcfc5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for walrasquant_lib-0.5.11-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 6693f436df75cc1e243847faca0d7f2727e3061ecd5d2326ebbbc170f267296b
MD5 d85cb0894b9af1b0ffb20f304ed684dd
BLAKE2b-256 7d906543d60ecee13c716b5cbaec01c5bc5bb11c02eb6c7008a2c9a0889d35ea

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