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.7

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.7
File Size Uploaded
bangertrades-0.1.7.tar.gz 98.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bangertrades 0.1.7
File Interpreter ABI Platform
bangertrades-0.1.7-py3-none-any.whl Python 3 none any Details

Total release size: 204.5 kB

Release files / bangertrades-0.1.7.tar.gz

Download URL bangertrades-0.1.7.tar.gz
Size 98.3 kB
Tags Source
SHA-256 checksum
How to use checksums
75c7e79f6add5d7adee42f574c219e9e9517d6ed2037d374059d4f343bc7557b
BLAKE2b-256 checksum
How to use checksums
6f2fbce1791cc56cbc45de2d028f34d536b35ca82140a619e1207c38e2cd7e1f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 21, 2026.

Transparency log

Release files / bangertrades-0.1.7-py3-none-any.whl

Download URL bangertrades-0.1.7-py3-none-any.whl
Size 106.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
465b926def68f24182767b36b5f126ff8b3c704022674ba3fa22bff236ef613d
BLAKE2b-256 checksum
How to use checksums
dc5020157baee7b80eed4c803aeb8f34f9727febdfd80fc3d7503b1db3ab7ea8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 21, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.7 This release

2 release files

0.1.6

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