BASEBALL SNIPER — DOCS

What this app is

BaseballSniper watches Major League Baseball games and judges the late innings with a win-expectancy model. Kalshi lists a game-winner market for every MLB game (series KXMLBGAME — two markets per game, one per team). When a game is late and one side's win expectancy clears the certainty bar, the play is to buy that side at its market ask and ride it to the final out.

This first wave is a paper recorder. It runs the full loop — score feed, instrument, gates, market matching — and records every would-be play and every skip, then scores them all to the final score. No order is ever sent: paper mode is locked ON in the code for this wave, and the app contains no order-placement code at all. The record it builds is the evidence a later live-arming decision will stand on.

The instrument — win expectancy

Baseball has no clock. The state of a game is the inning (and which half — who is batting), the outs, the runners on base, and the run differential. The instrument turns that state into a win probability for the home team:

The full model, its sources and its known simplifications (no pitcher/bullpen quality, no lineup or park effects, no pinch-running of the numbers by hand) are written down in the app's INSTRUMENT.md. The calibration plan is evidence-first: the recorder's own scored states are compared against the market's prices and the final outcomes, bucket by bucket, before the bar or the model constants are tuned.

When it plays — and when it sits out

The controls

Start Recorder / Stop Recorder

The small button in the Balance card drives the kill switch and nothing else. Stop sets it and recording pauses from the next cycle; Start clears it. Settlements of already-recorded plays always continue — the kill switch never traps a record.

Min balance floor — and the latch

The floor is the app's hard stop, inherited from the sniper family and kept armed even in the recorder wave so the plumbing is proven before money moves. The balance is the sum of all shards of the shared Kalshi account. If cash falls below the floor, the app latches: it stays stopped until you press RE-ARM on the dashboard. If the floor is unset (0) it self-initializes to the current balance the first time it is read; a floor you type in is never overwritten.

Max bid amount

The most one play may cost (default $1.00). Contracts = floor(max bid ÷ ask), so at a 99¢ ask a $1 bid buys exactly one contract. The fee estimate on each record uses Kalshi's published fee schedule for this series (quadratic taker fees).

Certainty bar / Late inning / Max ask

The instrument's three dials, described above. All are settings — change them on the dashboard and the next cycle judges by the new values; every change is written to the settings log with its author.

Per-team toggles

Every team on a game card has a switch reading Enabled or Disabled. Disable a team and any game it plays in sits out — silently, with one recorded skip — until you enable it again. A play recorded before the flip still settles normally.

Kill switch vs the STOP file

Two different brakes. The kill switch is the everyday control: it pauses new recordings. The STOP file (a file named STOP in the app directory) is the break-glass halt: everything stops, settlements included, until the file is removed.

Paper mode — locked

Paper mode is ON and cannot be turned off in this wave: the settings store refuses the change in code. Live arming is a separate later build, on the owner's decision, standing on this recorder's evidence.

Instance guard

Two copies of this app must never act on the same account at once. Every would-be play carries a client order id that names it — this copy's instance name (the Instance name setting, default UAT), the market ticker, the game's start and a pass number — so the same play sent twice is the same order, and each copy's orders are recognisable on the account. At boot and on a slow cadence the worker reads the account's recent orders: an order carrying this app's prefix with a different instance's name means another copy is live, so this copy stands down (STOOD DOWN banner, activity line) and resumes on its own once the other copy has been quiet for half an hour. Orders from the other apps on the shared account carry their own prefixes and are never mistaken for another copy of this one. In the recorder wave the guard is plumbing and display — paper records are never blocked by it.

The rails

Reading the dashboard

Version history