DiscoverySignal ServiceRead-onlyRecommendPLANNEDSpec startedcapital · IndirectP2 · Data normalisation○pendingflagshipstub
Score every market across volume, spread, depth, dispute history, rule clarity, implied volatility, and time-to-resolution into a single quality rank. Sits before every strategy and replaces ad-hoc per-strategy quality checks with a shared, consistent score.
Score every market across volume, spread, depth, dispute history, rule clarity, implied volatility, and time-to-resolution into a single quality rank. Sits before every strategy and replaces ad-hoc per-strategy quality checks with a shared, consistent score.
3. Why This Bot Matters
No shared quality score
Each strategy re-derives its own quality filter, producing inconsistent rankings and wasted per-strategy compute.
High-dispute markets not penalised
Markets with frequent UMA disputes carry elevated resolution risk; without a dispute-penalty weight they appear equivalent to clean markets.
Short-horizon markets ignored
Markets resolving in <24h may have inflated spreads or thin books that are artefacts of the final trading window, not genuine signals.
4. Required Polymarket Inputs
Input
Source
Required?
Use
Book depth, spread, and 24h volume per market
CLOB + Data API
Yes
Compute liquidity sub-score.
Market resolution rules text and neg-risk flag
Gamma API
Yes
Derive rule-clarity sub-score and flag ambiguous resolution criteria.
Historical dispute frequency for UMA markets
Data API / onchain
No
Penalise markets with elevated dispute history in the composite score.
5. Required Internal Inputs
Input
Source
Required?
Use
MarketScanner candidate list
disc.marketscanner
Yes
Only score markets that have already passed MarketScanner tradability filters.
KillSwitch active flag
risk.kill_switch
Yes
Suppress quality report emissions when KillSwitch is active.
6. Parameter Guide
Parameter
Default
Warning
Hard
What it controls
min_quality_score
0.4
0.3
0.2
Minimum composite quality score a market must achieve to be forwarded to strategies.
weight_liquidity
0.4
0.1
0.0
Weight applied to the liquidity sub-score (depth × volume) in the composite.
weight_rule_clarity
0.35
0.1
0.0
Weight applied to the rule-clarity sub-score derived from resolution text analysis.
7. Detailed Parameter Instructions
min_quality_score
What it means
Minimum composite quality score a market must achieve to be forwarded to strategies.
Default
{ "min_quality_score": 0.4 }
Why this default matters
A floor of 0.4 filters the bottom tier of markets while leaving a broad set available for diverse strategies.
Threshold logic
Condition
Action
score >= 0.4
Forward to strategy layer
0.3–0.4
Forward with WARN annotation
< 0.2
Drop — LOW_QUALITY_SCORE hard reject
Developer check
if (score < params.hard) emit(HARD_REJECT, 'LOW_QUALITY_SCORE');
User-facing English
Markets that score poorly across volume, spreads, and clarity are not surfaced as opportunities.
weight_liquidity
What it means
Weight applied to the liquidity sub-score (depth × volume) in the composite.
Default
{ "weight_liquidity": 0.4 }
Why this default matters
Liquidity is the strongest predictor of execution quality, so it receives the highest default weight.
Threshold logic
Condition
Action
weight >= 0.1
Normal
< 0.0
Reject config — weight must be non-negative
Developer check
if (w < 0) throw ConfigError('PARAMETER_CHANGE_REQUIRES_APPROVAL');
User-facing English
Liquid markets with deep order books are ranked higher.
weight_rule_clarity
What it means
Weight applied to the rule-clarity sub-score derived from resolution text analysis.
Default
{ "weight_rule_clarity": 0.35 }
Why this default matters
Ambiguous resolution criteria are a leading cause of disputed outcomes; high weight keeps them penalised.
Threshold logic
Condition
Action
weight >= 0.1
Normal
< 0.0
Reject config
Developer check
if (w < 0) throw ConfigError('PARAMETER_CHANGE_REQUIRES_APPROVAL');
User-facing English
Markets with clear, unambiguous resolution rules are ranked higher.
Gamma API returning crafted resolution text to manipulate rule_clarity scores
Data API returning artificially low dispute counts to inflate quality scores
Mitigations
Rule clarity scoring uses local heuristics, not API-provided scores
All ObservationReports are recommendations only; downstream bots independently validate
24. Polymarket V2 Compatibility
Aspect
Value
CLOB version
v2
Collateral asset
pUSD
EIP-712 Exchange domain version
2
Aware of builderCode field
no
Aware of negative-risk markets
yes
Multi-chain ready
no
SDK used
py-clob-client-v2
Settlement contract
CTFExchangeV2
Notes
All volume and depth figures denominated in pUSD; neg-risk flag from Gamma API used to apply stricter rule-clarity checks on augmented open-set markets.
API surfaces declared
gammadataclob_publicinternal
Networks supported
polygon
25. Versioning & Migration
Field
Value
spec
2.0.0
implementation
0.1.0
schema
2
released
None
planned_release
Q4-2026
Migration history
Date
From
To
Reason
Action taken
2026-04-28
n/a
v2-spec
Spec drafted post-CLOB-V2 cutover; bot not yet implemented
Designed against V2 schema (pUSD, builder codes, V2 EIP-712 domain)
26. Acceptance Tests
Unit Tests
Test
Setup
Expected result
Market below hard floor emits LOW_QUALITY_SCORE HARD_REJECT
composite_score=0.15, hard=0.2
Market dropped from candidate list with reason LOW_QUALITY_SCORE
Dispute penalty caps at 0.3
disputes_30d=50
dispute_penalty=0.3, not 5.0
KillSwitch suppresses emissions
killswitch.active=true
No ObservationReports emitted; scoring runs internally
ObservationReport includes all sub-scores and is consumed downstream by OpportunityQueue
Gamma API unavailability halts cycle with STALE_MARKET_DATA
No reports emitted; next cycle resumes when API recovers
Property Tests
Property
Required behaviour
composite_score always in [0, 1]
Always true
No report emitted when KillSwitch is active
Always true
27. Operational Runbook
MarketQualityRanker incidents are usually upstream data issues or threshold drift. Bot is read-only; incidents do not affect active positions.
On-call actions
Alert
First step
Diagnosis
Mitigation
Escalate to
MarketQualityRankerNoEmissions
MarketQualityRankerAllDropped
Manual overrides
—
Healthcheck
GET /internal/health/marketqualityranker → green if Last cycle completed within 2× scoring interval and at least one report emitted.; red if No cycle completed in 2× interval or zero reports for 10 minutes.
28. Promotion Gates
A bot does not advance to the next readiness state until every gate below is green. Gates are observable from production data — no subjective sign-off.
Promote to Shadow
Gate
How measured
Threshold
Unit tests pass for all threshold cases and dispute penalty cap
CI test run
100% pass
Promote to Limited live
Gate
How measured
Threshold
Quality score distribution is stable over 48h shadow run