T09 · Insecure Skill Coding Practices
- Location
trader.py:42- Finding
Declared Minimum Market Volume Safeguard Is Not Enforced
- Content
View full analysis
tuple[str | None, float, str]: p = market.current_probability q = market.question # Spread gate if market.spread_cents is not None and market.spread_cents / 100 > 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 if p <= YES_THRESHOLD: conviction = (YES_THRESHOLD - p) / YES_THRESHOLD size = max(MIN_TRADE, round(conviction * MAX_POSITION, 2)) edge = YES_THRESHOLD - p return "yes", size, f"YES {p:.0%} edge={edge:.0%} size=${size} -- {q[:70]}" if p >= NO_THRESHOLD: conviction = (p - NO_THRESHOLD) / (1 - NO_THRESHOLD) size = max(MIN_TRADE, round(conviction * MAX_POSITION, 2)) edge = p - NO_THRESHOLD return "no", size, f"NO YES={p:.0%} edge={edge:.0%} size=${size} -- {q[:70]}" return None, 0, f"Neutral at {p:.1%} (outside {YES_THRESHOLD:.0%}/{NO_THRESHOLD:.0%} bands)" ``` ```python def compute_chain_signal(market, chain_dir: str, commodity_p: float, equity_p: float) -> tuple[str | None, float, str]: p = market.current_probability q = market.question # Spread gate if market.spread_cents ...[truncated 1828 chars]- Remediation
View remediation
