Skip to main content

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:

  1. Resolve universe against Kalshi to get the live market list.
  2. Subscribe to ticks for all matching markets.
  3. Call on_market_tick for each update.
  4. Risk-gate every simulated paper order before recording its fill.
  5. Show you P&L, drawdown, and per-position attribution in real time.

Core concepts

  • Strategy — base class. Subclass and declare name, 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; provides place(), reduce-only close(), cancel(), kelly(), log(), positions, and can_open_position(). place(size=...) accepts USD notional while close(contracts=...) accepts held contract quantity; contracts=None closes 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)

Source distribution for bangertrades 0.1.5.1
File Size Uploaded
bangertrades-0.1.5.1.tar.gz 88.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bangertrades 0.1.5.1
File Interpreter ABI Platform
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}

Release history Release notifications | RSS feed

0.1.7

2 release files

0.1.6

2 release files

This release

0.1.5.1 This release

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

1 release file

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page