Banger: write, test, and run prediction-market strategies that hit.
Project description
banger (Python SDK)
Strategies that hit.
The Python SDK for Banger. Write a strategy as a Python class, ship it with banger deploy strategy.py --paper, watch it run.
Install
uv pip install bangertrades
# Plus the venue adapters you need:
uv pip install bangertrades
uv pip install bangertrades
For local development on this monorepo:
uv pip install -e packages/sdk-python
uv pip install -e packages/adapters/polymarket
uv pip install -e packages/adapters/kalshi
The 30-second tour
from decimal import Decimal
from banger import Strategy, signals
from banger.venues.kalshi import Kalshi
from banger.risk import RiskEnvelope
class MyStrategy(Strategy):
name = "my_strategy"
venues = [Kalshi()]
universe = signals.kalshi_markets(category="NFL", time_to_resolution_lt="24h")
risk = RiskEnvelope(
max_position_usd=Decimal("200"),
max_daily_loss_usd=Decimal("500"),
max_open_positions=5,
)
def on_market_tick(self, market, tick, ctx):
if tick.yes_price and tick.yes_price < Decimal("0.45") and ctx.can_open_position():
ctx.place(Kalshi(), market, side="yes", size=ctx.kelly(edge=0.05))
banger deploy my_strategy.py --paper
That's it. The runtime will:
- Resolve
universeagainst Kalshi to get the live market list. - Subscribe to ticks for all matching markets.
- Call
on_market_tickfor each update. - Risk-gate every order before it leaves your machine.
- Show you P&L, drawdown, and per-position attribution in real time.
Core concepts
Strategy— base class. Subclass and declarename,venues,universe,risk.Venue— abstract execution venue. Provided by adapter packages.Universe— declarative spec of which markets to subscribe to (signals.kalshi_markets(...)).RiskEnvelope— declarative risk limits enforced before orders ship.Context— passed to event handlers; providesplace(),cancel(),kelly(),log(),positions,can_open_position().
Examples
See examples/:
kalshi_nfl_arb.py— Kalshi vs DraftKings spread arb (illustrative)polymarket_simple_fade.py— Fade overconfident Polymarket markets
Status
Pre-alpha. Interface is settling. Expect breaking changes on the path to v0.1.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bangertrades-0.1.2-py3-none-any.whl.
File metadata
- Download URL: bangertrades-0.1.2-py3-none-any.whl
- Upload date:
- Size: 60.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
656f9232bc13e597caf6721e530d4634a635a730cfd1b3a61c17841992cd1f8d
|
|
| MD5 |
8325ff59d6858344f0d809d628b2a253
|
|
| BLAKE2b-256 |
dc5b06fd0d86ed9e65aa8e0bbfba4b14679aca17a38041f8b31d7035f2cc5cd2
|