Skip to main content

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-adapter-polymarket
uv pip install bangertrades-adapter-kalshi

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:

  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 order before it leaves your machine.
  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(), 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bangertrades-0.1.1.tar.gz (19.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bangertrades-0.1.1-py3-none-any.whl (56.9 kB view details)

Uploaded Python 3

File details

Details for the file bangertrades-0.1.1.tar.gz.

File metadata

  • Download URL: bangertrades-0.1.1.tar.gz
  • Upload date:
  • Size: 19.9 kB
  • Tags: Source
  • 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

Hashes for bangertrades-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b4e953a97c053e52a6495314f125bb53fe40869cce4e230ef9c423fbeaa1a387
MD5 b383ffae887d535639b68e3695c8920c
BLAKE2b-256 2df9597a7ff0025e3494d94d404152bfc58a87bde2a8bbdd063e2ad370b80b33

See more details on using hashes here.

File details

Details for the file bangertrades-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: bangertrades-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 56.9 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

Hashes for bangertrades-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 33b590ed6d393c6bf97e2a7c5c48b7b92c9021635f13d74ad41740c753b9ffa2
MD5 0747a1743ada79a81d0e5932caa5377d
BLAKE2b-256 6edd1fcf5162f03de785860b5d3a58b428e1af3a77bc8377e80d6f05b1fccdaa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page