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.7.tar.gz (406.7 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.7-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (648.5 kB view details)

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

walrasquant_lib-0.6.7-cp314-cp314-macosx_10_15_universal2.whl (523.8 kB view details)

Uploaded CPython 3.14macOS 10.15+ universal2 (ARM64, x86-64)

walrasquant_lib-0.6.7-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (647.7 kB view details)

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

walrasquant_lib-0.6.7-cp313-cp313-macosx_10_13_universal2.whl (521.8 kB view details)

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

walrasquant_lib-0.6.7-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (660.6 kB view details)

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

walrasquant_lib-0.6.7-cp312-cp312-macosx_10_13_universal2.whl (523.6 kB view details)

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

walrasquant_lib-0.6.7-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (650.9 kB view details)

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

walrasquant_lib-0.6.7-cp311-cp311-macosx_10_9_universal2.whl (524.1 kB view details)

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

File details

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

File metadata

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

File hashes

Hashes for walrasquant_lib-0.6.7.tar.gz
Algorithm Hash digest
SHA256 b0f0c91d4d40f9b0e8acb1ce58d879d78f2afb68207f10c000e3967e59422ff7
MD5 c6bf9525c90db7c50ee382f4f5c7d3d8
BLAKE2b-256 165cc2aa11658a4c08f34bbd41fc6d41c487293eda8a01ad97598d1f7992b4c2

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.6.7-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for walrasquant_lib-0.6.7-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cdff7784598bcd16beae32f3eb6412cd6deb343938b58d431d23e6b832831ff1
MD5 84acbafe512ea5d5056f1bedd52e53ff
BLAKE2b-256 01c144e5fcb82cf9e93c415694410f972dae189dc64d43ba7b59087588699328

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.6.7-cp314-cp314-macosx_10_15_universal2.whl.

File metadata

File hashes

Hashes for walrasquant_lib-0.6.7-cp314-cp314-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 f55ed497575f760f7760d71e2e0e2e051fe77b8b80808b59f0b5625442a90ff5
MD5 ce9a6450225b541c5a7546f17999c492
BLAKE2b-256 ba5a9976207254561e7c6e0727cb02db1aa5567161a4109dbc602a4cac6075bd

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.6.7-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.7-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0f36b4ec88804d7b08085903ebe5a12a7ce4f9ebedc621d23dfc3f210980153c
MD5 647a723ea0fab7a01cd4abe8b2c93b08
BLAKE2b-256 9e449c0e307ed1947b6b1a84114ab534a7dfb9ef4bc14802517fc124466e41bc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for walrasquant_lib-0.6.7-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 1b8e1d88c73177ff49aa3a445ea8d4421501b92217188ffb42360cce782e7aca
MD5 483eb93d2f693002a89c756cb71ec505
BLAKE2b-256 19c89b8dae2350d790e0fdf7eac2fd8d33737e11b36e533d38cf3b09bffe18c5

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.6.7-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.7-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e88a14787c44f996567b064201f781e1dbe19ef0ef00631520f3e032231eca4c
MD5 10edbfc3fe9d0165957b21be040a6c75
BLAKE2b-256 71a1f7f1d70163a1da22e9b7e497ac6c85968c5879098f8c4bfeee45b7626d0b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for walrasquant_lib-0.6.7-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 327fa47da0bd400d83cb08f5c9d032345baca43697c5d957834f88744552ab2a
MD5 c636754f4f3788e7ed08d2c4a52c2915
BLAKE2b-256 7fff1a6e5738c974209c2f647edf64861cb7144f225a548c63853652b5de9d42

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.6.7-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.7-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2d27a4ff2483cab0a2e0f4cee3600b2d492e6c6a98164b7b9e154ae9c0f9c250
MD5 598a726c0ae25ae7fc0dca8212557d05
BLAKE2b-256 57018ca0caf2bcf72978a1f32bb6cfd821fd4cfd12af1c574bf2c153fcd77a82

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for walrasquant_lib-0.6.7-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 f3739455d3d2cf4490cf565366eb416b400febae4fe4ea1a938ffd940c85bf1c
MD5 c9fb65cd0722239d351576f4b86959d6
BLAKE2b-256 34a0f7beeea507c4ee2da01eb790a256b73199483c579e71a545b1cca3478031

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