krakenfutures: satisfy mypy narrowing in flex USD used calculation

This commit is contained in:
matstedt
2026-02-06 19:32:00 +01:00
committed by Matthias
parent 4f8291384d
commit cfa4924b8e
+2
View File
@@ -101,6 +101,8 @@ class Krakenfutures(Exchange):
# Use available value for both if only one is present
usd_free = usd_free if usd_free is not None else usd_total
usd_total = usd_total if usd_total is not None else usd_free
# Type narrowing for mypy: both values are set after fallback.
assert usd_free is not None and usd_total is not None
# Both values are guaranteed to be present after fallback.
usd_used = max(0.0, usd_total - usd_free)
balances["USD"] = {"free": usd_free, "used": usd_used, "total": usd_total}