sanity-checker: Full Guide to the Free Pre-Trade Price Checker CLI
The sanity-checker runs my pre-trade discipline — six mechanical checks on a market’s price — in one command, so the boring checks stop depending on my mood. This is the author’s full guide: what each check measures, how to read every output line, bot-gating automation, and the honest limits. (The manual routine it automates is in the sanity checklist guide; the quick intro is in the tools overview.)
What does sanity-checker actually check?
Six things, in order, on the live book: depth (can your size fill within 2-3 ticks), spread (the round-trip toll), freshness (last trade age — quotes lie, trades prove), cross-source consistency (an independent reference within a few points), commission (fee drag on your entry), and fill cost (your size’s true all-in VWAP). Each maps to a chapter of the order book guide; the cost-stack context is in fees explained.
Reading the output, line by line
Market : will-the-fed-cut-rates-in-december
Size : $200
Depth ok : YES (3 levels absorb $200 within 2 ticks)
Spread : 3.2c [ok]
Freshness : last trade 4m ago [ok]
Cross-src : +2.1c vs reference [ok]
Commission : 2.0% taker → 0.8c on entry [ok]
Fill cost : entry + 1.6c + fees ≈ 43.4c all-in
VERDICT : SANITY OK — edge needed > 4.4c to clear costs
- Depth ok — your size against the top three levels. “NO” means you’d walk the book: halve the size or pass (the VWAP method).
- Spread — anything above ~5-6c means the mid is your only honest quote; limit orders only.
- Freshness — stale trades on event markets are the classic drift trap (the seven mistakes).
- Cross-src — a divergence beyond a few points is either your edge or your trap; the check flags it, your research decides which.
- Fill cost — the number that replaces the price you thought you were trading.
- VERDICT’s edge-needed line — the most useful line in the tool: your directional edge must exceed it. “Right direction, edge smaller than the verdict number” is the most expensive trade shape there is.
Exit codes and bot gating
0 sanity OK · 1 check failed — built to gate automated flow:
python3 sanity_check.py --market <slug> --size 2000 || exit 1
Drop it as the pre-trade gate in your bot’s execution layer — a failed sanity check should block entry exactly like a failed risk limit (see the 8 components). For market-making, run it on your quotes’ market each cycle: your own actions move the checks’ inputs (resting orders count in depth perception — and in margin worst-case, see why orders get rejected).
What it can’t save you from
Resolution risk — a perfectly sane price on a badly worded market is still a coin flip on the criteria (read them: tie/void handling). Information asymmetry — if the other side knows something, the checks will happily sell you a fair price on a losing trade; sanity checks verify the market’s health, not your thesis’s truth. Correlated clusters — six green checks on five correlated positions is one check in disguise (the discovery filter handles concentration; this tool handles the single market).
FAQ
Is sanity-checker free and safe? Yes — MIT, read-only market data, standard library, no keys. It gates decisions; it can’t move funds.
What size should I pass? Your real intended size — the checks scale to it. Running at $200 and trading $5,000 validates nothing: the depth and fill-cost lines exist to price your actual footprint.
What’s “edge needed > 4.4c” in the verdict? The all-in cost of the round trip: half-spread + fees + depth impact. Your directional edge must exceed it, or the trade is a donation with extra steps — the fees guide covers the stack in detail.
Does it work on perps markets too? The check structure applies (books are books); funding isn’t part of the six checks — pair it with the funding forecaster for the perps cost picture.
Can it run before every automated trade? Yes — exit codes make it a gate; sub-second on cached books, so it fits hot paths. Just keep your size argument current, or the depth check flatters you.
Educational tool guide, not financial advice. Not affiliated with Polymarket. Last updated October 2026.