A Polymarket trading bot whose pricing oracle is Jev, TypeSafe AI's "System One" decision model, called through OpenRouter's Decisions API.
Jev is not a chat model. You hand it a JSON state and typed questions; it returns calibrated
probabilities — no prose, no chain of thought, ~100 ms, ~$0.00003 per decision. The catch: it has
no browsing and a training cutoff, so on its own it (correctly) refuses to price news-driven
markets. This bot pairs it with a cheap researcher — a generative model with web search —
that writes a dated, sourced evidence brief into the state. Jev then makes the calibrated call,
and the bot trades where Jev's probability beats the order book by a configurable edge.
This is experimental software that places real orders with real money. Read Disclaimer and Security before running it live.
scan ──▶ research ──▶ state ──▶ Jev ──▶ evaluate ──▶ execute ──▶ log
Gamma DeepSeek + compact 3 typed edge, band, GTC limit SQLite
filters web search JSON answers Kelly, gates + hard caps
-
Scan (
markets.py) — open markets by 24h volume, filtered by liquidity, volume, days-to-resolution, spread, price band, and Yes/No outcome labels. -
Research (
research.py) — a chat model via OpenRouter's web plugin (defaultdeepseek/deepseek-v4-pro-0813, ≈ $0.015 per brief) returns strict JSON: dated key facts, latest development, considerations for/against YES, sources. Odds sites are excluded from search so Jev never sees market prices as "evidence". Briefs are cached in SQLite forRESEARCH_TTL_HOURS. -
State —
question, truncateddescription,today,days_until_resolution(pre-computed: Jev is bad at date math),resolution_source,market_implied_probability_yes,evidence. -
Ask Jev (
signal.py, one call, three questions):-
resolves_yes(noul) → P(YES) -
answerable(noul) → is there enough current, relevant information in the state to form a well-informed estimate? (information sufficiency, not certainty) -
clarity(score 0–4) → how objective the resolution criteria are
-
-
Evaluate (
signal.evaluate, pure) — skip unless answerable and clear; only buy contracts priced inside[MIN_TRADE_PRICE, MAX_TRADE_PRICE]; requirep − ask ≥ MIN_EDGE; size with fractional Kelly, capped. -
Execute (
executor.py) — GTC limit order at the best ask, only if every hard cap passes: per-trade$, total open exposure $ , trades per run, one position per market. -
Log (
store.py) — every brief, decision and order injevymarket.db, so Jev's calibration can be checked against resolutions later.
Measured on a live market (Sept 2026): without the brief Jev reported answerable=0.27; with it,
0.78. The researcher is what makes Jev usable here.
git clone https://github.com/markusbug/jevymarket && cd jevymarket
uv sync
cp .env.example .env # fill in OPENROUTER_API_KEY, POLYMARKET_PRIVATE_KEY (+ POLYMARKET_WALLET)- OpenRouter: one key covers Jev and the researcher. Jev has no free tier; the account needs prepaid credits.
- Polymarket: see Funding, then
uv run jevymarket setuponce for the on-chain approvals.
uv run jevymarket jev-test # one Jev call; verifies the key + response schema
uv run jevymarket scan -n 15 # candidate markets with live best bid/ask
uv run jevymarket research <slug|url> # researcher only: print the evidence brief (--fresh)
uv run jevymarket decide <slug|url> # research + Jev + proposed trade, no order
uv run jevymarket run --dry-run # full pipeline, logs intended orders only
uv run jevymarket run --max-trades 1 # LIVE: at most one real order this pass
uv run jevymarket run --loop 900 # LIVE: repeat every 15 minutes
uv run jevymarket setup # one-time exchange approvals
uv run jevymarket positions # pUSD balance, positions, open orders, exposure
uv run jevymarket stats # decision counts, spend, calibration bucketsrun is live by default; --dry-run evaluates and logs but never places orders.
--no-research skips the researcher (Jev alone — expect near-zero trades).
| var | default | meaning |
|---|---|---|
JEV_MODEL |
typesafe/jev-1.13 |
pin a Jev version; typesafe/jev-latest also works |
RESEARCH_MODEL |
deepseek/deepseek-v4-pro-0813 |
any OpenRouter chat model; see below |
RESEARCH_TTL_HOURS |
6 | reuse a cached brief for this long |
MAX_RESEARCH_PER_RUN |
20 | hard cap on researcher calls per pass |
MIN_EDGE |
0.08 | required P_jev − best ask |
MIN_ANSWERABLE |
0.70 | Jev's belief the state has enough information |
MIN_CLARITY |
2 | 0–4 rubric score of resolution criteria |
MIN_TRADE_PRICE / MAX_TRADE_PRICE |
0.10 / 0.90 | only buy contracts priced in this band |
MAX_USD_PER_TRADE |
5 | per-order notional cap |
MAX_OPEN_EXPOSURE_USD |
50 | positions + open buy orders may not exceed this |
MAX_TRADES_PER_RUN |
3 | orders per run pass |
KELLY_FRACTION |
0.25 | fraction of full Kelly used for sizing |
Researcher models. Any OpenRouter chat model works. Models without native search get
OpenRouter's Exa fallback ($0.007/search), which supports the odds-site exclusion list. Tested:
deepseek/deepseek-v4-pro-0813 (default), z-ai/glm-5.3, qwen/qwen3.8-max-0902,
moonshotai/kimi-k3; anthropic/claude-sonnet-5 for native search at ~2× the cost.
Costs (Sept 2026): Jev ≈ $0.00006 per decision with evidence; brief ≈ $0.010–0.020; a 20-market pass ≈ $0.20–0.40 before caching.
Since the April 2026 exchange upgrade Polymarket settles in pUSD
(0xC011a7E12a19f7B1f670d46F03B03f3342E82DFB, Polygon), a 1:1 USDC-backed wrapper — not USDC.e
and not native USDC.
- Via polymarket.com (easiest). Deposit on the site; it lands as pUSD in your Polymarket
wallet. Put the private key of the wallet you log in with in
POLYMARKET_PRIVATE_KEYand your Polymarket wallet address inPOLYMARKET_WALLET. The SDK detects the wallet type. - Raw EOA. Hold USDC.e (
0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174), approve the CollateralOnramp (0x93070a847efEf7F70739046A929D47a521F5B8ee) and callwrap(USDC_E, you, amount). Keep a little POL for gas.
jevymarket positions shows the pUSD balance the exchange sees.
- Longshot bias. Jev tends to be less confident than the market at the extremes, which shows
up as "edge" on 5-cent contracts. The trade band (
MIN_TRADE_PRICE) is the guard; widen it only with data fromstats. - Edge ≠ profit. Limit orders at the ask are taker orders; adverse selection and stale briefs
eat into an 8 % threshold. Start with
--dry-run, watchstats, then trade small. - No exits. Positions are held to resolution. No stop-loss, no re-pricing on new evidence.
- Beta endpoint. OpenRouter's decisions API is in beta;
jev.Answeris tolerant to field naming, but re-runjev-testafter a Jev version bump. - Jev interprets literally and degrades with irrelevant context — keep the state small.
This software is provided for educational and research purposes. It is not financial advice. Prediction markets involve risk of total loss; you are solely responsible for your trades, for complying with Polymarket's terms of service and with the laws of your jurisdiction. The authors accept no liability for losses. See LICENSE.
See SECURITY.md. Short version: dedicated low-balance wallet, never commit .env,
the exposure caps are the only brake.
src/jevymarket/
config.py settings (.env) signal.py Jev questions, gates, edge + sizing (pure)
jev.py OpenRouter Decisions research.py researcher (web search → Brief)
markets.py scan / filter / state executor.py caps + order placement
store.py SQLite log + cache cli.py typer commands
tests/ mocked Jev + researcher, signal math, store
uv synchangs with pyenv installed: uv probes the pyenvpythonshim, which can block. UseUV_PYTHON=/usr/bin/python3.12 uv sync.Unknown blockduringsetup: the public Polygon RPC hiccuped;setupretries and skips approvals already granted.Invalid private_key … 20 bytes: you pasted an address. The key is 32 bytes (64 hex chars).
See CONTRIBUTING.md. Roadmap: exit logic, calibration report, alternative
researchers behind the same Brief interface.
MIT © 2026 Markus Haas