chore(V2): mypy clean — fix radice V2 nuovo + suppress mirato V1 legacy

- settings.py: lambda factory + type:ignore[call-arg] per env-loaded models
- routers/*.py (6 file): cast esplicito Environment / Client per request.state
- __main__.py: cast Literal env in builder, type:ignore Settings()
- server.py: type:ignore[method-assign] su app.openapi
- deribit/tools.py: assert su validator-normalized fields, list return type
- deribit/client.py: type:ignore mirato no-any-return / has-type, rinomina types→types_list
- hyperliquid/{client,tools}.py: assert su validator-normalized fields, var-annotated
- alpaca/client.py: type:ignore mirato per SDK quirks (assignment, no-any-return, arg-type, union-attr)
- {macro,sentiment}/fetchers.py: type:ignore mirato no-any-return / operator / union-attr

Mypy: 68 → 0 errors. Test: 259 passing. Ruff: clean.
This commit is contained in:
AdrianoDev
2026-04-30 20:43:03 +02:00
parent 436dfd6f5a
commit 697d118522
16 changed files with 74 additions and 61 deletions
@@ -134,7 +134,7 @@ async def fetch_crypto_news(api_key: str = "", limit: int = 20) -> dict[str, Any
providers_failed.append(name)
continue
providers_ok.append(name)
for item in res:
for item in res: # type: ignore[union-attr]
if "provider" not in item:
item["provider"] = name
all_items.append(item)
@@ -643,7 +643,7 @@ async def fetch_oi_history(asset: str = "BTC", period: str = "5m", limit: int =
past = next((p for p in reversed(points) if p["timestamp"] <= cutoff_ts), None)
if past is None or past["oi"] == 0:
return None
return round(100.0 * (current["oi"] - past["oi"]) / past["oi"], 3)
return round(100.0 * (current["oi"] - past["oi"]) / past["oi"], 3) # type: ignore[no-any-return]
return {
"asset": asset,