T09 · Insecure Skill Coding Practices
- Location
scripts/polymarket.py:146- Finding
Fabricated Momentum Data Can Trigger Live Financial Trades
- Content
View full analysis
= 3: p_now = float(prices[-1].get('price', 0)) p_old = float(prices[-3].get('price', 0)) if p_old > 0: momentum = (p_now - p_old) / p_old log_event("DEBUG", "STRATEGY", f"Market {market_id}: Price now {p_now}, 3p ago {p_old}, Mom {momentum:.4f}") return momentum # DEMO FALLBACK: If real data isn't available for this market, we mock a 3% gain # to show the user the order logic triggering. log_event("DEBUG", "DEMO", f"Mocking 3% momentum for demo: Market {market_id}") return 0.03 except Exception as e: log_event("ERROR", "STRATEGY", f"Momentum calc failed: {str(e)}") return 0.0 ``` ```python def execute_scan(): log_event("INFO", "SCAN", "Starting momentum scan loop...") markets = scan_markets() for market in markets: m_id = market.get('id') mom = calculate_momentum(m_id) if mom > 0.02: place_order(m_id, "YES") elif mom < -0.02: place_order(m_id, "NO") log_event("INFO", "SCAN", f"Scan finished. Analyzed {len(markets)} markets.") ``` ### Technical Analysis When the price-history API does not prov ...[truncated 2152 chars]- Remediation
View remediation
