Engineering

Shiva: A Sports Prediction Bot That Hunts Mispriced Polymarket Odds

Sports prediction markets are inefficient because the crowd prices on narrative, not data. Shiva is an automated bot that estimates true probabilities from team stats, injuries, and media sentiment — then executes when the edge is real.

March 4, 2026
8 min read
#polymarket#sports-betting#prediction-markets
Shiva: A Sports Prediction Bot That Hunts Mispriced Polymarket Odds
Share

Prediction markets are supposed to be efficient. Thousands of participants, real money at stake, prices that should converge on truth. And for high-profile political markets — presidential elections, major policy events — they mostly are. The wisdom of the crowd works when the crowd is paying attention.

Sports markets are different.

Game-day NBA and MLB markets on Polymarket move on narrative. Star player trending on Twitter. A hot take on ESPN. Someone's "gut feeling" about a revenge game. The crowd bets with conviction but without methodology. And that gap — between conviction and calibration — is where the edge lives.

Shiva was built to exploit it.

The Problem with Sports Prediction Markets

Here's what most sports bettors do: they watch a game preview, form an opinion, and bet. Maybe they glance at a win-loss record. Maybe they heard about an injury on a podcast. Their probability estimate is a feeling, not a calculation.

Now multiply that across hundreds of Polymarket participants. You get prices that reflect narrative momentum, not statistical reality. A team on a three-game win streak gets overpriced. A team missing a role player (not a star) gets underpriced by the same amount as if they lost their MVP. Back-to-back fatigue gets ignored entirely until the third quarter when the legs go.

These aren't hypothetical inefficiencies. They're structural. And they're exploitable if you have the data pipeline to see them.

INSIGHT

The edge in sports prediction markets isn't knowing more about basketball. It's doing the math that the crowd skips — then acting before the price corrects.

What Shiva Does

Shiva is an automated sports prediction bot that targets NBA and MLB game-day markets on Polymarket. It polls the GAMMA API every 30 seconds for active game events, estimates true probabilities using multiple data sources, calculates edge against Polymarket prices, and executes Fill-or-Kill orders on the CLOB when the edge is real.

The name fits. In Hindu mythology, Shiva is the destroyer and transformer — precise, targeted, absolute. In the markets, Shiva identifies mispriced bets and eliminates them.

Market Types
4
Moneyline, spread, total (O/U), player props
Data Feeds
3
ESPN NBA, MLB Stats API, Perplexity media analysis
Risk Gates
5
Daily loss limit, position cap, event isolation, loss cooldown, consecutive loss breaker
Minimum Edge
4%
Below this threshold, no bet — regardless of signal strength

The Pipeline

Every 30 seconds, the SportsScanner hits the GAMMA API and filters for active game events — no season futures, no championship odds, just today's games. Each event gets passed through the MarketClassifier, which parses the market question into a structured type: moneyline, spread, total, or player prop.

Then the core engine kicks in.

ShivaSportsStrategy.estimate() is the brain. It takes a classified market and a full context bundle — team stats, recent form, injuries, home/away splits, media sentiment — and produces a ProbabilityEstimate. Not a score. Not a signal. A probability. A number between 0 and 1 that represents what we believe the true odds are.

That probability gets compared to the Polymarket price in the EdgeCalculator. If our estimate says a team has a 62% chance of winning and the market is pricing them at 55%, that's a 7% edge. The calculator computes expected value and a Kelly fraction for position sizing. If the edge clears the minimum threshold and EV is positive, the signal fires.

But the signal doesn't trade. Not yet. It hits the RiskGate first.

