获取持仓
GET/api/v1.0/accounts/{acc_id}/positions查询指定交易账户的持仓列表。
路径参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
acc_id | string | 是 | 业务账户 ID。 |
请求参数
| 参数 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
code | string | 查询 | 否 | 标的代码过滤,只返回匹配的持仓。不传则返回全部。期货持仓需传带月份的合约代码,不支持按主力合约代码过滤。 |
pl_ratio_min | string | 查询 | 否 | 盈亏比例下限过滤。传 10 则返回盈亏比例 ≥ +10% 的持仓。 |
pl_ratio_max | string | 查询 | 否 | 盈亏比例上限过滤。传 20 则返回盈亏比例 ≤ +20% 的持仓。 |
asset_category | asset_category | 查询 | 条件必填 | 资产类别。日本保证金 / 衍生品账户必填;日本保证金账户不支持 DOMESTIC;非日本券商忽略。 |
响应参数
| 字段 | 类型 | 说明 |
|---|---|---|
position_side | position_side | 持仓方向。 |
code | string | 标的代码。 |
stock_name | string | 标的名称。 |
security_type | security_type | 证券类型。 |
qty | string | 持仓数量。 |
can_sell_qty | string | 可卖数量。 |
open_time | uint64 | 开仓时间,Unix 秒时间戳(10 位)。与订单、成交的微秒时间戳不同。无开仓时间时不返回该字段。 |
position_id | string | 持仓 ID,用于平指定持仓。外汇平仓下单时必填。 |
currency | string | 交易币种。 |
nominal_price | string | 市价。 |
cost_price | string | 摊薄成本(证券账户)。平均开仓价(期货账户)。 |
cost_price_valid | bool | 成本价是否有效。 |
market_val | string | 市值。 |
pl_ratio | string | 盈亏比例。数字字符串,不含百分号;"3.06" 表示 +3.06%。 |
pl_ratio_valid | bool | 盈亏比例是否有效。 |
pl_val | string | 盈亏金额。 |
pl_val_valid | bool | 盈亏金额是否有效。 |
today_pl_val | string | 今日盈亏。 |
today_trd_val | string | 今日成交额。 |
today_buy_qty | string | 今日买入总量。 |
today_buy_val | string | 今日买入总额。 |
today_sell_qty | string | 今日卖出总量。 |
today_sell_val | string | 今日卖出总额。 |
unrealized_pl | string | 未实现盈亏。 |
realized_pl | string | 已实现盈亏。 |
sub_acc_type | sub_acc_type | (日本)子账户类型。 |
margin_trading_type | margin_trading_type | (日本保证金)信用交易类型。 |
margin_period_type | margin_period_type | (日本保证金)信用交易期限类型。 |
margin_rate | string | (日本保证金)融资利率。 |
collateral_qty | string | (日本现金)抵押数量。 |
covered_qty | string | (日本现金)担保(借入)数量。 |
响应示例
json
{
"s": "ok",
"d": [
{
"position_side": "LONG",
"code": "HK.00700",
"stock_name": "TENCENT",
"qty": "2100",
"can_sell_qty": "2100",
"currency": "HKD",
"nominal_price": "387.600",
"cost_price": "443.381",
"cost_price_valid": true,
"market_val": "813960.00",
"pl_ratio": "-12.58",
"pl_ratio_valid": true,
"pl_val": "-117140.0000",
"pl_val_valid": true,
"today_pl_val": "4720.0000",
"today_trd_val": "38840.0000",
"today_buy_qty": "100",
"today_buy_val": "38840.0000",
"today_sell_qty": "0",
"today_sell_val": "0",
"unrealized_pl": "-1500807.8531",
"realized_pl": "1383667.8531",
"security_type": "STOCK",
"open_time": 1791538873
}
]
}