Explain demo-only keys in the exchange test error hint

This commit is contained in:
eezd committed 2026-10-15 09:40:56 +08:00
1 parent 20fd5a98b2
commit 154fe2b687
1 file changed
+1 -1
+1 -1
View File
@@ -240,7 +240,7 @@ async def test_exchange(session: Annotated[AsyncSession, Depends(get_session)])
info = await client.request("GET", "/fapi/v3/account") info = await client.request("GET", "/fapi/v3/account")
mode = await client.request("GET", "/fapi/v1/positionSide/dual") mode = await client.request("GET", "/fapi/v1/positionSide/dual")
except ExchangeError as e: except ExchangeError as e:
hint = "(key 无效、未开启合约交易权限,或限制了 IP)" if e.code == -2015 else "" hint = "(key 须在币安模拟交易里创建,实盘 key 不能用;或未开启合约权限、服务器 IP 不在白名单)" if e.code == -2015 else ""
return ExchangeTestResult(ok=False, elapsed_ms=round((time.monotonic() - started) * 1000), error=f"{e}{hint}") return ExchangeTestResult(ok=False, elapsed_ms=round((time.monotonic() - started) * 1000), error=f"{e}{hint}")
return ExchangeTestResult( return ExchangeTestResult(
ok=True, elapsed_ms=round((time.monotonic() - started) * 1000), ok=True, elapsed_ms=round((time.monotonic() - started) * 1000),