POST Enable Strategy
- NT8
- Tradovate
Resume or recreate a previously-disabled strategy NT8
Enables a NinjaScript strategy previously handled by DisableStrategy. A chart-attached strategy resumes in place, and NT8 routes OnBarUpdate calls back to the existing strategy from the current bar. An account-hosted strategy was terminated and removed when disabled, so enable recreates it from the saved deployment and returns a new strategyId.
Idempotent: enabling an already-enabled strategy is a no-op that returns wasEnabled=true and success=true. If a terminated strategy has no saved deployment to recreate, use StartStrategy to instantiate a fresh copy.
Endpoint
POST /v1/api/accounts/{account}/strategies/{strategyId}/enable
Headers
| Name | Value |
|---|---|
| Content-Type | application/json |
| Authorization | Bearer <token> |
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
account | string | Required | Name of the NT8 account that owns the strategy. |
strategyId | string | Required | ID of the strategy as returned by ListStrategies or ListAllStrategies. |
Code examples
- Python
- JavaScript
- cURL
import requests
token = 'my-secret-token'
url = "https://dev.crosstrade.io/v1/api/accounts/Sim101/strategies/370780512/enable"
headers = {
"Authorization": f"Bearer {token}",
"Content-Type": "application/json"
}
try:
response = requests.post(url, headers=headers, json={})
print(f"Response Code: {response.status_code}, Response Text: {response.text}")
except Exception as e:
print(f"An error occurred: {e}")
const token = 'my-secret-token';
const url = "https://dev.crosstrade.io/v1/api/accounts/Sim101/strategies/370780512/enable";
fetch(url, {
method: "POST",
headers: {
"Authorization": `Bearer ${token}`,
"Content-Type": "application/json"
},
body: JSON.stringify({})
})
.then(res => res.json())
.then(data => console.log(data))
.catch(err => console.error(err));
TOKEN="my-secret-token"
curl -X POST "https://dev.crosstrade.io/v1/api/accounts/Sim101/strategies/370780512/enable" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{}'
Response
- 200
- 400 - not found
- 400 - terminated
{
"strategyId": "370780640",
"original_strategy_id": "370780512",
"account": "Sim101",
"hostMode": "account",
"engine": "recreate_from_deployment",
"recreated": true,
"deploymentId": "dep_9b3e4cbfac82",
"state": "Realtime",
"verified": true,
"success": true
}
{
"success": false,
"error": "strategy_not_found",
"detail": "No strategy with id '370780512' on account 'Sim101'. Use ListStrategies or ListAllStrategies to discover valid ids."
}
{
"success": false,
"error": "strategy_terminated",
"detail": "Strategy id '370780512' is in a terminal state and cannot be toggled. Use DeployStrategy or Account.AddStrategy to start a new instance."
}
Platform nuances
Available in CrossTrade Add-On v1.13.0+.
As of add-on v1.13.6, enable is post-verified against NT8 state: for a strategy still attached to the account (or chart), success: true is returned only after NT8 confirms it (verified: true), otherwise success: false with error: "enable_unconfirmed". Because NT8 removes account-hosted strategies from the account when they are disabled, re-enabling one by its original id recreates it from the saved deployment: the response carries recreated: true, a new strategyId, and original_strategy_id. As a safety guard the recreate is refused with error: "not_resumable_position_open" when the account holds an open position on the strategy's instrument (recreating flat would desync the position) — flatten first, or use StartStrategy deliberately. If no saved deployment exists for the id (for example a strategy attached manually in NT8, not deployed through CrossTrade), enable returns strategy_not_found with guidance to use StartStrategy. Chart-attached strategies resume in place via the enable flag.
WebSocket API
This request can also be made over the WebSocket API. The account and strategyId path parameters are passed inside args.
{
"action": "rpc",
"id": "my-request-id",
"api": "EnableStrategy",
"args": {
"account": "Sim101",
"strategyId": "370780512"
}
}
Tradovate
NinjaScript strategies are a NinjaTrader desktop concept, so there is no /v1/api/tv equivalent for enabling a strategy. See the Tradovate API overview for what the Tradovate surface covers.
Tradovate integrations submit orders directly through Place Order and inspect current positions or orders.