startOrderStrategy works on Demo works, But not on Live

Hello,

I am now trying to connect to wss://live.tradovateapi.com/v1/websocket on my script to execute some trades. I have been running the demo version for a few weeks without issues. Trades able to execute no problem.

Unfortunately, I’m a bit perplexed when I’m now pointing at the live websocket, all of the authentication/authorization commands work but I just get:

Request:

orderstrategy/startorderstrategy
7

{"accountId": <LIVE_ACCOUNT_ID>, "accountSpec": "<LIVE_ACCOUNT_NAME>", "symbol": "MNQU2", "orderStrategyTypeId": 2, "action": "Buy", "params": "{\"entryVersion\": {\"orderQty\": 1, \"orderType\": \"Market\", \"timeInForce\": \"Day\"}, \"brackets\": [{\"qty\": 1, \"profitTarget\": 125, \"stopLoss\": -60, \"trailingStop\": true}]}"}

Response:
{'s': 401, 'i': 7, 'd': 'Access is denied'}

Executing the same (or well similar request) and watching the browser web socket on Tradovate.com, I see:

orderStrategy/startorderstrategy
20

{"accountId":<LIVE_ACCOUNT_ID>, "symbol":"MNQU2","orderStrategyTypeId":2,"action":"Buy","params":"{\"entryVersion\":{\"orderId\":0,\"orderQty\":1,\"orderType\":\"Market\",\"timeInForce\":\"Day\"},\"brackets\":[{\"qty\":1,\"profitTarget\":30,\"stopLoss\":-15,\"trailingStop\":true}]}"}

A few things:

  • <LIVE_ACCOUNT_ID> both matched exactly, so I know this field is right
  • “accountSpec” never seems to be mentioned in the startOrderStrategy. I previously had to have this in, not sure why the browser never seems to use it.
  • would orderStrategy/startorderstrategy be case sensitive? If so, it’s not case sensitive on the DEMO server.
  • I also see this “orderId”:0 variable under entryVersion

As for api permissions, I have:

image

Is there some other “Live” initialization I need to do that I wouldn’t have needed to do on the DEMO server?

Thanks!

The deviceId becomes important when you request your access token on LIVE mode. If you are not using a device ID 401: Access Denied will always be the result. If you are using a device ID but still getting this response, you’ll need to ensure that you’ve approved the device. You should receive an email asking you to approve the device if it is the first instance of the given device ID. After approving the device it should behave normally when you request a token with that same device ID in the future.