{"record":{"id":"d2ea07c777eaa398","repo":"HKUDS/Vibe-Trading","slug":"binance-usd-m-shadow-account-supports-usdt-collate","errorCode":null,"errorMessage":"Binance USD-M Shadow Account supports USDT collateral only","messagePattern":"Binance USD-M Shadow Account supports USDT collateral only","errorType":"exception","errorClass":"UsdMObservationError","httpStatus":null,"severity":"error","filePath":"agent/src/trading/connectors/binance/usdm.py","lineNumber":196,"sourceCode":"                risk_row.get(\"openOrderInitialMargin\"),\n                \"openOrderInitialMargin\",\n                non_negative=True,\n            ),\n        )\n        if any(open_order_margins):\n            raise UsdMObservationError(\"Binance USD-M Shadow Account requires zero open-order margin\")\n        for account_field, risk_field in (\n            (\"positionInitialMargin\", \"positionInitialMargin\"),\n            (\"maintMargin\", \"maintMargin\"),\n            (\"unrealizedProfit\", \"unRealizedProfit\"),\n        ):\n            if not close_enough(\n                _number(account_row.get(account_field), account_field),\n                _number(risk_row.get(risk_field), risk_field),\n            ):\n                raise UsdMObservationError(\"Binance USD-M position reads are incoherent\")\n        if str(risk_row.get(\"marginAsset\") or \"\").upper() != \"USDT\":\n            raise UsdMObservationError(\"Binance USD-M Shadow Account supports USDT collateral only\")\n        isolated = account_row.get(\"isolated\")\n        if not isinstance(isolated, bool):\n            raise UsdMObservationError(\"Binance USD-M margin mode is missing\")\n        isolated_margin = _number(\n            risk_row.get(\"isolatedMargin\"),\n            \"isolatedMargin\",\n            non_negative=True,\n        )\n        if isolated and isolated_margin == 0:\n            raise UsdMObservationError(\"Binance USD-M isolated position requires positive isolated margin\")\n        if not isolated and isolated_margin != 0:\n            raise UsdMObservationError(\"Binance USD-M cross position must report zero isolated margin\")\n        result.append(\n            {\n                \"symbol\": _canonical_symbol(raw_symbol),\n                \"quantity\": quantity,\n                \"entry_price\": entry_price,\n                \"leverage\": _number(account_row.get(\"leverage\"), \"leverage\", positive=True),","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/trading/connectors/binance/usdm.py#L178-L214","documentation":"The Shadow Account only supports USDT-margined positions with USDT as the margin asset. If the position-risk row's marginAsset (uppercased) is anything but USDT (e.g. BUSD, USDC, or a multi-assets-mode row), this error is raised.","triggerScenarios":"Holding a position on a contract settled/margined in a non-USDT asset, or having Multi-Assets Mode enabled on the USD-M futures account, which reports marginAsset per position differently.","commonSituations":"Multi-Assets Mode enabled in Binance futures wallet settings; legacy BUSD-margined contracts; user copying a strategy from a coin-margined (COIN-M) account.","solutions":["Switch the futures wallet to Single-Asset Mode with USDT (POST /fapi/v1/multiAssetsMargin with multiAssetsMargin=false)","Close positions on non-USDT-margined contracts before importing the account","Restrict trading to USDT-margined perpetual symbols (e.g. BTCUSDT not BTCUSDC)"],"exampleFix":"# before: account in Multi-Assets Mode\n# after: switch to single-asset USDT margin\nawait client.futures_change_margin_type(coin='USDT')  # or:\nawait client.request('POST', '/fapi/v1/multiAssetsMargin', {'multiAssetsMargin': 'false'})","handlingStrategy":"validation","validationCode":"risk = await client.futures_position_risk()\nbad = [p for p in risk if float(p.get('positionAmt', 0)) != 0 and p['marginAsset'].upper() != 'USDT']\nif bad:\n    raise RuntimeError(f\"non-USDT margined positions: {[p['symbol'] for p in bad]}\")","typeGuard":null,"tryCatchPattern":"try:\n    obs = await connector.read_account_observation()\nexcept UsdMObservationError as e:\n    if \"USDT collateral only\" in str(e):\n        # close/migrate non-USDT positions, then retry\n        raise  # requires account action, not a runtime fallback\n    raise","preventionTips":["Keep the futures wallet in Single-Asset (USDT) mode","Only trade *USDT perpetuals","Check marginAsset of each symbol before opening it"],"tags":["binance","futures","usdt","margin-asset","multi-assets-mode"],"backgroundTag":"unsupported-margin-asset","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}