T09 · Insecure Skill Coding Practices
- Location
scripts/stock_monitor.py:424- Finding
Fabricated market data can produce misleading investment recommendations
- Content
View full analysis
List[Dict]: """模拟K线数据 (当无法获取真实数据时)""" import random quotes = [] base_price = 50.0 for i in range(days): date = (datetime.now().date()).strftime("%Y-%m-%d") open_p = base_price + random.uniform(-2, 2) close_p = open_p + random.uniform(-1.5, 1.5) high_p = max(open_p, close_p) + random.uniform(0, 1) low_p = min(open_p, close_p) - random.uniform(0, 1) volume = random.randint(1000000, 10000000) quotes.append({ "date": date, "open": round(open_p, 2), "close": round(close_p, 2), "high": round(high_p, 2), "low": round(low_p, 2), "volume": volume }) base_price = close_p return quotes ``` ### Technical Analysis When the Sina K-line response is malformed, unavailable, or cannot be parsed, the implementation substitutes randomly generated price and volume history. The caller does not receive a provenance or simulation flag. The synthetic records are passed into the same technical-analysis pipeline as genuine market records. They can consequently affect moving averages, MACD, KDJ, RSI, Bolling ...[truncated 1468 chars]- Remediation
View remediation
