持仓列表
GET/api/v1.0/sim-trade/{acc_id}/positions获取持仓列表(代码、方向、数量、成本、市值、盈亏)。
请求参数
| 参数 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
acc_id | string | path | 是 | 业务账户 ID |
market | int | query | 否 | 市场过滤 |
请求示例
bash
curl -s "https://webapi.moomoo.com/api/v1.0/sim-trade/80303779/positions" -H "Authorization: Bearer <AccessToken>" | jq响应字段
返回 data.positions[]。
| 字段 | 类型 | 说明 |
|---|---|---|
pstn_id | int64 | 持仓 ID |
pstn_type | string | JSON 返回枚举名称(数值 0=多仓、1=空仓) |
market | string | 市场 |
symbol | string | 代码 |
stock_name | string | 名称 |
qty | int64 | 数量 |
qty_avbl | int64 | 可用数量 |
cost_price | number | 成本价 |
buy_avg_price | number | 均买价 |
cur_price | number | 现价 |
mv | string | 市值 |
profit | string | 盈亏额 |
profit_ratio | number | 盈亏比 |
unrealized_profit | string | 未实现盈亏 |
realized_profit | string | 已实现盈亏 |
today_turnover | number | 今日成交额 |
today_buy_qty | int64 | 今日买入数量 |
today_sell_qty | int64 | 今日卖出数量 |
today_buy_turnover | number | 今日买入成交额 |
today_buy_avg_price | number | 今日买入均价 |
today_sell_turnover | number | 今日卖出成交额 |
today_sell_avg_price | number | 今日卖出均价 |
today_profit | string | 今日盈亏 |
响应示例
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"}
}