> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://partner.ninjatrader.com/eval/api/rest-api-endpoints/orders/dry-run/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://partner.ninjatrader.com/_mcp/server. # Dry Run POST https://live.tradovateapi.com/v1/order/dryrun Content-Type: application/json ### Validate an order without placing it. **Available to:** All authenticated users **Environments:** Demo, Live **[Rate Limit](/overview/core-concepts/rate-limits):** 500 requests per hour, 1-second back-off, counts all requests Submit one or more orders (up to four) for validation against the account's pre-trade risk settings without actually placing them. The response includes a `rejectReason` if the batch would be rejected, so you can surface issues to the trader before they submit a real order. Use this to check whether an order would pass margin requirements, position limits, and other risk checks before committing to a live trade. The optional `extraPreTradeRisk` field lets you apply additional risk constraints beyond the account's default settings during validation. **Common Failure Scenarios** - The account does not exist (returns `HTTP 404`) - The caller doesn't have access to the account (returns `HTTP 401`) - The request contains more than four orders - Invalid `contractId` in one or more orders Reference: https://partner.ninjatrader.com/eval/api/rest-api-endpoints/orders/dry-run ## Authentication - `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer `, where token is your auth token. ## Request ### Body (application/json) This endpoint expects a DryRun. - `accountId` (long, required) - `orders` (list of DryRunOrder, required) - `extraPreTradeRisk` (ExtraPreTradeRisk, optional) ## Response ### 200 DryRunResponse - `errorText` (string, optional) — Non-empty if the request failed - `rejectReason` (enum, optional) — AccountClosed, AdvancedTrailingStopUnsupported, AnotherCommandPending, BackMonthProhibited, ExecutionProviderNotConfigured, ExecutionProviderUnavailable, HomeStateRestricted, InvalidContract, InvalidPrice, KeyInformationDocumentRequired, LiquidationOnly, LiquidationOnlyBeforeExpiration, MaxOrderQtyIsNotSpecified, MaxOrderQtyLimitReached, MaxPosLimitMisconfigured, MaxPosLimitReached, MaxTotalPosLimitReached, MinTradeDurationNotElapsed, MultipleAccountPlanRequired, NoQuote, NotEnoughLiquidity, OtherExecutionRelated, ParentRejected, RiskCheckTimeout, SSFNFAComplianceRequired, SSFNFAComplianceRequiredJointOnly, SSFRiskDisclosureAcknowledgmentRequired, SessionClosed, Success, TooLate, TradingLocked, TrailingStopNonOrderQtyModify, Unauthorized, UnknownReason, Unsupported - Allowed values: `AccountClosed`, `AdvancedTrailingStopUnsupported`, `AnotherCommandPending`, `BackMonthProhibited`, `ExecutionProviderNotConfigured`, `ExecutionProviderUnavailable`, `HomeStateRestricted`, `InvalidContract`, `InvalidPrice`, `KeyInformationDocumentRequired`, `LiquidationOnly`, `LiquidationOnlyBeforeExpiration`, `MaxOrderQtyIsNotSpecified`, `MaxOrderQtyLimitReached`, `MaxPosLimitMisconfigured`, `MaxPosLimitReached`, `MaxTotalPosLimitReached`, `MinTradeDurationNotElapsed`, `MultipleAccountPlanRequired`, `NoQuote`, `NotEnoughLiquidity`, `OtherExecutionRelated`, `ParentRejected`, `RiskCheckTimeout`, `SSFNFAComplianceRequired`, `SSFNFAComplianceRequiredJointOnly`, `SSFRiskDisclosureAcknowledgmentRequired`, `SessionClosed`, `Success`, `TooLate`, `TradingLocked`, `TrailingStopNonOrderQtyModify`, `Unauthorized`, `UnknownReason`, `Unsupported` - `comment` (string, optional) - `details` (RiskEvaluationDetails, optional) - `fees` (EstimatedFillFee, optional) ## Types ### DryRunOrder - `contractId` (long, required) - `action` (enum, required) — Buy, Sell - Allowed values: `Buy`, `Sell` - `orderQty` (integer, required) - `orderType` (enum, required) — Limit, LimitIfTouched, MIT, Market, MarketLimit, MarketStopWithProtection, MarketWithProtection, QTS, Stop, StopLimit, TrailingStop, TrailingStopLimit - Allowed values: `Limit`, `LimitIfTouched`, `MIT`, `Market`, `MarketLimit`, `MarketStopWithProtection`, `MarketWithProtection`, `QTS`, `Stop`, `StopLimit`, `TrailingStop`, `TrailingStopLimit` - `price` (double, optional) - `stopPrice` (double, optional) ### ExtraPreTradeRisk - `products` (ExtraPreTradeRiskProducts, required) - `contracts` (ExtraPreTradeRiskContracts, required) - `maxExposedTotal` (integer, optional) - `maxTradedVolumeTotal` (integer, optional) ### RiskEvaluationDetails - `beforeInitialMarginReq` (double, required) - `beforeInitialFullMarginReq` (double, required) - `beforeOpenCollateralReq` (double, required) - `beforeNetPos` (integer, required) - `isExitOrder` (boolean, required) - `initialMarginReq` (double, required) - `initialFullMarginReq` (double, required) - `openCollateralReq` (double, required) - `totalCash` (double, required) - `futuresOpenPnL` (double, required) - `optionsOpenPnL` (double, required) - `riskCredit` (double, required) - `netLiqValue` (double, required) - `futureCommAndFees` (double, required) - `totalCashRequired` (double, required) - `excess` (double, required) - `hypoLongPos` (integer, required) - `hypoShortPos` (integer, required) ### EstimatedFillFee - `clearingFee` (double, optional) - `clearingCurrencyId` (long, optional) - `exchangeFee` (double, optional) - `exchangeCurrencyId` (long, optional) - `nfaFee` (double, optional) - `nfaCurrencyId` (long, optional) - `brokerageFee` (double, optional) - `brokerageCurrencyId` (long, optional) - `ipFee` (double, optional) — IP/TT Fee - `ipCurrencyId` (long, optional) - `commission` (double, optional) - `commissionCurrencyId` (long, optional) - `orderRoutingFee` (double, optional) - `orderRoutingCurrencyId` (long, optional) - `commissionNotionalValueBPS` (double, optional) - `exchangeFeeNotionalValueBPS` (double, optional) ### ExtraPreTradeRiskProducts ### ExtraPreTradeRiskContracts ## Examples **Request** ```json { "accountId": 1, "orders": [ { "contractId": 1, "action": "Buy", "orderQty": 1, "orderType": "Limit" } ] } ``` **Response** ```json { "errorText": "string", "rejectReason": "AccountClosed", "comment": "string", "details": { "beforeInitialMarginReq": 1.1, "beforeInitialFullMarginReq": 1.1, "beforeOpenCollateralReq": 1.1, "beforeNetPos": 1, "isExitOrder": true, "initialMarginReq": 1.1, "initialFullMarginReq": 1.1, "openCollateralReq": 1.1, "totalCash": 1.1, "futuresOpenPnL": 1.1, "optionsOpenPnL": 1.1, "riskCredit": 1.1, "netLiqValue": 1.1, "futureCommAndFees": 1.1, "totalCashRequired": 1.1, "excess": 1.1, "hypoLongPos": 1, "hypoShortPos": 1 }, "fees": { "clearingFee": 1.1, "clearingCurrencyId": 1, "exchangeFee": 1.1, "exchangeCurrencyId": 1, "nfaFee": 1.1, "nfaCurrencyId": 1, "brokerageFee": 1.1, "brokerageCurrencyId": 1, "ipFee": 1.1, "ipCurrencyId": 1, "commission": 1.1, "commissionCurrencyId": 1, "orderRoutingFee": 1.1, "orderRoutingCurrencyId": 1, "commissionNotionalValueBPS": 1.1, "exchangeFeeNotionalValueBPS": 1.1 } } ``` **SDK Code** ```python import requests url = "https://live.tradovateapi.com/v1/order/dryrun" payload = { "accountId": 1, "orders": [ { "contractId": 1, "action": "Buy", "orderQty": 1, "orderType": "Limit" } ] } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://live.tradovateapi.com/v1/order/dryrun'; const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"accountId":1,"orders":[{"contractId":1,"action":"Buy","orderQty":1,"orderType":"Limit"}]}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://live.tradovateapi.com/v1/order/dryrun" payload := strings.NewReader("{\n \"accountId\": 1,\n \"orders\": [\n {\n \"contractId\": 1,\n \"action\": \"Buy\",\n \"orderQty\": 1,\n \"orderType\": \"Limit\"\n }\n ]\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://live.tradovateapi.com/v1/order/dryrun") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"accountId\": 1,\n \"orders\": [\n {\n \"contractId\": 1,\n \"action\": \"Buy\",\n \"orderQty\": 1,\n \"orderType\": \"Limit\"\n }\n ]\n}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://live.tradovateapi.com/v1/order/dryrun") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"accountId\": 1,\n \"orders\": [\n {\n \"contractId\": 1,\n \"action\": \"Buy\",\n \"orderQty\": 1,\n \"orderType\": \"Limit\"\n }\n ]\n}") .asString(); ``` ```php request('POST', 'https://live.tradovateapi.com/v1/order/dryrun', [ 'body' => '{ "accountId": 1, "orders": [ { "contractId": 1, "action": "Buy", "orderQty": 1, "orderType": "Limit" } ] }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://live.tradovateapi.com/v1/order/dryrun"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"accountId\": 1,\n \"orders\": [\n {\n \"contractId\": 1,\n \"action\": \"Buy\",\n \"orderQty\": 1,\n \"orderType\": \"Limit\"\n }\n ]\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = [ "accountId": 1, "orders": [ [ "contractId": 1, "action": "Buy", "orderQty": 1, "orderType": "Limit" ] ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://live.tradovateapi.com/v1/order/dryrun")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data 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() ```