Skip to main content

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​

NameRequiredValue
AuthorizationYesBearer <your API token>
Content-TypeYesapplication/json
If-MatchNoETag from a previous read

Body parameters​

NameTypeRequiredConstraintsDescription
autoReconnectarray of {connection, enabled, timeoutSeconds}NoAt most 50, connection names unique, timeoutSeconds 10 to 3600Auto-reconnect per connection
dataWatchdogarray of {connection, enabled, timeoutSeconds}NoSame as aboveData watchdog per connection
reconnectActions.restartStrategiesbooleanNoRestart strategies after a reconnect
reconnectActions.flatten.scopenone, all, strategy_accounts, specificNoNeeds add-on v1.13 or newerWhich accounts to flatten after a reconnect
reconnectActions.flatten.accountsarray of account namesNoRequired when scope is specific, empty otherwise. At most 200, uniqueAccounts to flatten
opposingPositionProtection.enabledbooleanNoTurn the protection on or off
opposingPositionProtection.checkAllAccountsbooleanNoCompare positions across all your accounts
opposingPositionProtection.relatedProducts"default" or array of [SYMBOL, SYMBOL]NoAt most 200 pairs; two different symbols per pair"default" saves the current CrossTrade default list
opposingPositionProtection.groupsarray of {name, accounts, relatedProducts?}NoAt 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​

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())

Responses​

{
"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\"" }
}

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.scope is not none, the response carries an addon_version_unsupported warning: 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.
  • flatten merges like any object, so the saved accounts stay when you change only scope. To move away from specific, send "accounts": [] with the new scope, or the request fails with only_for_specific_scope.