T09 · Insecure Skill Coding Practices
- Location
scripts/run_trade.py:73- Finding
Untrusted market content influences autonomous live-trading decisions
- Content
View full analysis
= 2 and len(tokens) >= 2: p0 = float(prices[0]) if p0 < 0.05 or p0 > 0.95: continue all_markets.append({ "question": m.get("question", ""), "description": m.get("description", "")[:400], "prices": [float(p) for p in prices], "tokens": tokens, "volume": float(m.get("volume", 0)), "end_date": m.get("endDate", "")[:10] }) except: continue def evaluate(market): prompt = f"""Estimate TRUE probability (0.0-1.0) YES wins. Be contrarian when justified. Q: {market['question']} Desc: {market['description'][:200]} YES price: {market['prices'][0]:.3f} End: {market['end_date']} Reply ONLY a number.""" resp = http_requests.post( "https://api.anthropic.com/v1/messages", headers={ "x-api-key": LLM_API_KEY, "anthropic-version": "2023-06-01", "Content-Type": "application/json" }, json={ "model": "claude-3-5-haiku-20241022", "max_tokens": 20, "messages": [{"role": "user", "content": prompt}] }, timeout=30 ) ``` The resulting estimate is then used to place live orders: ```python fair, cost = evaluate(m) total_eval_cost += cost if fair is None: continue mk ...[truncated 2475 chars]- Remediation
View remediation
