> 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/dual-investment/get-order-history/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://okx-demo.ferndocs.com/_mcp/server. # Get order history GET https://www.okx.com/api/v5/finance/sfp/dcd/order-history Retrieve the history of Dual Investment orders, filterable by order, product, underlying, state, and time range. Reference: https://okx-demo.ferndocs.com/api/api-reference/dual-investment/get-order-history ## 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 - `ordId` (string, optional) — Order ID. - `productId` (string, optional) — Product ID. - `uly` (string, optional) — Underlying, e.g. BTC-USDT. - `state` (enum, optional) — Order state. - Allowed values: `initial`, `live`, `pending_settle`, `settled`, `pending_redeem`, `redeemed`, `rejected` - `beginId` (string, optional) — Pagination of data to return records newer than the requested order ID. - `endId` (string, optional) — Pagination of data to return records earlier than the requested order ID. - `begin` (string, optional) — Filter with a begin timestamp (based on cTime), Unix timestamp in milliseconds. - `end` (string, optional) — Filter with an end timestamp (based on cTime), Unix timestamp in milliseconds. - `limit` (string, optional) — Number of results per request. The maximum and default are both 100. ## 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 ApiV5FinanceSfpDcdOrderHistoryGetResponsesContentApplicationJsonSchemaDataItems, optional) ## Types ### ApiV5FinanceSfpDcdOrderHistoryGetResponsesContentApplicationJsonSchemaDataItems - `ordId` (string, optional) — Order ID. - `quoteId` (string, optional) — Quote ID used to place the order. - `state` (string, optional) — Order state. - `productId` (string, optional) — Product ID. - `baseCcy` (string, optional) — Base currency, e.g. BTC in BTC-USDT. - `quoteCcy` (string, optional) — Quote currency, e.g. USDT in BTC-USDT. - `uly` (string, optional) — Underlying, e.g. BTC-USDT. - `strike` (string, optional) — Strike price of the product. - `notionalSz` (string, optional) — Subscription (notional) amount. - `notionalCcy` (string, optional) — Currency of the subscription amount. - `absYield` (string, optional) — Absolute yield for the product term. - `annualizedYield` (string, optional) — Annualized yield of the product. - `yieldSz` (string, optional) — Yield amount earned. - `yieldCcy` (string, optional) — Currency in which the yield is denominated. - `settleSz` (string, optional) — Settlement amount at expiry. - `settleCcy` (string, optional) — Currency in which the order is settled. - `settlePx` (string, optional) — Settlement price of the underlying at expiry. - `settleTime` (string, optional) — Settlement time, Unix timestamp in milliseconds. - `expTime` (string, optional) — Expiry time, Unix timestamp in milliseconds. - `redeemStartTime` (string, optional) — Redemption window start time, Unix timestamp in milliseconds. - `redeemEndTime` (string, optional) — Redemption window end time, Unix timestamp in milliseconds. - `cTime` (string, optional) — Order creation time, Unix timestamp in milliseconds. - `uTime` (string, optional) — Order last update time, Unix timestamp in milliseconds. ## Examples **Response** ```json { "code": "0", "msg": "", "data": [ { "ordId": "987654321", "quoteId": "quoterbpDCD-QUOTE17732116652401234", "state": "settled", "productId": "BTC-USDT-260327-77000-C", "baseCcy": "BTC", "quoteCcy": "USDT", "uly": "BTC-USD", "strike": "77000", "notionalSz": "1.5", "notionalCcy": "BTC", "absYield": "0.00806038", "annualizedYield": "0.1834", "yieldSz": "0.01209057", "yieldCcy": "BTC", "settleSz": "1.51209057", "settleCcy": "BTC", "settlePx": "76500", "settleTime": "1774598400000", "expTime": "1774598400000", "redeemStartTime": "1774598400000", "cTime": "1773212400000", "uTime": "1773212400000", "redeemEndime": "1774598400000" } ] } ``` **SDK Code** ```python dualInvestment_getOrderHistory_example import requests url = "https://www.okx.com/api/v5/finance/sfp/dcd/order-history" headers = {"OK-ACCESS-KEY": ""} response = requests.get(url, headers=headers) print(response.json()) ``` ```javascript dualInvestment_getOrderHistory_example const url = 'https://www.okx.com/api/v5/finance/sfp/dcd/order-history'; 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 dualInvestment_getOrderHistory_example package main import ( "fmt" "net/http" "io" ) func main() { url := "https://www.okx.com/api/v5/finance/sfp/dcd/order-history" 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 dualInvestment_getOrderHistory_example require 'uri' require 'net/http' url = URI("https://www.okx.com/api/v5/finance/sfp/dcd/order-history") 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 dualInvestment_getOrderHistory_example import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://www.okx.com/api/v5/finance/sfp/dcd/order-history") .header("OK-ACCESS-KEY", "") .asString(); ``` ```php dualInvestment_getOrderHistory_example request('GET', 'https://www.okx.com/api/v5/finance/sfp/dcd/order-history', [ 'headers' => [ 'OK-ACCESS-KEY' => '', ], ]); echo $response->getBody(); ``` ```csharp dualInvestment_getOrderHistory_example using RestSharp; var client = new RestClient("https://www.okx.com/api/v5/finance/sfp/dcd/order-history"); var request = new RestRequest(Method.GET); request.AddHeader("OK-ACCESS-KEY", ""); IRestResponse response = client.Execute(request); ``` ```swift dualInvestment_getOrderHistory_example import Foundation let headers = ["OK-ACCESS-KEY": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://www.okx.com/api/v5/finance/sfp/dcd/order-history")! 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() ```