Can trade in demo account, having trouble with live account

HI,

I am able to place orders using my demo account using Place order API with API Keys, but live account orders are failing for the place order API.

Do we can any constraints for live account like minimum balance on account ?

Could you please provide direction what all things we need to consider when placing live orders in Place order API.

Thanks,
Raghav

Hello @venkata_raghavendra,

We do have minimum balance requirements, but to join the API Access program you already have met them. Take a look at what endpoint you’re using. If you didn’t change from demo.tradovateapi.com to live.tradovateapi.com then requests will fail for live accounts.

HI Alexander,

Thanks for your reply, I have changed it to both https://live.tradovateapi.com/v1/order/placeorder and https://live.tradovateapi.com/order/placeorder and also getting 200 response code from server.
But place order is failing with below error.

I have setup all API’s in POSTMAN REST client and validating with valid Baerer auth token.

{
“failureReason”: “UnknownReason”,
“failureText”: “Access is denied”
}

My request payload is same for both demo account and live account
“action”: “Buy”,
“symbol”: “MYMU1”,
“orderQty”: 1,
“orderType”: “Market”,
“accountSpec”: “myuser id”,
“accountId”: my account id,
“isAutomated”: true

Could anyone please confirm live orders are successful with the above place order API end point - https://live.tradovateapi.com/order/placeorder and Json payload, do we need to add any more details for Live order compared to demo order payload

Demo account successful order:

Where you have "accountSpec": "my user id", do you use the integer userId value from the auth response or the or the string name value? You should use name for accountSpec.

I am using string name only, it’s accepting the request, but giving back with a response as access denied for live account. and same payload giving the order id in demo account.

Just to be sure:

Your Live Account and Demo Account will not have the same accountId

I am using same account ID, as when checked in other APIs , it’s returning the same account ID for both demo and live accounts. If it is different how to get the live account id.

If you’re getting access to the live API (meaning you’re using the live endpoint for /auth/accessTokenRequest and you get a 200 response with an accessToken field), you can just make a GET request to /account/list. This will return all of the accounts associated with your live user as an array. Each data object represents an Account and the id field is the real account entity ID.

Thanks for all your support, it’s working now,I am able to place live orders.

2 Likes

Good news, glad we could help!

1 Like

@Alexander, springing off this post - I have no issues with ordering via demo and replay, but live gives the same Access is denied message.

I’m using the live endpoint (https://live.tradovateapi.com/v1) for the /auth/accessTokenRequest, and checking my accountSpec and accountId in the logs, they correspond to the live account. Is the order/ family of endpoints looking for accountSpec XOR / OR / AND accountId? Since my tradovate-api-access-token per the example docs is coming from the live endpoint, I’m not sure what else it could be. isAutomated is set to true since the order handling is software driven without manual intervention on my part.

The only thing I can think of is because I’m running my project as a Node.js app instead of a browser / webpack app, I’m using the v4 function from uuid from NPM to generate deviceID, which may be less consistent than device-uuid per the example projects.

I’ve made sure that my API key is given full access for Orders, and I don’t believe keys are separate for demo and live.

Are there any other things to look into regarding why live orders are being rejected?

Hello @Jackson_Graves,

The order family of endpoints is looking for both accountSpec and accountId. accountSpec is either ‘VXXXXX’ or ‘DEMOXXXXX’, the accountId is the actual account entity ID. You need to find the account entity ID separately from the auth response. The simplest way to get account info is to use the account/list endpoint (after you’ve been granted an access token), which will return an array of any accounts associated with your user.

Regarding the API key, you should be fine as long as you’ve given the key full access for Orders.

Posting for others who may be experiencing similar issue.

When requesting authentication include non-required fields. This resolved my issue for placeOrder and cancelOrder methods.

name*
password*
appId	
appVersion	
deviceId	
cid	
sec

*required

The demo account did not require the non-required fields on my end. This led to a long debugging session when requesting live account. I was able to request read only data like accountList with only providing the required fields, not write fields like placeOrder.