Fix trade recovery, local web isolation and backtest risk accounting

This commit is contained in:
Igol committed 2026-10-22 21:49:20 +03:00
1 parent 5c6b0dc54a
commit 6aa76064dc
29 files changed
+2662 -1693

No files matched your search

+7 -2
View File
@@ -167,8 +167,13 @@ def _http(method: str, url: str, headers: dict | None = None, body: bytes | None
else:
_give_back(parts.scheme, parts.netloc, conn)
if resp.status >= 400:
raise LiveError(f"HTTP {resp.status}: {data.decode('utf-8', 'replace')[:300]}")
return json.loads(data or b"{}")
raise LiveError(f"HTTP {resp.status}: {data.decode('utf-8', 'replace')[:300]}",
sent=method in ("POST", "DELETE") and resp.status >= 500)
try:
return json.loads(data or b"{}")
except (ValueError, UnicodeDecodeError) as exc:
raise LiveError(f"не удалось прочитать ответ биржи: {exc}",
sent=method in ("POST", "DELETE")) from None
raise LiveError("нет связи")