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.6.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.6-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.6-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.6-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.6-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.6-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.6-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.6-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.6-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.6.tar.gz.

File metadata

  • Download URL: walrasquant_lib-0.6.6.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.6.tar.gz
Algorithm Hash digest
SHA256 ffe52323598736351302a1bf143a3c57a16f7b13d6ec0567983cadd132fec84e
MD5 58a7d9a40026741fc604fffccb2c82d9
BLAKE2b-256 75816dad8ebaffedd1ebdf481699eca4a00f3712eba9264b6f795b4a66a49f50

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.6.6-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.6-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 88e03970a374a33cbd4b71c258785e69c90c4399b822eea5ee6a303e73310f0c
MD5 873f438e5c274d7d11e332e7779be453
BLAKE2b-256 f6faff3ed6a8106598bda40f8eae87734ad35a750fb9695e120544c8fb71bf19

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for walrasquant_lib-0.6.6-cp314-cp314-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 0ae300ad8ee372cb89bbb0a3e4fd4c4f0549233c38ced5c439f43628bbf711e4
MD5 14545046e5223af1a782d66449d0a711
BLAKE2b-256 b665b399b4fe7850d7d383db44b697698a89baf88f239caffa805a973b982053

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.6.6-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.6-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4fb8b726607caf4e4cdac7fd7d80b77674bd7ef3425ba96e163304af6dc6a8fe
MD5 7bfa3c40a36d400a785911c77e81d77c
BLAKE2b-256 0a9b5ed8a2e42590098ece9fe0ed9b4531c5b3daa70b07b21e009f128b9eaed5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for walrasquant_lib-0.6.6-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 97f070084e73771e8ad90f41fcc5944af6415c6bba653d14782c4f0a0baf515d
MD5 c0ca84b9de12d435ae494c4d87dcf04c
BLAKE2b-256 597d9ae7937706a5c7072bb48d5f689aaeafa0eaba38a650312db11bbc444613

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.6.6-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.6-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 292cfe22e0634b0f61d54259ed2896c27c003f48d32772b46b86acbb6e5f7d3c
MD5 ccd69c995704a8d379b58e2aa329df4c
BLAKE2b-256 2b8f8ae9ab9be6b8fbb2c587ac32c31306cee37b8975de6fd0fe1bc845f6db39

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for walrasquant_lib-0.6.6-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 83c3d82cf692e5ca9643c1ab5b857a68e99c9bb724438a50e61beab228cb81cf
MD5 60bdede0016b2c70ac8e8911250e19ab
BLAKE2b-256 e3177fafeac88b8cbfbaebb7bf2c7396573730cbf84c5483f7eeb5e233bbfa28

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.6.6-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.6-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e77c3149985f5335cf7fd60518da0604cbfccec7d92cbb6204d7d73defcd907f
MD5 1cd80e2c2bb287fee274c1f00a857402
BLAKE2b-256 3cbfeab51c07d93dee1531e11adcad78b5415feab44d20e2ce69ee9e0fc70ee0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for walrasquant_lib-0.6.6-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 669550ed80a59ad224239cadf7cbcb6c58e09e3145f7b0ead0ab4901aeab71e9
MD5 866dad69b009ed64868aa3017e59372d
BLAKE2b-256 e4671707887a46d144b2554d0abf077abf915d06e7a4c5202329fc50aad1b54e

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