mirror of
https://github.com/longbridge/developers.git
synced 2026-09-19 03:34:09 +08:00
83 lines
2.5 KiB
YAML
83 lines
2.5 KiB
YAML
swagger: "2.0"
|
||
info:
|
||
description: "该接口用于获取当日订单的成交明细"
|
||
version: "v1"
|
||
title: "获取当日成交明细"
|
||
paths:
|
||
/v1/trade/execution/today:
|
||
get:
|
||
access: "交易权限"
|
||
parameters:
|
||
- name: "symbol"
|
||
type: "string"
|
||
in: query
|
||
description: "股票代码,使用 `ticker.region` 格式,例如:`AAPL.US`"
|
||
required: false
|
||
- name: "order_id"
|
||
type: "string"
|
||
required: false
|
||
description: "订单 ID,用于指定订单 ID 查询,例如: `701276261045858304`"
|
||
responses:
|
||
"200":
|
||
description: "查询成功"
|
||
schema:
|
||
$ref: "#/definitions/executions"
|
||
"400":
|
||
description: "查询失败,请求参数错误。"
|
||
request_body:
|
||
type: "python"
|
||
value: |
|
||
import os
|
||
import json
|
||
from longbridge.http import Auth, Config, HttpClient
|
||
|
||
auth = Auth(os.getenv("LONGBRIDGE_APP_KEY"), os.getenv("LONGBRIDGE_APP_SECRET"), access_token=os.getenv("LONGBRIDGE_ACCESS_TOKEN"))
|
||
http = HttpClient(auth, Config(base_url="https://openapi.longbridge.global"))
|
||
|
||
resp = http.get("/v1/trade/execution/today")
|
||
print(json.dumps(resp.data, indent=2))
|
||
response_body:
|
||
{
|
||
"code": 0,
|
||
"message": "success",
|
||
"data":
|
||
{
|
||
"trades":
|
||
[
|
||
{
|
||
"order_id": "693664675163312128",
|
||
"price": "388",
|
||
"quantity": "100",
|
||
"symbol": "700.HK",
|
||
"trade_done_at": "1648611351",
|
||
"trade_id": "693664675163312128-1648611351433741210",
|
||
},
|
||
],
|
||
},
|
||
}
|
||
definitions:
|
||
today_executions_rsp:
|
||
properties:
|
||
orders:
|
||
type: "arrary"
|
||
description: 成交明细信息
|
||
properties:
|
||
order_id:
|
||
type: "string"
|
||
description: 订单 ID
|
||
trade_id:
|
||
type: "string"
|
||
description: 成交 ID
|
||
symbol:
|
||
type: "string"
|
||
description: "股票代码,使用 `ticker.region` 格式,例如:`AAPL.US`"
|
||
trade_done_at:
|
||
type: "string"
|
||
description: "成交时间,格式为时间戳 (秒)"
|
||
quantity:
|
||
type: "string"
|
||
description: 成交数量
|
||
price:
|
||
type: "string"
|
||
description: 成交价格
|