T09 · Insecure Skill Coding Practices
- Location
trader.py:307- Finding
Minimum Market Volume Safeguard Is Configured but Never Enforced
- Content
View full analysis
= MAX_POSITIONS: break side, size, reasoning = compute_signal(m) if not side: safe_print(f" [skip] {reasoning}") continue ok, why = context_ok(client, m.id) if not ok: safe_print(f" [skip] {why}") continue try: r = client.trade( market_id=m.id, side=side, amount=size, source=TRADE_SOURCE, skill_slug=SKILL_SLUG, reasoning=reasoning, ) ``` The documented setting is: ```markdown | `SIMMER_MIN_VOLUME` | `2000` | Min market volume — lower bar for niche YouTube markets | ``` ### Technical Analysis The application loads `SIMMER_MIN_VOLUME` from the environment and advertises it as a market-liquidity safeguard. However, neither `compute_signal()` nor the execution loop compares a market's volume against this threshold. Consequently, any discovered market that passes the probability, spread, resolution, and context checks may be traded regardless of its liquidity. Merely loading a risk parameter does not enforce the associated policy. Low-volume prediction ...[truncated 1308 chars]- Remediation
View remediation
tuple[bool, str]: raw_volume = getattr(market, "volume", None) try: volume = float(raw_volume) except (TypeError, ValueError): return False, "Missing or invalid market volume" if not math.isfinite(volume) or volume < 0: return False, "Invalid market volume" if volume < MIN_VOLUME: return False, f"Volume ${volume:,.2f} below ${MIN_VOLUME:,.2f}" return True, "ok" ``` Call this check before `compute_signal()` or `client.trade()`. ]]>
