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

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

walrasquant_lib-0.6.4-cp314-cp314-macosx_10_15_universal2.whl (523.5 kB view details)

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

walrasquant_lib-0.6.4-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (647.5 kB view details)

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

walrasquant_lib-0.6.4-cp313-cp313-macosx_10_13_universal2.whl (521.5 kB view details)

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

walrasquant_lib-0.6.4-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (660.3 kB view details)

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

walrasquant_lib-0.6.4-cp312-cp312-macosx_10_13_universal2.whl (523.3 kB view details)

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

walrasquant_lib-0.6.4-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (650.6 kB view details)

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

walrasquant_lib-0.6.4-cp311-cp311-macosx_10_9_universal2.whl (523.9 kB view details)

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

File details

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

File metadata

  • Download URL: walrasquant_lib-0.6.4.tar.gz
  • Upload date:
  • Size: 406.2 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.4.tar.gz
Algorithm Hash digest
SHA256 a45a23d19af0b8e26209679d16d916da1c9f0a2e3f684a2592ed996f293366a4
MD5 10317b1db0ccc36a3cbcde8aef43d899
BLAKE2b-256 6c985fb813ac3349d77ec6b219cf347b748351fac4cd37b30b5ff05b8fc4fe40

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.6.4-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.4-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d2bbe298a718f468b479999efc3be634e39755ece839a12eab2bdf8e67e3dc19
MD5 c5d63834710376abb42f0a64667b8f64
BLAKE2b-256 b59f9cdac510847adb7e31dcd6e18da57e48c01efdbd2c27b86bee7e284ef369

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for walrasquant_lib-0.6.4-cp314-cp314-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 b95990a596440ce2c127c62d72890d3411a0bc520a4a64fbb68a0f80c8e5803d
MD5 bcdd6d644198e911c03ce0e6237e7bb3
BLAKE2b-256 97d4cfa4aabc319f9781d2a4b032e1750fad3b8065555237a7ca4ffdf3e35cd8

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.6.4-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.4-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c8445cf3b582cbea29d6ce347d3abe18d44ee0353c2641055da49e60f6e3ae6f
MD5 d75ad5c62600d05dbac66359cded4a55
BLAKE2b-256 1a9eeda8ef780531d0ffe8585cfa7db360940541085942c2eb578aef8762986a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for walrasquant_lib-0.6.4-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 862c1507f49bb37da7d974c33789b062a099350fea929ca5282cf360d16c7f48
MD5 c89e43ff4beb9450a30a9f1a95430596
BLAKE2b-256 952d4a43bc39b52a3a0418706f9c400d17540cfea3acc478a609347c8c649002

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.6.4-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.4-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 11704d51ad203270ea886998bc7d17fb3505d074ea75f5b976bd68f66223cf8e
MD5 80035ee80f62b86bb3ca3d542152aaab
BLAKE2b-256 8ab19ef360f823a3bcb63d29d467208077f526a952c229f6ba4c7214c0e8d08e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for walrasquant_lib-0.6.4-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 97082d64913ff170737aed87bfbcdd3fa8797fa9a6f8473932be6478b30b86f2
MD5 c9120be0d16fe33405815bad98204f1e
BLAKE2b-256 c539d51e02af32a555ca3ae3158b30d9a156d0bf09596b0fee3f94922be7ed61

See more details on using hashes here.

File details

Details for the file walrasquant_lib-0.6.4-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.4-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0be566d733fde08ec987ae6eaa4351a3df5e983913b8727ee9076c24bae51b38
MD5 84f9adcdc594b10828c8c27654bfc23c
BLAKE2b-256 3ab597a1d9c0f51591404bd727a921f684fb701cad7e246aee7c195304b0a8ab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for walrasquant_lib-0.6.4-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 3dbd9fd45149ed3ccfa1ea4fe4916411b9716639b84963eb21277b848e826ce0
MD5 8bb89cf6c7786e73e92b92f3c1f56828
BLAKE2b-256 865253f278d3c5b19378a6c64ba80f0c1e40065e5f45328631c8e3e345517995

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