Longbridge Developers
立即开始

网格订单详情

查询单个网格订单的完整详情,包括网格规则、分页的成交子订单(grid_sub_orders)以及分页的生命周期历史(grid_order_history)。

>_ CLI
# 查看网格订单的规则、子订单与历史
longbridge grid detail 764609681686573056

Request

HTTP MethodGET
HTTP URL/v1/gridtrading/detail

Parameters

Content-Type: application/json; charset=utf-8

NameTypeRequiredDescription
order_idstringYES网格订单 ID,例如:764609681686573056
history_idstringNO生命周期历史的分页游标,传入某页最后一条的 history_id 以获取更早的记录
limitint32NOgrid_sub_orders 与 grid_order_history 的分页大小

Request Example

from longbridge.openapi import GridContext, Config, OAuthBuilder

oauth = OAuthBuilder("your-client-id").build(lambda url: print("Visit:", url))
config = Config.from_oauth(oauth)

# 网格 REST 调用通过独立的 GridContext
ctx = GridContext(config)

resp = ctx.detail("764609681686573056")
print(resp)
const { Config, GridContext, OAuth } = require('longbridge')

async function main() {
  const oauth = await OAuth.build('your-client-id', (_, url) => {
    console.log('Open this URL to authorize: ' + url)
  })
  const config = Config.fromOAuth(oauth)
  const ctx = GridContext.new(config)
  const resp = await ctx.detail({ orderId: '764609681686573056' })
  console.log(resp)
}
main().catch(console.error)
import com.longbridge.*;
import com.longbridge.grid.*;

class Main {
    public static void main(String[] args) throws Exception {
        try (OAuth oauth = new OAuthBuilder("your-client-id").build(url -> System.out.println("Open to authorize: " + url)).get();
             Config config = Config.fromOAuth(oauth);
             GridContext ctx = GridContext.create(config)) {
            GridOrderDetail resp = ctx.detail(new GetGridOrderDetailOptions("764609681686573056")).get();
            System.out.println(resp);
        }
    }
}
use std::sync::Arc;
use longbridge::{
    Config,
    grid::{GridContext, GetGridOrderDetailOptions},
    oauth::OAuthBuilder,
};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let oauth = OAuthBuilder::new("your-client-id").build(|url| println!("Open this URL to authorize: {url}")).await?;
    let config = Arc::new(Config::from_oauth(oauth));
    let ctx = GridContext::new(config);

    let resp = ctx.detail(GetGridOrderDetailOptions::new("764609681686573056")).await?;
    println!("{:?}", resp);
    Ok(())
}
#include &lt;iostream&gt;
#include <longbridge.hpp>

using namespace longbridge;
using namespace longbridge::grid;

static void
run(const OAuth& oauth)
{
    Config config = Config::from_oauth(oauth);
    GridContext ctx = GridContext::create(config);

    GetGridOrderDetailOptions opts{ "764609681686573056" };
    ctx.detail(opts, [](auto res) {
        if (!res) {
            std::cout << "failed" << std::endl;
            return;
        }
        std::cout << "order_id: " << res->order_id << std::endl;
    });
}

int main(int argc, char const* argv[]) {
    const std::string client_id = "your-client-id";
    OAuthBuilder(client_id).build(
    [](const std::string& url) {
        std::cout << "Open this URL to authorize: " << url << std::endl;
    },
    [](auto res) {
        if (!res) {
            std::cout << "authorization failed" << std::endl;
            return;
        }
        run(*res);
    });

    std::cin.get();
    return 0;
}

Response

Response Headers

  • Content-Type: application/json

Response Example

{
  "code": 0,
  "message": "success",
  "data": {
    "order_id": "764609681686573056",
    "symbol": "700.HK",
    "stock_name": "TENCENT",
    "status": "Performing",
    "grid_status": "Performing",
    "suspend_reason": "",
    "sleeping_reason": "",
    "submitted_base_price": "300",
    "current_base_price": "300",
    "upper_limit_price": "360",
    "lower_limit_price": "240",
    "trigger_price_type": 2,
    "trigger_spread_up": "",
    "trigger_spread_down": "",
    "trigger_percent_up": "2",
    "trigger_percent_down": "2",
    "pullback_percent": "",
    "pullback_spread": "",
    "rebound_percent": "",
    "rebound_spread": "",
    "multiple_trigger": false,
    "time_in_force": 1,
    "trigger_quantity": "100",
    "trigger_sell_quantity": "0",
    "trigger_buy_quantity": "0",
    "upper_limit_quantity": "200",
    "lower_limit_quantity": "100",
    "upper_limit_event": 1,
    "lower_limit_event": 1,
    "trigger_sell_depth": 0,
    "trigger_buy_depth": 0,
    "created_at": "2024-08-12T10:30:00+08:00",
    "updated_at": "2024-08-12T10:30:00+08:00",
    "settlement_currency": "HKD",
    "expire_time": "",
    "gtd": "",
    "grid_sub_orders": [],
    "sub_has_more": false,
    "grid_order_history": [
      {
        "history_id": "764609681686573100",
        "created_at": "2024-08-12T10:30:00+08:00",
        "status": "Performing",
        "suspend_reason": "",
        "reason": "Grid order started"
      }
    ],
    "history_has_more": false,
    "support_shortsell": false,
    "rth": 0,
    "grid_order_type_up": "GMO",
    "grid_order_type_down": "GMO"
  }
}