SHIVA — SPORTS PREDICTION ENGINE
Scan → Evaluate → Execute → Learn · 30s cadence
DATA LAYER
external feeds · no API keys required
NBA Feed
ESPN · stats + injuries
MLB Feed
MLB Stats API · pitching + form
Media Analyzer
Perplexity · lineup news
Sports Scanner
GAMMA API · 55+ NBA events
DECISION ENGINE
probability estimation · 6 weighted factors
Market Classifier
moneyline · spread total · props
Sports Strategy
home court · rest · form injuries · H2H · sentiment
Edge Calculator
Kelly criterion · EV SIGNAL: STRONG / MODERATE
EXECUTION LAYER
risk gates · CLOB orders · outcome claiming
Risk Gate
daily loss limit position cap · cooldown
Polymarket CLOB
FOK market orders Paper / Live mode
Claimer
resolve outcomes track PnL
LEARNING LAYER
adaptive weights · calibration · dashboard visibility
Signal Logger
SQLite · every evaluated market gets recorded
Trainer
Brier score · log loss Kelly factor calibration
Mission Control
Training tab · accuracy weight drift · history
Free public APIs — no credentials required
6-factor probability model
DRY_RUN=true by default
Self-improving via resolved outcomes

Where the Data Comes From

NBAFeed — ESPN

The NBA feed pulls team stats, injury reports, recent form (last 5 games with recency-weighted scoring), home/away splits, and back-to-back detection. A team playing its second game in two nights gets an 8% penalty applied to their win probability. A well-rested team facing a fatigued opponent gets a 6% bonus.

Injuries are weighted by status and player impact. A star player listed as "Out" applies a 15% penalty, multiplied by 1.5x for high-impact players. "Questionable" applies 7%. "Probable" barely moves the needle at 2%. This isn't guesswork — these are calibrated against historical performance differentials.

The form weights tell a story too: the most recent game gets 30% weight, then 25%, 20%, 15%, 10%. A five-game window with exponential decay toward recency. If a team won their last two but lost the three before that, the model sees a team that's recovering — not a team that's "hot."

MLBFeed — MLB Stats API

Baseball is a different animal. Starting pitcher ERA, WHIP, and recent outings dominate the probability estimate. Lineup strength and weather conditions adjust the totals. The MLB Stats API gives us structured data that most bettors never aggregate — they see "Dodgers vs. Padres" and bet on brand recognition.

MediaAnalyzer — Perplexity

This is the context layer. Perplexity searches for game-day news — late injury announcements, lineup changes, weather updates — that the stat feeds might miss. The output is a sentiment score from -1.0 to 1.0 that adjusts the final probability estimate. A last-minute "star player upgraded to probable" shifts the number. A "coach says he's resting starters" shifts it more.

SIGNAL

The media layer catches what the box score doesn't know yet. An injury report published 45 minutes before tip-off changes the math before the market reacts.

Edge Calculation and Kelly Sizing

The EdgeCalculator is pure math. Given our estimated probability and the Polymarket price, it computes edge on both sides — YES and NO — and takes the larger one.

yes_edge = our_probability - poly_price
no_edge = (1 - our_probability) - (1 - poly_price)

If the YES edge is 7%, the expected value calculation tells us what we'd make per dollar risked over repeated bets at these odds. The Kelly fraction tells us how much of our bankroll to commit — but we cap it conservatively. Full Kelly is a recipe for ruin. Fractional Kelly protects the bankroll while still compounding edge.

The minimum edge threshold is 4%. Below that, no trade. The minimum expected value is 2%. Both must clear simultaneously. This isn't about being right — it's about being right enough to overcome fees, slippage, and variance.

This is the same edge-first philosophy that drives the InDecision framework on the crypto side. Different market. Same principle: if the math doesn't justify the bet, the bet doesn't happen.

Risk Gates — The Guardrails That Keep You Alive

Risk management isn't a feature. It's the product. A bot without risk gates is just an automated way to lose money faster.

Shiva runs five gates before any order hits the CLOB:

1. Daily loss limit ($50). If cumulative P&L for the day drops to -$50, the bot stops. No more bets until midnight reset. This is the hard floor. No override. No "one more trade to get it back."

2. Max concurrent positions (5). Capital concentration kills. If five bets are already active, wait for one to resolve before placing another. This prevents correlated blowups — three NBA games tipping off at the same time shouldn't mean three simultaneous max-size bets.

3. One bet per event. If we already have a position on Pistons vs. Cavaliers, we don't stack a moneyline AND a total on the same game. One opinion per event. If you're betting both sides of the same game, you don't have edge — you have confusion.

4. Cooldown after consecutive losses. Three losses in a row triggers a 60-second cooldown. Not because the model needs to recalibrate — but because streaks happen, and pausing prevents compounding into a drawdown spiral.

