Skip to main content

get_margin_info

Function get_margin_info 

Source
pub async fn get_margin_info(
    __arg0: State<RestState>,
    rec: Option<Extension<Arc<KeyRecord>>>,
    __arg2: Json<Value>,
) -> Result<Json<Value>, (StatusCode, Json<Value>)>
Expand description

POST /api/margin-info — per-account margin info (mobile-driven, by market)

/api/margin-ratio (per-security ratio) 互补: 本 endpoint 给账户全景.

参数:

  • acc_id (u64, 必填)
  • trd_env (i32, 0=sim 1=real, default 1)
  • market (string, 必填): “HK” / “US” / “CN_AH” (其他市场 → 400 with hint)
  • inner.req_flag (uint32, optional): 1 = 过滤新股中签干扰

响应: ret_type / ret_msg / s2c.inner.user_margin_info[] (含 12 字段子集 的 MarginInfo: 购买力 / 余额 / 净值 / 保证金 / 流动性 / 风险等级 / HK-specific)

Pitfall #42 backend-semantic risk: backend 接受我们 12 字段子集是 未真机 verify 假设. 真机 fail 时 ret_type=-1 + clear hint 指 fallback /api/margin-ratio per-security ratio.