refactor: address python review findings
- Move FRED credential registration to FastAPI lifespan (was fragile import-order-dependent side-effect) - Add noqa E402 annotations for imports after curl_cffi patch - Fix all return type hints: bare dict -> dict[str, Any] - Move yfinance import to module level (was inline in functions) - Fix datetime.now() -> datetime.now(tz=timezone.utc) in openbb_service - Add try/except error handling to Group B service functions - Fix dict mutation in relative_rotation (immutable pattern) - Extract _classify_rrg_quadrant helper function - Fix type builtin shadow in routes_economy (type -> gdp_type) - Fix falsy int guard (if year: -> if year is not None:) - Remove user input echo from error messages
This commit is contained in:
@@ -167,7 +167,7 @@ async def get_rolling_stat(
|
||||
"""Compute a rolling statistic (variance, stdev, mean, skew, kurtosis, quantile)."""
|
||||
valid_stats = {"variance", "stdev", "mean", "skew", "kurtosis", "quantile"}
|
||||
if stat not in valid_stats:
|
||||
return {"symbol": symbol, "error": f"Invalid stat: {stat}. Use: {', '.join(sorted(valid_stats))}"}
|
||||
return {"symbol": symbol, "error": f"Invalid stat. Valid options: {', '.join(sorted(valid_stats))}"}
|
||||
|
||||
fetch_days = max(days, PERF_DAYS)
|
||||
hist = await fetch_historical(symbol, fetch_days)
|
||||
|
||||
Reference in New Issue
Block a user