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.2
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.2.tar.gz | 89.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bangertrades-0.1.5.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 185.8 kB
Release files / bangertrades-0.1.5.2.tar.gz
| Download URL | bangertrades-0.1.5.2.tar.gz |
|---|---|
| Size | 89.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a1e778e55b8efdeeb36a7c7ae995cbea062fe8b8197c114c115791e571fd3126
|
|
BLAKE2b-256 checksum How to use checksums |
1228f0a2ca26e1338cbf3bcd34e0ea98d6a981eb464a7980f0ef2c2c0ca3ab4e
|
| 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.2-py3-none-any.whl
| Download URL | bangertrades-0.1.5.2-py3-none-any.whl |
|---|---|
| Size | 96.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
77b09c325b6e48a74ddd1332835db98446e7fba6a2325dc0b40d9ecc6f09b8df
|
|
BLAKE2b-256 checksum How to use checksums |
9f94f1665bf9ce9f2fcab5a9d03e3726eae01582d601373cdba4d711db7e8b8e
|
| 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}
|