T09 · Insecure Skill Coding Practices
- Location
trader.py:326- Finding
Declared Minimum-Volume Safeguard Is Not Enforced
- Content
View full analysis
MAX_SPREAD: return None, 0, f"Spread {market.spread_cents/100:.1%} > {MAX_SPREAD:.1%}" # Days-to-resolution gate if market.resolves_at: try: resolves = datetime.fromisoformat(market.resolves_at.replace("Z", "+00:00")) days = (resolves - datetime.now(timezone.utc)).days if days < MIN_DAYS: return None, 0, f"Only {days}d to resolve" except Exception: pass # Longshot gate: only trade markets priced between 2% and LONGSHOT_CEILING if not is_longshot(p): return None, 0, f"Not a longshot: p={p:.1%} (need {0.02:.0%}-{LONGSHOT_CEILING:.0%})" # Compute macro support score support_score, support_reason = compute_macro_support(market, all_markets) if support_score < MIN_SUPPORT: return None, 0, ( f"Weak macro support: {support_score:.2f} < {MIN_SUPPORT:.2f} " f"({support_reason}) -- {q[:50]}" ) # Longshot = always buy YES (we are betting the unlikely event happens) # Conviction scales with how far below the ceiling AND macro support conviction = ((LONGSHOT_CEILING - p) / LONGSHOT_CEILING) * support_score conviction = min(1.0, conviction) # Cap position size for longshots (high risk) max_longshot_size = LONGSHOT_SIZE_CAP * MAX_POSITION size = max(MIN_TRADE, round(conviction * max_longshot_size, 2)) ``` ### Technical Analysis The `MIN_VOLUME` setting is initialized at `trader.py:40` and reloaded at `trader.py:85`, while `SKILL.md:136` describes it as a minimum market-volume filter. However, `compute_signal()` checks only spread, time to resolution, longshot probability, and macro support. It never compares market volume with `MIN_VOLUME`. Consequently, the documented liqui ...[truncated 1420 chars]- Remediation
View remediation
