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
The comprehensive distribution includes the SDK, CLI, runtime, and paper-mode venue adapters.
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,
)
async def on_market_tick(self, market, tick, ctx):
if tick.yes_price and tick.yes_price < Decimal("0.45") and ctx.can_open_position():
await 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 simulated paper order before recording its fill.
- 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(), reduce-onlyclose(),cancel(),kelly(),log(),positions, andcan_open_position().place(size=...)accepts USD notional whileclose(contracts=...)accepts held contract quantity;contracts=Nonecloses the full position.
Examples
See examples/:
kalshi_nfl_arb.py— Kalshi vs DraftKings spread arb (illustrative)polymarket_simple_fade.py— Fade overconfident Polymarket markets
Status
Public paper beta. Historical venue datasets and live execution are not shipped. The interface is still settling; expect reviewed breaking changes.
Metadata
Release files for bangertrades 0.1.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bangertrades-0.1.5.1.tar.gz | 88.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bangertrades-0.1.5.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 185.1 kB
Release files / bangertrades-0.1.5.1.tar.gz
| Download URL | bangertrades-0.1.5.1.tar.gz |
|---|---|
| Size | 88.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a9df5cce09730e03afef1876a34920e1ec9ac49ade2d4b4e1505f70400655947
|
|
BLAKE2b-256 checksum How to use checksums |
d81ec0d4fa834c4e73c371cc98c05286614848ed9bc70f2ab0b072375a080402
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|
Release files / bangertrades-0.1.5.1-py3-none-any.whl
| Download URL | bangertrades-0.1.5.1-py3-none-any.whl |
|---|---|
| Size | 96.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e232164400c7193e366f3234784ac17ad691432a1ff2509df80c7a442477885e
|
|
BLAKE2b-256 checksum How to use checksums |
75645fa5b625cea28c27e16ae46ebd7ca3d77e85bf2da2eed17791f9dafb76bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|