> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://partner.tradovate.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://partner.tradovate.com/_mcp/server.

# Dry Run

POST https://demo.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.tradovate.com/api/rest-api-endpoints/orders/dry-run

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, 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, InvalidContract, InvalidPrice, KeyInformationDocumentRequired, LiquidationOnly, LiquidationOnlyBeforeExpiration, MaxOrderQtyIsNotSpecified, MaxOrderQtyLimitReached, MaxPosLimitMisconfigured, MaxPosLimitReached, MaxTotalPosLimitReached, MultipleAccountPlanRequired, NoQuote, NotEnoughLiquidity, OtherExecutionRelated, ParentRejected, RiskCheckTimeout, SSFRiskDisclosureAcknowledgmentRequired, SessionClosed, Success, TooLate, TradingLocked, TrailingStopNonOrderQtyModify, Unauthorized, UnknownReason, Unsupported
  - Allowed values: `AccountClosed`, `AdvancedTrailingStopUnsupported`, `AnotherCommandPending`, `BackMonthProhibited`, `ExecutionProviderNotConfigured`, `ExecutionProviderUnavailable`, `InvalidContract`, `InvalidPrice`, `KeyInformationDocumentRequired`, `LiquidationOnly`, `LiquidationOnlyBeforeExpiration`, `MaxOrderQtyIsNotSpecified`, `MaxOrderQtyLimitReached`, `MaxPosLimitMisconfigured`, `MaxPosLimitReached`, `MaxTotalPosLimitReached`, `MultipleAccountPlanRequired`, `NoQuote`, `NotEnoughLiquidity`, `OtherExecutionRelated`, `ParentRejected`, `RiskCheckTimeout`, `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, QTS, Stop, StopLimit, TrailingStop, TrailingStopLimit
  - Allowed values: `Limit`, `LimitIfTouched`, `MIT`, `Market`, `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": 123456,
  "orders": [
    {
      "contractId": 78910,
      "action": "Buy",
      "orderQty": 5,
      "orderType": "Limit"
    }
  ]
}
```

**Response**

```json
{
  "errorText": "",
  "rejectReason": "AccountClosed",
  "comment": "The account is currently closed and cannot accept new orders.",
  "details": {
    "beforeInitialMarginReq": 15000.75,
    "beforeInitialFullMarginReq": 15200,
    "beforeOpenCollateralReq": 5000.5,
    "beforeNetPos": 10,
    "isExitOrder": false,
    "initialMarginReq": 15500.25,
    "initialFullMarginReq": 15700,
    "openCollateralReq": 5200,
    "totalCash": 25000,
    "futuresOpenPnL": 1200.5,
    "optionsOpenPnL": -300.75,
    "riskCredit": 1000,
    "netLiqValue": 27000,
    "futureCommAndFees": 15,
    "totalCashRequired": 16000,
    "excess": 11000,
    "hypoLongPos": 8,
    "hypoShortPos": 2
  },
  "fees": {
    "clearingFee": 2.5,
    "clearingCurrencyId": 840,
    "exchangeFee": 1.75,
    "exchangeCurrencyId": 840,
    "nfaFee": 0.5,
    "nfaCurrencyId": 840,
    "brokerageFee": 3,
    "brokerageCurrencyId": 840,
    "ipFee": 0.25,
    "ipCurrencyId": 840,
    "commission": 5,
    "commissionCurrencyId": 840,
    "orderRoutingFee": 0.75,
    "orderRoutingCurrencyId": 840,
    "commissionNotionalValueBPS": 0.15,
    "exchangeFeeNotionalValueBPS": 0.1
  }
}
```

**SDK Code**

```python
import requests

url = "https://demo.tradovateapi.com/v1/order/dryrun"

payload = {
    "accountId": 123456,
    "orders": [
        {
            "contractId": 78910,
            "action": "Buy",
            "orderQty": 5,
            "orderType": "Limit"
        }
    ]
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://demo.tradovateapi.com/v1/order/dryrun';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"accountId":123456,"orders":[{"contractId":78910,"action":"Buy","orderQty":5,"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://demo.tradovateapi.com/v1/order/dryrun"

	payload := strings.NewReader("{\n  \"accountId\": 123456,\n  \"orders\": [\n    {\n      \"contractId\": 78910,\n      \"action\": \"Buy\",\n      \"orderQty\": 5,\n      \"orderType\": \"Limit\"\n    }\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	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://demo.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 <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"accountId\": 123456,\n  \"orders\": [\n    {\n      \"contractId\": 78910,\n      \"action\": \"Buy\",\n      \"orderQty\": 5,\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<String> response = Unirest.post("https://demo.tradovateapi.com/v1/order/dryrun")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"accountId\": 123456,\n  \"orders\": [\n    {\n      \"contractId\": 78910,\n      \"action\": \"Buy\",\n      \"orderQty\": 5,\n      \"orderType\": \"Limit\"\n    }\n  ]\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://demo.tradovateapi.com/v1/order/dryrun', [
  'body' => '{
  "accountId": 123456,
  "orders": [
    {
      "contractId": 78910,
      "action": "Buy",
      "orderQty": 5,
      "orderType": "Limit"
    }
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://demo.tradovateapi.com/v1/order/dryrun");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"accountId\": 123456,\n  \"orders\": [\n    {\n      \"contractId\": 78910,\n      \"action\": \"Buy\",\n      \"orderQty\": 5,\n      \"orderType\": \"Limit\"\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "accountId": 123456,
  "orders": [
    [
      "contractId": 78910,
      "action": "Buy",
      "orderQty": 5,
      "orderType": "Limit"
    ]
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://demo.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()
```