In this case, the first thing I’d check is your API Key permissions. You’ll need to make sure you have Contract Library set to Read, Positions set to Read, Account Information set to at least Read, and Orders set to Full Access. For development purposes, I’d just enable them all. You can always filter out what you don’t need before you transition to the Live API.
Thanks, for the help I was able to get it working using the correct Account id. But all my orders are getting rejected as I have checked from https://demo.tradovateapi.com/v1/order/list endpoint.
How can I get the reason for the order getting failed?
I’m using the demo endpoint. I have full permissions on my API key. I’m having no issues authorizing both websocket connections. I’m sure I’m using the correct websocket (I’m getting status code 200 on my responses). I’m getting the same error on the HTTP interface. I created a device UUID that is hardcoded but I’ve only run my application from the same device so far. The “accountSpec” field on my placeOrder request is using the value of the “name” field on the response from the “user/list” endpoint and the “accountId” uses the “id” field from the same response.
I can’t think of anything else I could do differently.
I too have the same problem with access denied. My setting for the endpoint is
“accountSpec”: “My Demo Account Name”, (exp DEMO1234)
“accountId”: is my live account id number’, (exp 783458)
is Automated is set to True (with the capital T no quote because it is expecting a bool)
are you using JavaScript or Python, because when i tried using “true” or “True” it gave me an error, besides I don’t think the access denied has anything to do with that, am I wrong?
I’m using Python. You can check out my code below. I used “true”
And yes, I would assume that sending an incorrectly formatted request to the API would have something to do with the access denied error - but who knows.
First of all, I want to personally thank you for your library. It is awesome and very easy to understand. i actually am using your library as a model for what I am trying to do and also help me understand this API. Using your code structure I did get an error when I put the quotes for the “true”, and when I put True, it’s fine exempt for the error {“failureReason”:“UnknownReason”,“failureText”:“Access is denied”}
In your code “accountSpec”: USER_NAME which I get, but the"accountId": accId which is a refrence to DEMO_ACCOUNT_ID in your code. Is that the same as DEMO12345 in the tradovate platform.
I see your problem. You need to get your account ID from “GetAccountList.py” in my repo. It is not what you see in the desktop app that looks like “DEMO1235” it will be a number.
My Demo id is 7 digits long and my Live id is 4 digits long.
I just updated the repo so this should be really easy. I don’t know why Tradovate makes this as unintuitive as it is. I hope this helps!
My question is in setting up the “accountSpec” and “accountId”. Is the setup as follow:
“accountSpec”: “your_tradovate_user_login_id”,
“accountId”: 18#### or 10##### or 72#### (from the account list), cause I tried every combination and still get the access denied.
Thank you for your help today supah. The problem was I had the wrong accountId, accountSpec,
So for anyone who may run into this problem. Try this.
Once you get your access token, run the account list to get your demo account info.
url = “https://demo.tradovateapi.com/v1/account/list”
header = {
‘Authorization’: f’Bearer ${token}',
‘Content-Type’: ‘application/json’,
‘Accept’: ‘application/json’
}
res = requests.get(url, headers=header)
your json results (res) should be similar to this:
two years late but I was running into this same problem. The problem was I had my account ID wrong. I thought it was the number that my account is named after, but it’s not. I used the account list endpoint to get my account number and it worked