mirror of
https://github.com/longbridge/developers.git
synced 2026-09-19 03:34:09 +08:00
102 lines
2.9 KiB
YAML
102 lines
2.9 KiB
YAML
swagger: "2.0"
|
|
info:
|
|
description: "This API is used to get today executions"
|
|
version: "v1"
|
|
title: "Get Today Executions"
|
|
paths:
|
|
/v1/trade/execution/today:
|
|
get:
|
|
access: "Trading Permissions"
|
|
parameters:
|
|
- name: "symbol"
|
|
type: "string"
|
|
in: query
|
|
description: "Stock symbol, use `ticker.region` format, example: `AAPL.US`"
|
|
required: false
|
|
- name: "order_id"
|
|
type: "string"
|
|
required: false
|
|
description: "Order ID, example: `701276261045858304`"
|
|
responses:
|
|
"200":
|
|
description: "Get Today Executions Success"
|
|
schema:
|
|
$ref: "#/definitions/executions"
|
|
"400":
|
|
description: "The query failed with an error in the request parameter."
|
|
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.longbridgeapp.com"))
|
|
|
|
query = {
|
|
'symbol': '700.HK',
|
|
}
|
|
|
|
resp = http.get("/v1/trade/execution/today", query)
|
|
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:
|
|
trades:
|
|
type: "object[]"
|
|
description: Execution Detail
|
|
required:
|
|
[
|
|
"order_id",
|
|
"trade_id",
|
|
"symbol",
|
|
"trade_done_at",
|
|
"quantity",
|
|
"price",
|
|
]
|
|
properties:
|
|
order_id:
|
|
type: "string"
|
|
description: Order ID
|
|
required: true
|
|
trade_id:
|
|
type: "string"
|
|
description: Execution ID
|
|
required: true
|
|
symbol:
|
|
type: "string"
|
|
description: "Stock symbol, use `ticker.region` format, example: `AAPL.US`"
|
|
required: true
|
|
trade_done_at:
|
|
type: "string"
|
|
description: Trade done time, formatted as a timestamp (second)
|
|
required: true
|
|
quantity:
|
|
type: "string"
|
|
description: Executed quantity
|
|
required: true
|
|
price:
|
|
type: "string"
|
|
description: Executed price
|
|
required: true
|