PATCH Connection Settings
Change your NinjaTrader connection settings. Send only the parts you want to change. Arrays (autoReconnect, dataWatchdog, groups, relatedProducts, accounts) replace the saved array as a whole.
Elite
The Management API requires an Elite subscription. See Authentication.
Endpoint
PATCH https://app.crosstrade.io/v1/api/manage/nt8/connection-settings
Headers
| Name | Required | Value |
|---|---|---|
| Authorization | Yes | Bearer <your API token> |
| Content-Type | Yes | application/json |
| If-Match | No | ETag from a previous read |
Body parameters
| Name | Type | Required | Constraints | Description |
|---|---|---|---|---|
autoReconnect | array of {connection, enabled, timeoutSeconds} | No | At most 50, connection names unique, timeoutSeconds 10 to 3600 | Auto-reconnect per connection |
dataWatchdog | array of {connection, enabled, timeoutSeconds} | No | Same as above | Data watchdog per connection |
reconnectActions.restartStrategies | boolean | No | Restart strategies after a reconnect | |
reconnectActions.flatten.scope | none, all, strategy_accounts, specific | No | Needs add-on v1.13 or newer | Which accounts to flatten after a reconnect |
reconnectActions.flatten.accounts | array of account names | No | Required when scope is specific, empty otherwise. At most 200, unique | Accounts to flatten |
opposingPositionProtection.enabled | boolean | No | Turn the protection on or off | |
opposingPositionProtection.checkAllAccounts | boolean | No | Compare positions across all your accounts | |
opposingPositionProtection.relatedProducts | "default" or array of [SYMBOL, SYMBOL] | No | At most 200 pairs; two different symbols per pair | "default" saves the current CrossTrade default list |
opposingPositionProtection.groups | array of {name, accounts, relatedProducts?} | No | At most 50, names unique, 1 to 200 unique accounts each. A group's relatedProducts is an array of pairs or null (not "default") | Account groups checked together |
opposingPositionProtection.relatedProductsSource is read-only. You can send back the whole object from GET Connection Settings: a relatedProductsSource equal to the saved value is ignored.
Code examples
- Python
- cURL
import requests
resp = requests.patch(
"https://app.crosstrade.io/v1/api/manage/nt8/connection-settings",
headers={"Authorization": "Bearer YOUR_TOKEN"},
json={"reconnectActions": {"flatten": {"scope": "specific", "accounts": ["Sim101"]}}},
)
print(resp.json())
curl -X PATCH https://app.crosstrade.io/v1/api/manage/nt8/connection-settings \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"opposingPositionProtection": {"enabled": true, "relatedProducts": "default"}}'
Responses
- 200
- 422
- Other errors
{
"success": true,
"changed": true,
"data": {
"autoReconnect": [],
"dataWatchdog": [],
"reconnectActions": { "restartStrategies": false, "flatten": { "scope": "specific", "accounts": ["Sim101"] } },
"opposingPositionProtection": {
"enabled": false, "checkAllAccounts": false,
"relatedProducts": [["ES", "MES"]], "relatedProductsSource": "custom", "groups": []
}
},
"changedFields": ["reconnectActions.flatten.accounts", "reconnectActions.flatten.scope"],
"delivery": { "status": "queued", "target": "nt8_addon" },
"warnings": [],
"meta": { "requestId": "req_9f2c1a0b7d3e4f51", "etag": "\"c2:Tm90UmVhbEV0YWcwMg\"" }
}
{
"success": false,
"error": "validation_failed",
"detail": "One or more fields are invalid.",
"fields": [ { "path": "reconnectActions.flatten.accounts", "code": "required_for_specific_scope" } ],
"meta": { "requestId": "req_0c6a1d2e3f405162" }
}
| Status | error | When |
|---|---|---|
| 400 | invalid_json | The body is not valid JSON |
| 401 | unauthorized | Missing or invalid token |
| 403 | elite_required, not_available | See Authentication |
| 404 | account_not_found | An account you added is not one of your NinjaTrader accounts. fields says where |
| 409 | addon_disconnected, addon_version_unsupported | Adding an account or connection name needs the add-on connected (v1.12 or newer to add a connection name) |
| 409 | concurrent_modification | Another change to these settings is in progress |
| 412 | precondition_failed | If-Match did not match |
| 413 | body_too_large | The body is larger than 64 KB |
| 415 | unsupported_content_type | The body is not application/json |
| 422 | field_read_only | The body contains a relatedProductsSource different from the saved one |
| 422 | validation_failed | A field is invalid, or a connection you added is not one of your NinjaTrader connections (unknown_connection) |
| 429 | rate_limited, too_many_concurrent_requests | See Rate limits |
| 503 | management_read_only, management_busy, storage_unavailable | See Errors |
When it takes effect
The settings are sent to the add-on right after the save (delivery.status: "queued"). If the add-on is offline ("pending_connection"), it receives them when it next connects. The add-on needs v1.12 or newer to receive them.
Notes
- If your add-on is connected but older than v1.13 and
reconnectActions.flatten.scopeis notnone, the response carries anaddon_version_unsupportedwarning: older add-ons ignore the flatten setting. - A connection or account name you add is checked against your NinjaTrader, so adding one needs the add-on connected. Names already saved are not re-checked, so other changes work while the add-on is offline.
flattenmerges like any object, so the savedaccountsstay when you change onlyscope. To move away fromspecific, send"accounts": []with the new scope, or the request fails withonly_for_specific_scope.