Response Status

StatusDescriptionSchema
200网格订单详情返回成功。grid_order_detail_rsp
400请求被拒绝,请求参数错误。None

Schemas

grid_order_detail_rsp

NameTypeRequiredDescription
order_idstringtrue网格订单 ID
symbolstringtrue标的代码,ticker.region 格式
stock_namestringtrue标的名称
statusstringtrue网格订单状态,例如:Performing / Suspended
grid_statusstringtrue网格详细运行状态
suspend_reasonstringtrue网格被暂停的原因,运行中时为空
sleeping_reasonstringtrue网格休眠的原因,活跃时为空
submitted_base_pricestringtrue提交时网格锚定的基准价
current_base_pricestringtrue触发后的当前基准价
upper_limit_pricestringtrue价格上界
lower_limit_pricestringtrue价格下界
trigger_price_typeint32true触发阈值的计价方式

枚举值:
1 - 价差(绝对值)
2 - 百分比
trigger_spread_upstringtrue向上触发价差(当 trigger_price_type 为 1 时)
trigger_spread_downstringtrue向下触发价差(当 trigger_price_type 为 1 时)
trigger_percent_upstringtrue向上触发百分比(当 trigger_price_type 为 2 时)
trigger_percent_downstringtrue向下触发百分比(当 trigger_price_type 为 2 时)
pullback_percentstringtrue回落百分比
pullback_spreadstringtrue回落价差
rebound_percentstringtrue反弹百分比
rebound_spreadstringtrue反弹价差
multiple_triggerbooleantrue单个网格档位是否可多次触发
time_in_forceint32true订单有效期

枚举值:
0 - 当日有效
1 - GTC
6 - GTD
trigger_quantitystringtrue每次触发的数量
trigger_sell_quantitystringtrue卖出方向累计触发数量
trigger_buy_quantitystringtrue买入方向累计触发数量
upper_limit_quantitystringtrue触及上界时处理的数量
lower_limit_quantitystringtrue触及下界时处理的数量
upper_limit_eventint32true触及上界时的动作

枚举值:
1 - 忽略
2 - 按最新价平仓
lower_limit_eventint32true触及下界时的动作

枚举值:
1 - 忽略
2 - 按最新价平仓
trigger_sell_depthint32true卖出方向盘口深度(-5 ~ 5)。0 = 使用 grid_order_type_up
trigger_buy_depthint32true买入方向盘口深度(-5 ~ 5)。0 = 使用 grid_order_type_down
created_atstringtrue创建时间,RFC3339 格式
updated_atstringtrue最后更新时间,RFC3339 格式
settlement_currencystringtrue结算货币,例如:HKD
expire_timestringtrue过期时间,RFC3339 格式(当 time_in_force 为 GTD 时)
gtdstringtrueGood-Til-Date,YYYY-MM-DD 格式
grid_sub_ordersobject[]false该网格已成交的子订单
∟ idstringtrue子订单 ID
∟ pricestringtrue订单价格
∟ order_typestringtrue订单类型
∟ quantitystringtrue订单数量
∟ executed_qtystringtrue已成交数量
∟ actionint32true买卖方向
∟ statusstringtrue子订单状态
∟ submitted_atstringtrue提交时间,RFC3339 格式
∟ rthint32true盘中交易时段标识(0 / 1 / 2)
sub_has_morebooleantrue是否还有更多子订单可分页
grid_order_historyobject[]false生命周期历史记录
∟ history_idstringtrue历史记录 ID,同时用作分页游标
∟ created_atstringtrue事件时间,RFC3339 格式
∟ statusstringtrue事件后的网格状态
∟ suspend_reasonstringtrue暂停原因(如适用)
∟ reasonstringtrue事件的可读描述
history_has_morebooleantrue是否可通过 history_id 分页获取更多历史记录
support_shortsellbooleantrue是否允许卖空
rthint32true盘中交易时段标识(0 / 1 / 2)
grid_order_type_upstringtruetrigger_sell_depth 为 0 时的卖出方向订单类型

枚举值:
GMO / GLO / GTG
grid_order_type_downstringtruetrigger_buy_depth 为 0 时的买入方向订单类型

枚举值:
GMO / GLO / GTG