> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://okx-demo.ferndocs.com/api/api-reference/grid-trading/get-grid-order-details/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://okx-demo.ferndocs.com/_mcp/server. # Get grid order details GET https://www.okx.com/api/v5/tradingBot/grid/orders-algo-details Retrieve the full details of a single grid algo order. Reference: https://okx-demo.ferndocs.com/api/api-reference/grid-trading/get-grid-order-details ## Authentication - `OK-ACCESS-KEY` header (required) — Your API key. - `OK-ACCESS-SIGN` header (required) — Base64-encoded HMAC-SHA256 signature of the prehash string. - `OK-ACCESS-TIMESTAMP` header (required) — ISO 8601 UTC timestamp, e.g. 2020-12-08T09:08:57.715Z. - `OK-ACCESS-PASSPHRASE` header (required) — The passphrase you set when creating the API key. ## Request ### Query parameters - `algoOrdType` (enum, required) — Algo order type `grid`: Spot grid `contract_grid`: Contract grid - Allowed values: `grid`, `contract_grid`, `moon_grid` - `algoId` (string, required) — Algo ID ## Response ### 200 Successful response - `code` (string, optional) — Result code. `0` means success; any other value is an error code. - `msg` (string, optional) — Error message. Empty on success. - `data` (list of ApiV5TradingBotGridOrdersAlgoDetailsGetResponsesContentApplicationJsonSchemaDataItems, optional) ## Types ### ApiV5TradingBotGridOrdersAlgoDetailsGetResponsesContentApplicationJsonSchemaDataItems - `algoId` (string, optional) — Algo ID - `algoClOrdId` (string, optional) — Client-supplied Algo ID - `instType` (string, optional) — Instrument type - `instId` (string, optional) — Instrument ID - `cTime` (string, optional) — Algo order created time, Unix timestamp format in milliseconds, e.g. `1597026383085` - `uTime` (string, optional) — Algo order updated time, Unix timestamp format in milliseconds, e.g. `1597026383085` - `algoOrdType` (string, optional) — Algo order type `grid`: Spot grid `contract_grid`: Contract grid - `state` (string, optional) — Algo order state `starting` `running` `stopping` `no_close_position`: stopped algo order but have not closed position yet `stopped` - `maxPx` (string, optional) — Upper price of price range - `minPx` (string, optional) — Lower price of price range - `gridNum` (string, optional) — Grid quantity - `runType` (string, optional) — Grid type `1`: Arithmetic, `2`: Geometric - `direction` (string, optional) — Contract grid type `long`,`short`,`neutral` Only applicable to `contract grid` - `lever` (string, optional) — Leverage Only applicable to `contract grid` - `investment` (string, optional) — Accumulated investment amount Spot grid investment amount calculated on quote currency - `totalPnl` (string, optional) — Total P&L - `pnlRatio` (string, optional) — P&L ratio - `floatProfit` (string, optional) — Variable P&L - `gridProfit` (string, optional) — Grid profit - `annualizedRate` (string, optional) — Grid annualized rate - `arbitrageNum` (string, optional) — The number of arbitrages executed - `totalAnnualizedRate` (string, optional) — Total annualized rate - `tpTriggerPx` (string, optional) — Take-profit trigger price - `slTriggerPx` (string, optional) — Stop-loss trigger price - `curPrice` (string, optional) — Current price of the instrument. - `profit` (string, optional) — Current available profit based on quote currency Only applicable to `Spot grid` ## Examples **Response** ```json { "code": "0", "msg": "", "data": [ { "algoId": "448965992920907776", "algoClOrdId": "", "instType": "SPOT", "instId": "BTC-USDT", "cTime": "1681181054927", "uTime": "1681181186496", "algoOrdType": "grid", "state": "stopped", "maxPx": "5000", "minPx": "400", "gridNum": "10", "runType": "1", "direction": "", "lever": "0", "investment": "25", "totalPnl": "0", "pnlRatio": "0", "floatProfit": "0", "gridProfit": "0", "annualizedRate": "0", "arbitrageNum": "0", "totalAnnualizedRate": "0", "tpTriggerPx": "0", "slTriggerPx": "0", "profit": "0.00000000", "activeOrdNum": "0", "actualLever": "", "availEq": "", "basePos": false, "baseSz": "0", "cancelType": "1", "copyType": "0", "curBaseSz": "0", "curQuoteSz": "0", "eq": "", "fee": "", "feeCcy": "", "fundingFee": "", "instFamily": "", "liqPx": "", "ordFrozen": "", "perMaxProfitRate": "1.14570215", "perMinProfitRate": "0.0991200440528634356837", "profitSharingRatio": "", "quoteSz": "25", "rebateTrans": [ { "rebate": "0", "rebateCcy": "BTC" }, { "rebate": "0", "rebateCcy": "USDT" } ], "runPx": "30089.7", "singleAmt": "0.00101214", "slRatio": "", "stopResult": "0", "stopType": "1", "sz": "", "tag": "", "tpRatio": "", "tradeNum": "0", "tradeQuoteCcy": "USDT", "triggerParams": [ { "delaySeconds": "0", "triggerAction": "start", "triggerStrategy": "instant", "triggerTime": "", "triggerType": "auto" }, { "delaySeconds": "0", "stopType": "1", "triggerAction": "stop", "triggerStrategy": "instant", "triggerTime": "1681181186484", "triggerType": "manual" } ], "uly": "" } ] } ``` **SDK Code** ```python gridTrading_getGridOrderDetails_example import requests url = "https://www.okx.com/api/v5/tradingBot/grid/orders-algo-details" querystring = {"algoId":"448965992920907776","algoOrdType":"grid"} headers = {"OK-ACCESS-KEY": ""} response = requests.get(url, headers=headers, params=querystring) print(response.json()) ``` ```javascript gridTrading_getGridOrderDetails_example const url = 'https://www.okx.com/api/v5/tradingBot/grid/orders-algo-details?algoId=448965992920907776&algoOrdType=grid'; const options = {method: 'GET', headers: {'OK-ACCESS-KEY': ''}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go gridTrading_getGridOrderDetails_example package main import ( "fmt" "net/http" "io" ) func main() { url := "https://www.okx.com/api/v5/tradingBot/grid/orders-algo-details?algoId=448965992920907776&algoOrdType=grid" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("OK-ACCESS-KEY", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby gridTrading_getGridOrderDetails_example require 'uri' require 'net/http' url = URI("https://www.okx.com/api/v5/tradingBot/grid/orders-algo-details?algoId=448965992920907776&algoOrdType=grid") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["OK-ACCESS-KEY"] = '' response = http.request(request) puts response.read_body ``` ```java gridTrading_getGridOrderDetails_example import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://www.okx.com/api/v5/tradingBot/grid/orders-algo-details?algoId=448965992920907776&algoOrdType=grid") .header("OK-ACCESS-KEY", "") .asString(); ``` ```php gridTrading_getGridOrderDetails_example request('GET', 'https://www.okx.com/api/v5/tradingBot/grid/orders-algo-details?algoId=448965992920907776&algoOrdType=grid', [ 'headers' => [ 'OK-ACCESS-KEY' => '', ], ]); echo $response->getBody(); ``` ```csharp gridTrading_getGridOrderDetails_example using RestSharp; var client = new RestClient("https://www.okx.com/api/v5/tradingBot/grid/orders-algo-details?algoId=448965992920907776&algoOrdType=grid"); var request = new RestRequest(Method.GET); request.AddHeader("OK-ACCESS-KEY", ""); IRestResponse response = client.Execute(request); ``` ```swift gridTrading_getGridOrderDetails_example import Foundation let headers = ["OK-ACCESS-KEY": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://www.okx.com/api/v5/tradingBot/grid/orders-algo-details?algoId=448965992920907776&algoOrdType=grid")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```