Start Order Strategy
### Start a multi-bracket trading strategy.
This endpoint is used with a WebSocket. You can create any number of brackets and add them to `brackets` field on the `params` object as a JSON string.
```js
const URL = 'wss://demo.tradovateapi.com/v1/websocket'
const params = {
entryVersion: {
orderQty: 1,
orderType: "Market"
},
brackets: [{
qty: 1,
profitTarget: -30,
stopLoss: 15,
trailingStop: false
}]
}
const body = {
accountId: myAcctId,
accountSpec: name,
symbol: 'MESM1',
action: 'Sell',
orderStrategyTypeId: 2, //2 is 'multibracket', we currently only offer this strategy but more may exist in the future.
params: JSON.stringify(params)
}
const mySocket = new WebSocket(URL)
//authorize socket using your access token
mySocket.onopen = function() {
mySocket.send(`authorize\n0\n\n${accessToken}`)
}
mySocket.send(`orderstrategy/startorderstrategy\n4\n\n${JSON.stringify(body)}`)
```
For more details about working with advanced order types, see [placeOrder](/#operation/placeOrder), [placeOCO](/#operation/placeOCO), and [placeOSO](/#operation/placeOSO).
Authentication
AuthorizationBearer
Bearer authentication of the form Bearer <token>, where token is your auth token.
Request
This endpoint expects an object.
symbol
orderStrategyTypeId
action
Buy, Sell
Allowed values:
accountId
accountSpec
params
uuid
customTag50
isAutomated
Response
OrderStrategyStatusResponse
errorText
Non-empty if the request failed
failureReason
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
orderStrategy

