Show okx_sim/okx_live and gate live API fields by matching mode.

In sim, hide LIVE/API keys and expose simulated fund settings in env UI.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-14 18:35:08 +08:00
parent bd742a2e43
commit e7aa724a3b
9 changed files with 150 additions and 20 deletions
+8
View File
@@ -78,3 +78,11 @@ def set_trading_mode(get_db: Callable, mode: str) -> str:
def is_sim_mode(get_db: Callable) -> bool:
return get_trading_mode(get_db) == MODE_SIM
def exchange_mode_label(*, is_sim: bool | None = None, get_db: Callable | None = None, exchange_key: str = "okx") -> str:
"""顶栏交易所展示: okx_sim / okx_live."""
ex = (exchange_key or "okx").strip().lower() or "okx"
if is_sim is None and callable(get_db):
is_sim = is_sim_mode(get_db)
return f"{ex}_sim" if bool(is_sim) else f"{ex}_live"