批量下单
批量创建多个订单,最多支持20个订单。
接口信息
- 方法:
POST - 路径:
/api/v1/stock/open-api/batchOrder
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| orders | array | 是 | 订单列表,最多20个 |
订单对象字段:
- symbol: 股票代码
- side: buy/sell
- type: limit/market
- price: 委托价格
- quantity: 委托数量
- clientOid: 客户自定义ID
请求示例
{
"orders": [
{
"symbol": "AAPL",
"side": "buy",
"type": "limit",
"price": "185.50",
"quantity": "500",
"clientOid": "batch-001"
},
{
"symbol": "TSLA",
"side": "sell",
"type": "limit",
"price": "250.00",
"quantity": "10",
"clientOid": "batch-002"
}
]
}
响应字段
| 字段 | 类型 | 说明 |
|---|---|---|
| code | int | 状态码,0 表示成功 |
| msg | string | 返回消息 |
| data.results | array | 结果列表 |
| results[].orderId | string | 订单ID(成功时返回) |
| results[].clientOid | string | 客户自定义ID |
| results[].success | boolean | 是否成功 |
| results[].errorMsg | string | 错误信息(失败时返回) |
| results[].errorCode | int | 错误码(失败时返回) |
响应示例
{
"code": 0,
"msg": "success",
"data": {
"results": [
{
"orderId": "123456789",
"clientOid": "batch-001",
"success": true
},
{
"orderId": "",
"clientOid": "batch-002",
"success": false,
"errorCode": 1001,
"errorMsg": "余额不足"
}
]
}
}