From 668ebe1e44b04f14f9ccc75f9ac04f176f95a069 Mon Sep 17 00:00:00 2001 From: jack Date: Fri, 28 Aug 2026 18:36:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A2=E9=92=88=E6=8A=8A=2040014=20=E5=88=A4?= =?UTF-8?q?=E4=B8=BA=E6=9C=80=E5=B0=8F=E6=9D=83=E9=99=90=E7=9A=84=E6=AD=A3?= =?UTF-8?q?=E5=B8=B8=E8=A1=A8=E7=8E=B0=EF=BC=8C=E5=B9=B6=E7=BF=BB=E8=AF=91?= =?UTF-8?q?=20parentId/=E6=9D=83=E9=99=90/=E7=99=BD=E5=90=8D=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- live/deploy/whereismoney.py | 40 ++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/live/deploy/whereismoney.py b/live/deploy/whereismoney.py index fb98253..416672b 100644 --- a/live/deploy/whereismoney.py +++ b/live/deploy/whereismoney.py @@ -29,6 +29,20 @@ sys.path.insert(0, str(Path(__file__).resolve().parents[1])) from bitget_rest import MARGIN_COIN, PRODUCT, Bitget # noqa: E402 +def _perm_hint(e: Exception) -> str: + """把 40014 说成"正常"而不是"故障"。 + + 这把 key 刻意只开合约权限,所以现货类端点必然报 40014。**不要**为了让 + 这个探针看全就去加现货权限——那是白扩爆炸半径,而同样的信息在 App 里 + 看一眼就有。 + """ + s = str(e) + if "40014" in s: + return ("跳过:这把 key 没开现货权限(刻意的,最小权限)。" + "这一栏改用 Bitget App 看,别为了探针去加权限") + return f"查不了:{type(e).__name__}: {e}" + + async def main() -> None: api = Bitget() if not (api.key and api.secret and api.passphrase): @@ -41,7 +55,7 @@ async def main() -> None: flag = " ← 钱在这里" if amt > 1 else "" print(f" {b.get('accountType'):<16} {amt:>12.2f} USDT{flag}") except Exception as e: # noqa: BLE001 - print(f" 查不了:{type(e).__name__}: {e}") + print(f" {_perm_hint(e)}") print(f"\n── {PRODUCT} 下的各保证金币种 ──") try: @@ -53,7 +67,7 @@ async def main() -> None: print(f" {a.get('marginCoin'):<8} 权益 {eq:>12.4f} · " f"可用 {float(a.get('available') or 0):>12.4f}") except Exception as e: # noqa: BLE001 - print(f" 查不了:{type(e).__name__}: {e}") + print(f" {_perm_hint(e)}") print("\n── 其他合约类型(钱可能充错了本位)──") for pt in ("coin-futures", "usdc-futures"): @@ -74,16 +88,28 @@ async def main() -> None: print(f" {hit if hit else '空'}" f"{' ← 要划转到 U 本位合约' if hit else ''}") except Exception as e: # noqa: BLE001 - print(f" 查不了:{type(e).__name__}: {e}") + print(f" {_perm_hint(e)}") print("\n── 这把 key 属于哪个账户 ──") - for path in ("/api/v2/user/account-info", "/api/v2/spot/account/info"): + for path in ("/api/v2/spot/account/info", "/api/v2/user/account-info"): try: - d = await api._req("GET", path) - print(f" {path} → {d}") - break + d = await api._req("GET", path) or {} except Exception as e: # noqa: BLE001 print(f" {path} 查不了:{type(e).__name__}: {e}") + continue + uid, par = d.get("userId"), d.get("parentId") + print(f" userId {uid}") + if par: + print(f" parentId {par} → **这是子账户**。主账户的钱这把 key" + f" 看不到也动不了,这是好事(爆炸半径被账户边界封住)。" + f"\n 但充值要充到 userId {uid} 的 U 本位合约里。" + f"\n 注意主→子划转默认落在子账户的**现货**钱包," + f"还要在子账户内部再划一次到 U 本位合约") + else: + print(" 没有 parentId → 这是主账户") + print(f" 权限 {d.get('authorities')}(没有现货权限是刻意的)") + print(f" IP 白名单 {d.get('ips')}") + break finally: await api.close()