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.9.tar.gz (371.3 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.9-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (610.4 kB view details)

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

walrasquant_lib-0.5.9-cp313-cp313-macosx_10_13_universal2.whl (484.4 kB view details)

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

walrasquant_lib-0.5.9-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (623.2 kB view details)

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

walrasquant_lib-0.5.9-cp312-cp312-macosx_10_13_universal2.whl (486.2 kB view details)

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

walrasquant_lib-0.5.9-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (613.5 kB view details)

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

walrasquant_lib-0.5.9-cp311-cp311-macosx_10_9_universal2.whl (486.7 kB view details)

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

File details

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

File metadata

  • Download URL: walrasquant_lib-0.5.9.tar.gz
  • Upload date:
  • Size: 371.3 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.9.tar.gz
Algorithm Hash digest
SHA256 66603d882e1c600b11aa493a96789cd3296c47a3d8bbad2823db5a4420385834
MD5 70f5c148fc5491d16fa798404b0f34c8
BLAKE2b-256 9a4c181de6253fcd8841b00be3c2693d24a96bf344dd3f222a5d865596700594

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.5.9-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.9-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 eae1fe8017f6e5b451dcc9afe6574e7c0bb1450b6b5b93f541567e7fca9bef8b
MD5 69aeaf868de3234b0bdcb11ca2a75d1b
BLAKE2b-256 fd49dcd25aab1ceb16509316478ea2993c05cb674e49685e9d414f6f8a7a3d2a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for walrasquant_lib-0.5.9-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 8113aa872db08eefb236facfb3b0ef9301df84bd92ed346d7c8ea0ff3ddac29d
MD5 44e99614bb431420f81d4b163584ba49
BLAKE2b-256 3f921ae7ef3a79ee0dcb89b7f7e0240fabb6fc66eddfd2439e2d85f61af165dc

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.5.9-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.9-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 13437726eb6c0cf8912e855b7a3580277209c9ba46b20e5b6587c3cbeaa6277f
MD5 067eff1d0155fbd4d0355fcd1509588d
BLAKE2b-256 4d4d6c576cc83a18d659a5fc4135fe5947c5654049aca3a7ecb535f79aed83f6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for walrasquant_lib-0.5.9-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 0dad2ad0ca2f05fe162c8f7709c428262a442feb19f23d3a1157c660a1c9645a
MD5 53ad02a56e211f0ef8383933eea51aa2
BLAKE2b-256 64faffdd976ecbe71481d2658e5a11c79587fff6e539f9f1973a2c45b6bfde29

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.5.9-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.9-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 53c35afc4ee2bd6b18e2ce5b7619127d79b9c77f6d696665ab800fa20bdacf3e
MD5 988cfdcf814cf3ab337506e14aa23437
BLAKE2b-256 c583a91fe25eb7f8e3556008b9df586f39512bfd909c5075dea6e921178f54d8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for walrasquant_lib-0.5.9-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 da99beff8548b6fae16f8d6d71ec7c43e53edf5a8a38bbad9bcd2889ca63c6ab
MD5 57833cb177ace0359874aeea0c04115f
BLAKE2b-256 34364034fb23bcf71a05479c5ada938bd4c79a8a77f53c2682cc24633101b328

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