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.12.tar.gz (372.9 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.12-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (612.1 kB view details)

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

walrasquant_lib-0.5.12-cp313-cp313-macosx_10_13_universal2.whl (486.1 kB view details)

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

walrasquant_lib-0.5.12-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (624.9 kB view details)

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

walrasquant_lib-0.5.12-cp312-cp312-macosx_10_13_universal2.whl (487.9 kB view details)

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

walrasquant_lib-0.5.12-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (615.2 kB view details)

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

walrasquant_lib-0.5.12-cp311-cp311-macosx_10_9_universal2.whl (488.5 kB view details)

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

File details

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

File metadata

  • Download URL: walrasquant_lib-0.5.12.tar.gz
  • Upload date:
  • Size: 372.9 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.12.tar.gz
Algorithm Hash digest
SHA256 52d2714d39213e86179a4d2faf17b4ddfcd216e71ac3f5c63977b35776f8b59c
MD5 668e4ff907868d7f78b6a167c1c629fc
BLAKE2b-256 ba5b4a205ee88753eaba9cce799a17205f12ccd589d8be4c7cf2d99cb160f89e

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.5.12-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.12-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 382d32b819095169f5167dab14072eb8b6843e8d3dce1b971a3405a53d1f7f22
MD5 918cf9b712e062ea9782a217c32ad607
BLAKE2b-256 eeffcc0fc8ada84a042ed2030873a402688262994e1e4aaf6015c4e6a2da3c18

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for walrasquant_lib-0.5.12-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 fa3efcddbc26b06347bde9f19092b4be0c04bfaa16bdc6e4295112e79118a995
MD5 10264ca7f725a69c6c47f816554df33a
BLAKE2b-256 7c61f17c3cd6d96d71446132e04c8521c8cf57219dc8feec3b0c0325f5df65c0

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.5.12-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.12-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 402642a3e185eeca3ef719f063486fa046a1bf23a735be2526c502b8aed4fbcf
MD5 f1f1c53ef2e3b380f94b7b71cfd79672
BLAKE2b-256 d9c0844fac7eee4242041c06f09367cf0a7896c29f78e941aaa95f2cc970d8a2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for walrasquant_lib-0.5.12-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 368ec0d577708b8f4f29dc2adcc2ed77c3d112dca48b15951996532304443052
MD5 6a40e0407d2c287848113fc88fcfcfdf
BLAKE2b-256 8a35b08246521acf5c92a00e7b4e05af3782fab72c82ea50425fb17307453be4

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.5.12-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.12-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7586f7e7e01f49e228fac93e3c84ebf4974000d4eed6fd95e570dfc224bca570
MD5 111dd8c5ee784355766e3838ad3cd68b
BLAKE2b-256 a16c9db5ba3e4369ea9b8456b23733a73ffa161261aa7812c3fa343f7100e52f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for walrasquant_lib-0.5.12-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 c036728fe00978b50359db1a91bd4dd937da3c4dd87a7ae65bb4c78229fae6af
MD5 a17979ed9eb1849621ed1d68ca7ae6e1
BLAKE2b-256 0d76cbf675166f84d57e8f6c9b7645af238eb1db901e5e0bcb3daed196b9a898

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