Longbridge Developers
立即开始

重启网格订单

重启已暂停的网格订单。网格会从保存的配置恢复,并重新开始触发订单。只有此前通过暂停网格订单暂停的网格才能被重启。

>_ CLI
# 按 ID 重启已暂停的网格订单
longbridge grid restart 764609681686573056

Request

HTTP MethodPOST
HTTP URL/v1/gridtrading/restart

Parameters

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

NameTypeRequiredDescription
order_idstringYES网格订单 ID,例如:764609681686573056

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)

# Grid REST calls go through the standalone GridContext
ctx = GridContext(config)

resp = ctx.restart("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.restart('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)) {
            ctx.restart("764609681686573056").get();
        }
    }
}
use std::sync::Arc;
use longbridge::{Config, grid::GridContext, 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);

    ctx.restart("764609681686573056").await?;
    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);

    ctx.restart("764609681686573056", [](auto res) {
        if (!res) {
            std::cout << "failed" << std::endl;
            return;
        }
        std::cout << "restarted" << 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": {}
}

Response Status

StatusDescriptionSchema
200网格订单重启成功。None
400请求被拒绝,请求参数错误。None