5. Consecutive loss breaker. After three straight losses, all new signals are held until the streak resets. This is the circuit breaker. It forces the system to prove itself right again before we extend more capital.

WARNING

The gates that feel most frustrating in the moment — the ones that block a "sure thing" — are the ones that save you over 200 bets. Discipline is the edge that compounds.

The Claimer — Why Outcome Tracking Matters

Most people think about trading bots as entry systems. Find a signal, place a bet, done. But half the work happens after the bet is placed.

ShivaClaimer runs as a background process that monitors all open positions for resolution. When a market closes, the Claimer records the outcome, updates P&L, adjusts the risk state (consecutive wins/losses, daily P&L), and logs everything to SQLite.

This isn't bookkeeping for its own sake. The Claimer feeds the feedback loop. Every resolved bet becomes training data for the adaptive weights system. If moneyline bets are hitting at 60% but spread bets are at 45%, the weights shift. If the media analyzer's sentiment adjustments are degrading accuracy instead of improving it, that shows up in the resolution data.

ADAPTIVE LEARNING LOOP
Paper trade → Resolve → Calibrate → Update · Daily at 5 AM ET
01
PAPER TRADE
Bot evaluates markets every 30s. Signals and simulated trades logged to SQLite. DRY_RUN=true.
02
MARKET RESOLVES
Claimer polls Polymarket for resolved outcomes. Win/loss recorded against each signal's predicted probability.
03
CALIBRATION RUN
Trainer computes Brier score and log loss per market type. Finds which factors correlated with correct calls.
04
WEIGHT UPDATE
Factors that predicted wins get multiplier bump (up to 1.5×). Poor predictors drop (floor 0.5×). Saved to adaptive_weights.json.
05
DEPLOY
Next scan cycle loads updated weights. Strategy applies them to probability estimates. Loop continues.
EXAMPLE WEIGHTS (after 200 samples)
home_court
1.3x
injury_impact
1.2x
form_weight
1.1x
media_sentiment
0.9x
b2b_penalty
1.0x
rest_bonus
0.7x
weights start at 1.0 · adjust ±10% per cycle · min 20 resolved samples required
BRIER SCORE
calibration quality
LOG LOSS
probability accuracy
ACCURACY
by market type
WEIGHT DRIFT
factor evolution

Without automated outcome tracking, you're flying blind. You can't improve what you don't measure, and you can't measure what you don't close.

What Separates This from a Sportsbook

Traditional sportsbooks set lines designed to balance action on both sides — the house profits on the vig regardless of outcome. Polymarket is different. It's a prediction market with a CLOB. Prices are set by participants, not by a market maker with a 10% juice built in.

That means inefficiencies persist longer. A sportsbook with sharp bettors moves lines within minutes. A Polymarket sports market with lower liquidity might sit at a mispriced level for the entire pre-game window. That's where Shiva operates — in the gap between what the crowd believes and what the data says.

The execution layer uses Fill-or-Kill orders. Either the full order fills at the target price or it cancels. No partial fills. No slippage. The CLOB on Polygon confirms in roughly 2 seconds. From signal to fill, the entire path takes less than 5 seconds.

What's Next

Shiva is live in dry-run mode, evaluating every NBA and MLB game-day market on Polymarket. The signal data is accumulating. The edge distribution is being mapped. The risk gates are being stress-tested against real market conditions.

The pipeline is the same one that powers Tesseract Intelligence on the competitive intelligence side — structured data in, calibrated probability out, edge-first execution. Different domain. Same discipline.

Next steps: live trading activation, expanded prop markets, and a real-time Athena dashboard integration so the entire signal history — every estimate, every edge calculation, every gate decision — is visible in one place. The bot runs in the dark. The dashboard turns the lights on.

The crowd will keep betting on narratives. Shiva will keep doing the math.

Explore the Invictus Labs Ecosystem

// Join the Network

Follow the Signal

If this was useful, follow along. Daily intelligence across AI, crypto, and strategy — before the mainstream catches on.

No spam. Unsubscribe anytime.

Share
// More SignalsAll Posts →