Skip to main content

ConvexPi Arena — discrete-time limit-order-book exchange simulator

Project description

convexpi-arena

Discrete-time limit-order-book exchange simulator for quantitative finance education and research.

pip install convexpi-arena

Part of the ConvexPi platform. See also convexpi-lab for the daily-data research harness.

Quick start

from convexpi.arena import Market, Agent, MarketState
import random

class MyAgent(Agent):
    def on_tick(self, state: MarketState):
        if state.mid and random.random() < 0.1:
            return [self.limit('buy', round(state.mid) - 5, 10)]
        return []

market = Market(n_background_agents=20)
market.run(ticks=1000, agents=[MyAgent(cash=10_000)])

Run the Arena server

convexpi-server                          # WebSocket on :8765
convexpi-server --tick-interval 0.2     # faster
convexpi-server --admin-token secret    # instructor console

Connect a remote agent:

from convexpi.arena import RemoteAgent

class MyAgent(RemoteAgent):
    def on_tick(self, state):
        if state.mid and state.position < 50:
            return [self.limit('buy', round(state.mid) - 5, 5)]
        return []

MyAgent().run('ws://localhost:8765', name='my-agent')

Features

  • Price-time priority matching engine
  • Background agent population: noise traders, market makers, momentum, informed trader
  • Avellaneda-Stoikov optimal market making
  • TWAP execution agent
  • Risk engine: drawdown limits, position limits, force liquidation
  • Crypto L2 replay (Binance / Coinbase candle data)
  • WebSocket server with admin-triggered volatility shocks
  • Rich terminal visualizer

License

MIT © Shane Conway

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

convexpi_arena-0.2.0.tar.gz (304.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

convexpi_arena-0.2.0-py3-none-any.whl (44.9 kB view details)

Uploaded Python 3

File details

Details for the file convexpi_arena-0.2.0.tar.gz.

File metadata

  • Download URL: convexpi_arena-0.2.0.tar.gz
  • Upload date:
  • Size: 304.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for convexpi_arena-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3b02e1a29507960d843f4c7245d323511a03071c63ff5bf20527a5be30da3123
MD5 be5dec1879792c48366ccc62653853c6
BLAKE2b-256 bc20270dae3d65f0ef09ef4c95c39b273bdbd064a5cc2d4048d5a9fb8ae1c4c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for convexpi_arena-0.2.0.tar.gz:

Publisher: publish.yml on convexpi/arena

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file convexpi_arena-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: convexpi_arena-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 44.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for convexpi_arena-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ae04bc86448a82f882b482f69930ed4b87bf722b2c16141c3afcb75dd0c504e0
MD5 4db7fa4a098b61c75567d52250d5a8e7
BLAKE2b-256 c2eb071573691d4cd1c4b33ff14c279f810c1860b73645f1b3b055868ab292fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for convexpi_arena-0.2.0-py3-none-any.whl:

Publisher: publish.yml on convexpi/arena

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page