Paper Trade Kalshi Strategies Without Sharing API Keys
If you want to test a Kalshi strategy before risking money, the usual advice is to spin up an API key and point a bot at your account. That couples two things that should stay separate: writing and evaluating logic, and holding trading credentials that can move real cash. You do not need the second to do the first.
This post walks through a paper-only workflow using Banger (bangertrades.com), a research beta for prediction-market strategy builders. The whole point is observation without keys: you write Python, backtest a frozen version against historical data, and run a bounded forward paper experiment on current market data. No venue trading key, no funded account. A paper result is evidence under one data, fill, fee and valuation model. It is not proof you would have filled the same way on the real exchange.
Why observation does not need a trading key
Reading a public order book is not the same as placing an order. Kalshi quotes and trades are public market data; a no-order observer never has to authenticate to a funded account to watch them. Banger consumes public market data for paper testing, so the forward paper path simulates fills against that feed rather than routing anything to the venue. There is nothing to fund and no secret to hand over.
Worth knowing who you are modeling. Kalshi operates as a U.S. exchange regulated by the Commodity Futures Trading Commission as a designated contract market. That status matters for how the venue behaves, but none of it requires you to connect credentials to study a strategy on paper.
Step 1: Install and sign in
Install the package from PyPI and authenticate to your Banger account. Account setup is what gives you a place to store strategies and record paper runs. It is not a venue login and does not ask for Kalshi credentials.
pip install bangertrades
banger loginStep 2: Pick one current Kalshi market and pin it
Hosted historical backtesting currently supports Kalshi binary markets, so choose a specific, currently-listed Kalshi ticker and write it down. Pin the exact ticker. Do not rely on grabbing the first result from a discovery call or regex-parsing a series name and assuming the run is reproducible. Markets open, close and resolve; a run is only reproducible if the market it referenced is the one you meant.
A note on payouts while you reason about edge: standard Kalshi binary contracts settle at $1.00 or $0.00 with no separate settlement fee. Do not assume that generalizes to scalar, bracketed or exceptional contracts, and do not assume two live YES/NO offers always sum to a dollar.
Step 3: Write the strategy as Python
A Banger strategy is a Python class. The core callback is on_market_tick(self, market, tick, ctx), with an optional on_start(ctx) for setup. Inside a tick, prices are Decimal, bid and ask may be absent, and the timestamp is a datetime. Handle the absent-quote case explicitly, because missing quotes can trigger a price fallback in simulation rather than a clean skip.
Orders go through the context. Context.place(venue, market, side, size, price=None) takes a USD notional size. Context.close works in held-contract quantity, not dollars. Keep that distinction straight or your exits will not match your entries. Import the Kalshi adapter from banger_adapter_kalshi (the banger.venues.kalshi path is a valid compatibility re-export).
from decimal import Decimal
from banger import Strategy
from banger_adapter_kalshi import Kalshi
from banger.risk import RiskEnvelope
class CheapYes(Strategy):
name = "cheap_yes"
venues = [Kalshi()]
risk = RiskEnvelope(
max_position_usd=Decimal("200"),
max_daily_loss_usd=Decimal("100"),
max_open_positions=3,
)
async def on_market_tick(self, market, tick, ctx):
if tick.ask is None:
return
if tick.ask <= Decimal("0.30"):
await ctx.place(Kalshi(), market, side="yes", size=Decimal("25"))The code above is a conceptual illustration against the published 0.1.7 interface. Treat it as a starting skeleton to adapt, not a tested, profitable system. Inspect the actual result object your run produces rather than trusting any snippet on sight.
Step 4: Understand the risk envelope you set
RiskEnvelope is where you bound the experiment. The fields are max_position_usd, max_daily_loss_usd, max_open_positions, max_concentration_pct and max_orders_per_minute. Read them literally:
- max_position_usd limits cumulative position cost basis, not a generic per-order stake.
- The forward-paper daily-loss control rejects new exposure once mark-to-market loss from the current UTC-day baseline reaches the limit. It does not auto-flatten what you already hold, it does not guarantee an eventual loss ceiling, and it does not stop a worker on a timer.
- A per-context limit is a per-context limit. It is not an account-wide guarantee.
There is no per_trade_cap, no daily_loss_stop and no kill_switch field. If you want flat, you close positions in code. Do not design around a guaranteed stop that the SDK does not promise.
Step 5: Backtest the immutable version
Save the strategy so Banger versions it, then backtest that frozen version against Kalshi historical data. Versioning is the honest part of this: the backtest is tied to a specific immutable revision, so a result you quote later still points at the exact code that produced it. Historical backtesting is its own model. Do not assume every path walks full book depth, that fills match the forward-paper model, or that data is delivered continuously.
Step 6: Run a bounded forward paper experiment
Forward paper testing runs the same code against current market data and records simulated fills. You can run a short supervised local check:
banger run strategy.py --paperThat runs an existing file locally and creates a local paper record. Watch it, then stop it with Ctrl+C when you have seen enough. A log-count flag bounds output, not the strategy's lifetime, so do not mistake a quiet log for a stopped run. The hosted path, banger deploy strategy.py --paper, is separate and subject to admission and capacity; stopping a hosted run needs its own confirmation, a stopped record and completed resource cleanup, and a stopped badge can show before cancellation finishes. Public live deployment and local --live are blocked in this beta. Stopping a paper run preserves your research history and says nothing about any real account, because there is no real account attached.
Read the fills like a skeptic
The simulation has documented edges. The public 0.1.7 forward-paper context can fill a non-crossing requested limit at that limit, and it logs paper.fill.resting-assumed when it does. Its volume-based quantity cap is reported volume, not full book depth or passive queue reconstruction. So a paper fill is a modeled fill, not a claim you would have been first in line on the real book.
Fees deserve the same scrutiny. Kalshi's general taker trading fee follows the formula 0.07 x contracts x price x (1 - price), rounded up to the next cent, which peaks near a 50-cent contract price and shrinks toward the extremes. Some markets carry a different series multiplier, so check the official fee schedule rather than assuming the standard coefficient applies everywhere. The packaged standard Kalshi fee helper in Banger rounds up to a whole cent, while Kalshi's current official fee schedule describes finer fee-plus-position-cost rounding. The gap is small per contract but real at volume, so inspect the fee the result model actually applied instead of assuming it matches the venue to the penny. The optional forward-paper fee policy selects the named Kalshi model; it does not implement every current Polymarket category fee.
Finally, keep four numbers mentally separate: marked value, settlement claim, credited cash and hypothetical executable proceeds. A paper P&L line is a model of the first three at best. It is not money, and it is not a promise that the real venue would have paid you the same.
What you get out of it
The payoff of the no-key workflow is simple: you can iterate on real Kalshi strategy logic, compare versioned backtests, and watch bounded forward paper runs, all without funding an account or exposing a trading secret. Treat every green result as evidence under a stated model, re-check the ticker and the fee math before you trust a number, and remember that the step from paper to real execution is exactly the step this workflow does not take for you.
Sources
- bangertrades 0.1.7 - PyPI
- Banger CLI Documentation
- Banger - Polymarket & Kalshi Paper Strategies
- How is Kalshi regulated? (Kalshi Help Center)
- CFTC Approves BTCPERP Contract Submitted by KalshiEX, LLC (confirms DCM status)
- Kalshi Fees Explained: The Full 2026 Breakdown
- Kalshi Fees Explained (2026): Formula and Examples