Orders

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.


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, placeOCO, and placeOSO.

post/orderStrategy/startorderstrategy

Request

  • Base URL: https://demo.tradovateapi.com/v1
  • URL: https://demo.tradovateapi.com/v1/orderStrategy/startorderstrategy
  • Auth: HTTP bearer

Request body

accountIdinteger
accountSpecstring
symbolstring required
orderStrategyTypeIdinteger required
action'Buy' | 'Sell' required

Buy, Sell

paramsstring
uuidstring
customTag50string
isAutomatedboolean

Response

OrderStrategyStatusResponse

errorTextstring

Non-empty if the request failed

failureReason'AccountClosed' | 'AdvancedTrailingStopUnsupported' | 'AnotherCommandPending' | 'BackMonthProhibited' | 'ExecutionProviderNotConfigured' | 'ExecutionProviderUnavailable' | 'HomeStateRestricted' | 'InvalidContract' | 'InvalidPrice' | 'KeyInformationDocumentRequired' | 'LiquidationOnly' | 'LiquidationOnlyBeforeExpiration' | 'MaxOrderQtyIsNotSpecified' | 'MaxOrderQtyLimitReached' | 'MaxPosLimitMisconfigured' | 'MaxPosLimitReached' | 'MaxTotalPosLimitReached' | 'MinTradeDurationNotElapsed' | 'MultipleAccountPlanRequired' | 'NoQuote' | 'NotEnoughLiquidity' | 'OtherExecutionRelated' | 'ParentRejected' | 'RiskCheckTimeout' | 'SSFNFAComplianceRequired' | 'SSFNFAComplianceRequiredJointOnly' | 'SSFRiskDisclosureAcknowledgmentRequired' | 'SessionClosed' | 'Success' | 'TooLate' | 'TradingLocked' | 'TrailingStopNonOrderQtyModify' | 'Unauthorized' | 'UnknownReason' | 'Unsupported'

AccountClosed, AdvancedTrailingStopUnsupported, AnotherCommandPending, BackMonthProhibited, ExecutionProviderNotConfigured, ExecutionProviderUnavailable, HomeStateRestricted, InvalidContract, InvalidPrice, KeyInformationDocumentRequired, LiquidationOnly, LiquidationOnlyBeforeExpiration, MaxOrderQtyIsNotSpecified, MaxOrderQtyLimitReached, MaxPosLimitMisconfigured, MaxPosLimitReached, MaxTotalPosLimitReached, MinTradeDurationNotElapsed, MultipleAccountPlanRequired, NoQuote, NotEnoughLiquidity, OtherExecutionRelated, ParentRejected, RiskCheckTimeout, SSFNFAComplianceRequired, SSFNFAComplianceRequiredJointOnly, SSFRiskDisclosureAcknowledgmentRequired, SessionClosed, Success, TooLate, TradingLocked, TrailingStopNonOrderQtyModify, Unauthorized, UnknownReason, Unsupported

Changes

No recorded changes to this operation across all 1 revision of this API.