Longbridge Developers
立即开始

网格触发历史

查询单个网格订单的分页触发历史 —— 网格每次触发时所发出的具体订单。

>_ CLI
# 查看网格订单的触发历史
longbridge grid triggers 764609681686573056

Request

HTTP MethodGET
HTTP URL/v1/gridtrading/trigger_history_list

Parameters

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

NameTypeRequiredDescription
grid_order_idstringYES网格订单 ID,例如:764609681686573056
pageint32NO页码,从 1 开始
limitint32NO分页大小

Warning

该接口使用 grid_order_id,而不是其他网格接口所用的 order_id。此处传入 order_id 将无法定位到网格订单。

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.trigger_history("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.triggerHistory({ gridOrderId: '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)) {
            GridTriggerHistory resp = ctx.triggerHistory(new GetGridTriggerHistoryOptions("764609681686573056")).get();
            System.out.println(resp);
        }
    }
}
use std::sync::Arc;
use longbridge::{
    Config,
    grid::{GridContext, GetGridTriggerHistoryOptions},
    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.trigger_history(GetGridTriggerHistoryOptions::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);

    GetGridTriggerHistoryOptions opts{ "764609681686573056" };
    ctx.trigger_history(opts, [](auto res) {
        if (!res) {
            std::cout << "failed" << std::endl;
            return;
        }
        std::cout << "trigger orders: " << res->trigger_orders.size() << 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": {
    "trigger_orders": [
      {
        "id": "764610000000000001",
        "status": "Filled",
        "name": "TENCENT",
        "symbol": "700.HK",
        "price": "294",
        "quantity": "100",
        "executed_price": "294",
        "executed_qty": "100",
        "submitted_at": "2024-08-12T10:35:00+08:00",
        "action": 1,
        "order_type": "GMO",
        "trigger_price": "294",
        "msg": "",
        "currency": "HKD",
        "last_done": "294",
        "updated_at": "2024-08-12T10:35:05+08:00",
        "time_in_force": 1,
        "gtd": "",
        "trigger_at": "2024-08-12T10:35:00+08:00",
        "trigger_status": 1
      }
    ],
    "has_more": false
  }
}

Response Status

StatusDescriptionSchema
200触发历史返回成功。grid_trigger_history_rsp
400请求被拒绝,请求参数错误。None

Schemas

grid_trigger_history_rsp

NameTypeRequiredDescription
trigger_ordersobject[]false触发订单
∟ idstringtrue触发订单 ID
∟ statusstringtrue订单状态
∟ namestringtrue股票名称
∟ symbolstringtrue股票代码,ticker.region 格式
∟ pricestringtrue订单价格
∟ quantitystringtrue订单数量
∟ executed_pricestringtrue成交价格
∟ executed_qtystringtrue已成交数量
∟ submitted_atstringtrue提交时间,RFC3339 格式
∟ actionint32true买卖方向
∟ order_typestringtrue订单类型
∟ trigger_pricestringtrue触发该订单的价格
∟ msgstringtrue附加消息
∟ currencystringtrue订单货币
∟ last_donestringtrue触发时的最新成交价
∟ updated_atstringtrue最后更新时间,RFC3339 格式
∟ time_in_forceint32true订单有效期

可选值:
0 - 当日有效
1 - GTC
6 - GTD
∟ gtdstringtrue到期日,YYYY-MM-DD 格式
∟ trigger_atstringtrue触发时间,RFC3339 格式
∟ trigger_statusint32true触发状态
has_morebooleanfalse是否还有更多分页