Harden env save against empty numerics; default coin margin and hedge off.
Reject blank float/int/select on save and parse env with safe helpers so options config edits cannot crash into 502; default OKX_TRADE_MODE=options and OKX_OPTIONS_MARGIN_MODE=coin. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -34,9 +34,9 @@ def _env_bool(key: str, default: bool = False) -> bool:
|
||||
|
||||
def _env_float(key: str, default: float) -> float:
|
||||
try:
|
||||
return float(os.getenv(key, str(default)))
|
||||
return float(os.getenv(key) or default)
|
||||
except (TypeError, ValueError):
|
||||
return default
|
||||
return float(default)
|
||||
|
||||
|
||||
def attach_options_templates(app: Flask, repo_root: str) -> None:
|
||||
|
||||
Reference in New Issue
Block a user