redeem-auto — Watcher that auto-claims winning shares

Polls CLOB cash balance every 5 minutes, spawns redeem.js --live whenever balance dips below the threshold (default $20). Keeps a fleet of high-churn scalpers funded without manual redemption.

Version v1.0.0 · One-time payment · Source code download
Strategy typeUtility
AssetAll
Timeframe
Market typeAll Polymarket markets
Minimum capital$0
Dependencies@polymarket/clob-client-v2, @polymarket/builder-relayer-client, ethers

What it does

redeem-auto is a long-running watcher that polls your CLOB cash (collateral) balance every 5 minutes by default. When balance drops below the threshold (default $20), it spawns tools/redeem.js --live to claim all redeemable positions on-chain. After the redeem completes, it logs the new balance and goes back to sleep.

The edge

The bots in this suite don't redeem on their own. They focus on trading. Without something polling the wallet, winning shares accumulate as outcome tokens that the CLOB doesn't count as collateral, and the bots run out of money even after a winning streak.

redeem-auto is the simplest possible solution: a tiny watcher that does one thing and stays out of the way. It's a 93-line file. Running it 24/7 alongside your trading bots means every winning trade becomes fresh capital within 5 minutes.

How it works

loop { cash = await CLOB.getBalanceAllowance('COLLATERAL') if cash < THRESHOLD: spawn('node tools/redeem.js --live') sleep INTERVAL_SEC }

Implementation details:

  1. CLOB v2 client (@polymarket/clob-client-v2) reads collateral balance via getBalanceAllowance({ asset_type: 'COLLATERAL' }). Result is in 6-decimal USDC units, divided by 1e6 for display.
  2. Spawn: node tools/redeem.js --live is spawned as a child process with stdio: 'inherit', so the redeemer's on-chain TX hashes appear in your monitor's log.
  3. Block until redeem completes, then re-read the balance for a confirmation log line.
  4. Error handling: any failure in the balance check logs the error and continues. The loop never dies.
  5. --once mode: useful for cron-driven setups where the schedule is external.

Sample output

[25/05/2026, 17:00:00] Auto-redeem watcher started | threshold=$20 | interval=300s [25/05/2026, 17:00:01] Cash: $34.50 | Threshold: $20.00 [25/05/2026, 17:05:01] Cash: $28.75 | Threshold: $20.00 [25/05/2026, 17:10:01] Cash: $18.40 | Threshold: $20.00 [25/05/2026, 17:10:01] Cash below threshold — triggering redeem [25/05/2026, 17:10:18] Redeem complete. New cash: $41.20

Design targets

Latency: from a winning resolution to USDC back in CLOB collateral, ≤ INTERVAL_SEC + on-chain confirmation. With the default 5-min interval and ~3s confirmation, that's about 5 minutes 3 seconds worst case. Halve the interval to 150s if you run high-frequency scalpers; you'll spend slightly more on RPC calls but the bots will see fresh capital faster.

Capital recovered per cycle: as much as is currently redeemable. A high-volume scalper fleet (poly5m-v4 + poly15m-sniper + poly15m-v6 running together) typically generates 20-40 redeemable positions per day. Each redeem call batches them in groups of 20 (configurable via the underlying redeem.js).

FAQ

When to use this vs the manual redeemer?

Manual redeemer: fine if you run low-volume strategies (contrarian, no-bot, polyweather) and check things once a day. redeem-auto: required for scalpers that churn through 20+ resolutions per day, since they'll run out of collateral within hours otherwise.

When to use this vs redeem-convert-auto?

redeem-auto handles the redeem step. If your bots use markets that still settle in USDC.e (most pre-V2 markets), you also need the wrap step to convert USDC.e → pUSD. That's what redeem-convert-auto does: it's a superset.

If you only trade markets that settle directly in pUSD, redeem-auto is enough.

What's included

  • tools/redeem-auto.js (the watcher)
  • tools/redeem.js (the on-chain redeemer it spawns)
  • README with pm2 ecosystem.config.js example and cron alternative

Configuration

FlagDefaultDescription
--threshold 2020Cash balance threshold in USD. Triggers redeem when balance drops below.
--interval 300300Seconds between balance checks. Default 5 minutes.
--onceRun one check then exit. Useful for cron-driven setups.

Related bots