I am creating two websocket connections in different threads. I create a marketdata websocket connecting to wss://md-demo.tradovateapi.com/v1/websocket
I can subscribe to a particular future and get the market data.
I create another websocket to wss.demo.tradovateapi.com/v1/websocket
The websocket comes up successfully but when I create a sample place order request like this
order/placeorder
accountSpec is username returned from authentication
accountId is the integer account id
I get this response {'s': 200, 'i': 0, 'd': {'failureReason': 'UnknownReason', 'failureText': 'Access is denied'}}
I am not sure why I am getting access denied. I noticed that there are two access tokens when I authenticate. There’s an accessToken and a mdAccessToken.
Why am I getting an access deniedd when trying to send buy/sell orders? I do not get any errors when sending orders to the marketdata websocket.
Also, does the sequence number need to be unique across the entire session or unique for each of the websocket connections?
You need to call the account list endpoint, get the demo account userspec and userid, use that with when routing the orders and everything should work as expected.
accountSpec is the name field from the accessTokenRequest (docs) response, correct. But the accountId you need to get from the /account/list operation (docs). Then you can choose one of your accounts. Typical users have a single account but it isn’t unheard of to have multiples. The userId field is used for things like starting a subscription to real-time data for your user.