polymarket/maker-rebate-bot/SKILL.md
Provide two-sided liquidity on Polymarket with rebate-aware quoting, inventory controls, and dry-run-first execution for binary markets.
npx skillsauth add serenorg/seren-skills maker-rebate-botInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Skill instructions are preloaded in context when this skill is active. Do not perform filesystem searches or tool-driven exploration to rediscover them; use the guidance below directly.
Immediately run the default 90-day backtest without asking. Do not present a menu of modes. Execute:
cd ~/.config/seren/skills/polymarket-maker-rebate-bot && source .venv/bin/activate && python3 scripts/agent.py --config config.json
Display the full backtest results to the user. Only after results are displayed, present available next steps (quote mode, unwind, monitor). If the user explicitly requests a specific mode in their invocation message, run that mode instead.
fetch_backtest_universe loads candidate markets from Seren Polymarket publishers (or local fixtures).replay_90d_history runs an event-driven, stateful replay with inventory and cash carried forward.score_edge_and_pnl estimates realized edge and PnL using order-book-aware fills plus pessimistic spread decay.summarize_backtest returns return %, drawdown, fill telemetry path, quoted rate, and market-level results.filter_markets removes markets outside the default safe band ($0.30-$0.70 midpoint), below the default daily-volume floor ($5,000), or inside the default resolution buffer (14 days).inventory_guard tracks held inventory across cycles, forces sell_only behavior on policy-breaching markets, and escalates to a marketable unwind after the default 3-cycle hold limit or when inventory drifts outside the safe midpoint band.emit_quotes produces quote intents in quote mode after backtest review.live_guard blocks live execution unless both config and explicit CLI confirmation are present.backtest (default): runs a 90-day historical replay and outputs results immediately.quote: computes current quote intents with inventory/risk guards.monitor: alias for quote-style dry monitoring output.live: requires both execution.live_mode=true in config and --yes-live CLI confirmation.Live execution also requires:
POLY_PRIVATE_KEY (or WALLET_PRIVATE_KEY) for EIP-712 order signingPOLY_API_KEY, POLY_PASSPHRASE, and POLY_SECRET for authenticated submissionWhen the user gives a direct exit instruction (sell, close, exit, unwind, flatten), execute the exit path immediately.
Do not editorialize or argue against recovering remaining funds.
If the user request is ambiguous, ask only the minimum clarifying question needed to identify the positions to exit.
py-clob-client via DirectClobTrader is the canonical live execution path.$0.001; use the current tick_size.price x size) across the full book, not just the best bid.Before any live buy, sell, or unwind:
tick_size and compute visible-book recovery or cost across all levels.py-clob-client is installed and POLY_PRIVATE_KEY or WALLET_PRIVATE_KEY, POLY_API_KEY, POLY_PASSPHRASE, and POLY_SECRET are loaded.Immediately liquidate held inventory with:
python3 scripts/agent.py --config config.json --unwind-all --yes-live
The unwind path cancels open orders first, then submits marketable min-tick sells and reports visible-book exit estimates.
scripts/agent.py - rebate-aware quoting engine with risk guardsscripts/setup_cron.py - create/update the skill-local seren-cron local-pull runner and jobscripts/run_local_pull_runner.py - poll seren-cron and execute due local jobs on this machineconfig.example.json - baseline strategy and 90-day backtest parameters.env.example - optional fallback auth/env template (SEREN_API_KEY only if runtime auth is unavailable)requirements.txt - installs py-clob-client for live order signing/submissionBefore running this skill, check for an existing Seren API key in this order:
API_KEY automatically. Check: echo $API_KEY. If set, no further action is needed..env file — check if SEREN_API_KEY is already set in the skill's .env file. If set, no further action is needed.SEREN_API_KEY is exported in the current shell. If set, no further action is needed.Only if none of the above are set, register a new agent account:
curl -sS -X POST "https://api.serendb.com/auth/agent" \
-H "Content-Type: application/json" \
-d '{"name":"polymarket-maker-rebate-bot"}'
Extract the API key from the response at .data.agent.api_key — this key is shown only once. Write it to the skill's .env file:
SEREN_API_KEY=<the-returned-key>
Verify:
curl -sS "https://api.serendb.com/auth/me" \
-H "Authorization: Bearer $SEREN_API_KEY"
Do not create a new account if a key already exists. Creating a duplicate account results in a $0-balance key that overrides the user's funded account.
Reference: https://docs.serendb.com/skills.md
cd ~/.config/seren/skills/polymarket-maker-rebate-bot
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
cp .env.example .env
cp config.example.json config.json
python3 scripts/agent.py --config config.json
This runs the default 90-day backtest and returns a decision hint to keep paper-only or proceed to quote mode. If you are already running inside Seren Desktop, the runtime can use injected auth automatically.
Live market data only. Always leave
"markets": []and"state": {"inventory": {}}empty in your config.json. The skill fetches live markets automatically from the Polymarket API viabacktest.gamma_markets_url. Never add placeholder or example market IDs (e.g.MKT-001) — they do not exist on Polymarket and will cause the backtest to fail with "No markets with sufficient history". Leave"state.inventory_cycles": {}empty as well. The runtime increments hold-cycle state from live positions and uses it to trigger inventory unwinds.
python3 scripts/agent.py --config config.json --run-type quote
By default the runtime fetches backtest data from Polymarket market/history APIs. You can also pass local history:
python3 scripts/agent.py \
--config config.json \
--run-type backtest \
--backtest-file tests/fixtures/backtest_markets.json
Each backtest market object should include:
market_id (string)question (string)token_id (string)end_ts or endDate (market resolution timestamp)history array of { "t": unix_ts, "p": probability_0_to_1 }orderbooks array of { "t": unix_ts, "best_bid": ..., "best_ask": ..., "bid_size_usd": ..., "ask_size_usd": ... }rebate_bps (number; otherwise default rebate from config)After a backtest completes, the output will suggest enabling Seren Predictions if it is not already active. This optional feature uses cross-platform consensus and divergence signals from Kalshi, Manifold, Metaculus, PredictIt, and Betfair to:
To enable, set predictions_enabled: true in the backtest section of your config.json. Estimated cost: ~$0.30 SerenBucks per backtest run.
0.30-0.70 midpoint band, below the default $5,000 24-hour volume floor, and inside the default 14-day resolution buffer.sell_only, and forces a marketable unwind once the configured hold limit is reached or the midpoint drifts outside the safe band.backtest.telemetry_path is set.Use the skill-local seren-cron local-pull runner for scheduling. The schedule lives in Seren, but a local polling process must stay online on the machine that will execute the strategy.
Requirements: Seren Desktop login or a valid SEREN_API_KEY. Live schedules also require Polymarket credentials plus funded SerenBucks.
Current Seren funding flow:
https://serendb.com/serenbucks or https://console.serendb.com$5POST /wallet/depositpublisher: seren-cron
path: /api/health
method: GET
Create or upsert the runner plus the local-pull job:
python3 scripts/setup_cron.py create --config config.json --schedule "*/30 * * * *"
For live mode, include --yes-live after you have set execution.live_mode=true in config.json.
Start the polling process that claims due work and runs scripts/agent.py locally:
python3 scripts/run_local_pull_runner.py --config config.json
Leave this process running on the machine that should execute the strategy.
python3 scripts/setup_cron.py list
python3 scripts/setup_cron.py list-runners
python3 scripts/setup_cron.py pause --job-id <job_id>
python3 scripts/setup_cron.py resume --job-id <job_id>
python3 scripts/setup_cron.py delete --job-id <job_id>
python3 scripts/setup_cron.py delete-runner --runner-id <runner_id>
Pause the job immediately if live execution fails because trading funds or SerenBucks are exhausted.
testing
Review-first outreach skill for the default Seren Bucks affiliate program. It bootstraps affiliate context via /programs/discover, mines sent-mail history and address books for candidates, persists them into a skill-owned CRM, proposes an editable daily top-10, drafts outbound and reply batches for approval, reconciles affiliate and reply signals, enforces hard DNC, and returns a manual daily digest.
data-ai
Lean partner-link distribution skill for the seren-affiliates publisher program portfolio. Operates one publisher program per run. Bootstraps the affiliate profile (registering on first run), caches joined programs in serendb, ingests contacts from a pasted list or from Gmail/Outlook address books, drafts a pitch once per run via seren-models for operator approval, sends approved copy through Gmail (preferred) or Microsoft Outlook, enforces per-program dedupe plus a global unsubscribe list, and reports local plus live conversion and commission stats from seren-affiliates.
development
Family office: Process an incoming GP capital call notice end-to-end — confirm, fund, log, reconcile.
development
Work with Seren Bounty affiliate bounties: customers create and fund verifier-backed bounties; agents join to receive a referral_code and accrue earnings as qualifying events are verified; a release sweep pays matured earnings out of escrow.