Skip to content

持倉列表 ​

GET /api/v1.0/sim-trade/{acc_id}/positions

獲取持倉列表(代碼、方向、數量、成本、市值、盈虧)。

請求參數 ​

參數類型位置必填說明
acc_idstringpath是業務賬戶 ID
marketintquery否市場過濾

請求示例 ​

bash
curl -s "https://webapi.moomoo.com/api/v1.0/sim-trade/80303779/positions" -H "Authorization: Bearer <AccessToken>" | jq

響應欄位 ​

返回 data.positions[]。

欄位類型說明
pstn_idint64持倉 ID
pstn_typestringJSON 返回枚舉名稱(數值 0=多倉、1=空倉)
marketstring市場
symbolstring代碼
stock_namestring名稱
qtyint64數量
qty_avblint64可用數量
cost_pricenumber成本價
buy_avg_pricenumber均買價
cur_pricenumber現價
mvstring市值
profitstring盈虧額
profit_rationumber盈虧比
unrealized_profitstring未實現盈虧
realized_profitstring已實現盈虧
today_turnovernumber今日成交額
today_buy_qtyint64今日買入數量
today_sell_qtyint64今日賣出數量
today_buy_turnovernumber今日買入成交額
today_buy_avg_pricenumber今日買入均價
today_sell_turnovernumber今日賣出成交額
today_sell_avg_pricenumber今日賣出均價
today_profitstring今日盈虧

響應示例 ​

json
{
  "ret_code": 0,
  "ret_msg": "success",
  "data": {
    "positions": [
      {
        "pstn_id": 133969,
        "pstn_type": "LONG",
        "market": "HK_STOCK",
        "symbol": "00700",
        "stock_name": "騰訊控股",
        "qty": 100,
        "qty_avbl": 100,
        "cost_price": 448.2,
        "cur_price": 448,
        "mv": "44800",
        "profit": "-20",
        "profit_ratio": -0.0446
      }
    ]
  }
}

錯誤響應 ​

HTTP 狀態仍為 200。請求失敗時返回非 0 的 ret_code 和 error 物件。

json
{
  "ret_code": -3,
  "ret_msg": "invalid request",
  "error": {"code": "invalid_parameter", "message": "invalid request"}
}