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.2.tar.gz (396.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.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (638.0 kB view details)

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

walrasquant_lib-0.6.2-cp313-cp313-macosx_10_13_universal2.whl (512.1 kB view details)

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

walrasquant_lib-0.6.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (650.8 kB view details)

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

walrasquant_lib-0.6.2-cp312-cp312-macosx_10_13_universal2.whl (513.8 kB view details)

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

walrasquant_lib-0.6.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (641.1 kB view details)

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

walrasquant_lib-0.6.2-cp311-cp311-macosx_10_9_universal2.whl (514.4 kB view details)

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

File details

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

File metadata

  • Download URL: walrasquant_lib-0.6.2.tar.gz
  • Upload date:
  • Size: 396.7 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.2.tar.gz
Algorithm Hash digest
SHA256 5cbdeed53ec8476c47b249b5a421dd60d37a77a49a91bf93fce9e24e597ae2d2
MD5 0aaf41782d4fa6a3859a44578cd6434d
BLAKE2b-256 aa30e7b1a8d5780eeea7fc977b9da104d994b97bca54a0da67132750762704f4

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.6.2-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.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 53d541518cbc8e3f703f7b7214897f93d6d94a008c3c7fdcb86b67787564a025
MD5 6f19625a11e5344c95d51c763fa3c45c
BLAKE2b-256 79eeb4a8aa91abe877368890ed385fa4feda4dfc0e0ff9a347200e5f0a9f9867

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for walrasquant_lib-0.6.2-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 23726d0c453fed3496f0cb8a4ce55fb4708b8ac7b98a25105e9c2cfa5495e761
MD5 5dd1418c853b3c9271319fd954a0f63e
BLAKE2b-256 1484d890e2024e332c68c1b153211f7de71f22a9abbfb7affe5d92445deb1db4

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.6.2-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.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ad6599d98c1d337642504e55fb524efca77eda18e620fa0f20860d535000a1d5
MD5 854c7089c7a2de31c560574dfa5fc691
BLAKE2b-256 697810b05cfaebf2bcd616fea7158188d4b0bdecabe24e1d235ec8c4120734eb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for walrasquant_lib-0.6.2-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 b75a73bf1e89ddea09dd4ef24087dddeaed5cb2066be27c606d9a1dfa86bdab6
MD5 711a03bb43434c778b2ff358145473a5
BLAKE2b-256 7ee8f04110fbf81a14a902b834f837abe2b45156b9c7745510536bba7cda55d3

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.6.2-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.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7f71d8a4e1d0c798a5635ccf44c64682b07219d18e6943c77d01e63bbc2610bc
MD5 aa2f51bfe557eb5d0f6646792087416d
BLAKE2b-256 9b6c46ba2b33b194ef758632b39024367c2c403cd3b107af2cad98d6567882bc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for walrasquant_lib-0.6.2-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 b3a51f5393002bdcc638acd56416735e16b93ed8974c15f3babeb2852b7d9dc1
MD5 1f96074bb5951201d17cc97484af5b6d
BLAKE2b-256 3779bcc44d632d599a8e7fbd2ba5c70f45c20b7d0bbbf5c5eb60b326d24d3cd4

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