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:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user