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.1.tar.gz (396.1 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.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (637.6 kB view details)

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

walrasquant_lib-0.6.1-cp313-cp313-macosx_10_13_universal2.whl (511.7 kB view details)

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

walrasquant_lib-0.6.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (650.5 kB view details)

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

walrasquant_lib-0.6.1-cp312-cp312-macosx_10_13_universal2.whl (513.4 kB view details)

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

walrasquant_lib-0.6.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (640.7 kB view details)

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

walrasquant_lib-0.6.1-cp311-cp311-macosx_10_9_universal2.whl (514.0 kB view details)

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

File details

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

File metadata

  • Download URL: walrasquant_lib-0.6.1.tar.gz
  • Upload date:
  • Size: 396.1 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.1.tar.gz
Algorithm Hash digest
SHA256 448113353e9b76f791b575dcba3dd6e57b3c21b0dc0d28e60a52f69b921cbda6
MD5 adcaf3149c99cb880767c8fdb23eabbe
BLAKE2b-256 c2ffa9144d899172492f0fba4dfdb793c7e7ca2abdba309aad5fa526227a89f0

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.6.1-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.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0ae6ae942c1200a39a34bae8c318251025b60f2fe67357bbd88dbd812bf94bea
MD5 cb19beb3ae33597c596c576e382e520d
BLAKE2b-256 ffc9c81daaa4efc30c5d27276f853cc5bf582762c621a50ba7dcab051f73555f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for walrasquant_lib-0.6.1-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 88f465d52ca203667b4e97fa273163e1f22db6b830574afa4c3fa36478546611
MD5 49353f228e9af0d66017409d0cdc1e4e
BLAKE2b-256 ae4d7060db99fd3b4e80028b6c6b335b147534b0a253e1c3ad8121d5d8ca6488

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.6.1-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.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 90f6d909a7dbe4ede7121c85f0698b87e29ec5e310c3684ea2d8ccd49602ecfa
MD5 8920865c953c8bded1efb1e54b47a374
BLAKE2b-256 4c53175e4f9cb41f7861e30a36f9f48c3fd3ded48e2c76942fd2983f7c00a6d7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for walrasquant_lib-0.6.1-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 752fed70c7ab8d5fe63438324b33dacdd42c8ce2004ddd05c2205ab83d22569d
MD5 cec764073130ea90767f4f16d005c407
BLAKE2b-256 9b4082043eb486e4227a51f9916382624e8607cb9b8b3a78dcb32fe92c7f4e8e

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.6.1-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.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9cb57b6ce6554eaa1579d16e6fad88cb936284bf6786541eb1d6c6946ad3a0d2
MD5 2ef8626b1f9db19f0f92b60aecbae4b8
BLAKE2b-256 a5f6fe3cd43dcf6aec0a6940cc3d57f9145ca48efbe7102a8d3b4a75daeec071

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for walrasquant_lib-0.6.1-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 8900e377a70fdbdb87719b4232b501b3f4d30d55ed6af483e8f20dcd47476e20
MD5 7fa21b141c6d84543420ecdd599542d9
BLAKE2b-256 268af21d164b855f4c86d592bee7467e1732372b48da5f9cfc5dc58bdce2c0f2

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