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.1.0.tar.gz (40.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.1.0-py3-none-any.whl (33.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: convexpi_arena-0.1.0.tar.gz
  • Upload date:
  • Size: 40.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.1.0.tar.gz
Algorithm Hash digest
SHA256 06d525fea96fb0457863d36ca063957aa7ad55f0e9bb23933ee3178b7b8b4e46
MD5 8835f7827beebedfda2fc9b7dd612c3b
BLAKE2b-256 66f12e463164ef3ee83dd11f88c542dc95cebe0f52665bc5e94bfd624549d0f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for convexpi_arena-0.1.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.1.0-py3-none-any.whl.

File metadata

  • Download URL: convexpi_arena-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 33.1 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c162df8d63294956a7cad2005294a4a55f8691a74432cef093dab3b97ddddcee
MD5 e21eae85843ba78b5a5b09886b31dddc
BLAKE2b-256 8b33c68e9e7ea1442a9afeb792ccc6045f14679b52cd53ed53b1d6a628cec94d

See more details on using hashes here.

Provenance

The following attestation bundles were made for convexpi_arena-0.1.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