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.5.tar.gz (406.5 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.5-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.5-cp314-cp314-macosx_10_15_universal2.whl (523.7 kB view details)

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

walrasquant_lib-0.6.5-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.5-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.5-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (660.5 kB view details)

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

walrasquant_lib-0.6.5-cp312-cp312-macosx_10_13_universal2.whl (523.5 kB view details)

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

walrasquant_lib-0.6.5-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (650.8 kB view details)

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

walrasquant_lib-0.6.5-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.5.tar.gz.

File metadata

  • Download URL: walrasquant_lib-0.6.5.tar.gz
  • Upload date:
  • Size: 406.5 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.5.tar.gz
Algorithm Hash digest
SHA256 2c281dfa5c2567b48801bac21231a2d5e83261bce99a98329c1bae42daae19ce
MD5 b7ed9c4fe266aaa0ffc151559a83d7e7
BLAKE2b-256 f71df9099bf5de7e46ee6dee1c418c94de2139b658515a8352193c737a2fb1ba

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.6.5-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.5-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 63ee4e62299fa1eed64170be571f62f3233602755dad214b2d42e6cf6b8c4059
MD5 be6ffef84a94f2b8473fab15bed740c5
BLAKE2b-256 b77b2209aca85d03c7a7e06008ba9f80d81e073ba40b36f90187ecb6907f2cd9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for walrasquant_lib-0.6.5-cp314-cp314-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 6eae8c9dc6f2ea4f2dfc05405e00943d8f6cf050da7eff199fb67ba64d90fddc
MD5 d0f4cdef3afc156c9954b1e1b4f37048
BLAKE2b-256 1abab564b73f74aa522f0820c2b7cdddb9918886ac0c540137bb9b182fd196ac

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.6.5-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.5-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3e4dfaea5811fbf3b47b891e642a37368cbaba447fe1054c4c7fac759ecbab46
MD5 5a9d0e50d9526375127ee698c56b2d18
BLAKE2b-256 e3482e7287acf39b58d77757a4cf5dbe8acdb6c5c75370fc9f5f4dd7652fff8c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for walrasquant_lib-0.6.5-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 9ddf0eedd5298a45151c7fabefdfa65759075b45e91e7ce08b6c3e26e3475d24
MD5 acd7b356177a496b088e5bccb1dc7ff9
BLAKE2b-256 7a21efa590a1be03e7fc96092f942db99f03b76505346cbc8ad95d6dada59b20

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.6.5-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.5-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 bb0ba849f03e855cdd217bae4a30ab3ca2716b5a6366223b2fcb5335cb684fe6
MD5 ea2d25c7525939d6b7d474d1daf3525c
BLAKE2b-256 61f2a5d04bf9f66a9a2623c0943e77dca97e4bf49fcbc11a5604dabb1e1442b5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for walrasquant_lib-0.6.5-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 f717a76a9b6c8b7164e76a1c4434b2f3c966f273bddcc942b92b31adba889870
MD5 ff457b75760dcbacbca12c64c52661a9
BLAKE2b-256 dc4a94d27dff1f882e540685cf59b004cdc2bf0af92bf04635a50defed492c5e

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.6.5-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.5-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 93efe43b64856ddd41f275ff135eeed5e00fe2e8af686db3447577e629ed8a34
MD5 b22fad7b343b334c3fbb20d16c98fabd
BLAKE2b-256 30694f46bc9899493e0d65d2fd0ceda35319a8ec45eb8b396d6f491be786aa30

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for walrasquant_lib-0.6.5-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 d9afb9dbe3e9e81ce7cdf0c3bbe204f13925aa52a07246fe8af9d200c763f5eb
MD5 d4ce3dd5b57ca051cb687967b44ee073
BLAKE2b-256 301011a6aecfbbe9588077841ac52143dc83055e3ef9b0b5d7f7bea23209d558

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