Closed 5harever closed 5 years ago
Hi @5harever , the error is very clear: V20Error: {"errorMessage":"Insufficient authorization to perform request."}, make sure that you use a correct token. Maybe just revoke it and generate a new one.
If you have both a live and a practice account make sure you don't mix up
I already revoked and copy and paste again. It was still same error. I never created the practice version.
Or I have to define below? class oandapyV20.API(access_token, environment='live', headers=None, request_params=None)
if you want to use a live account AND you have a token for live, the code from your first message should be:
api = API(access_token="blah blah blah", environment='live')
By default the client works on the practice environment. So if you passed a token for a live-account that V20 authorization error was logical.
I would strongly advise you to work on the practice environment first.
Oh this one is crystal clear. Thank you very much.
Best Regards,
Mr. Patchara Wattanadheerakul (Share)
On Oct 25, 2018, at 00:03, Feite Brekeveld notifications@github.com wrote:
if you want to use a live account AND you have a token for live, the code from your first message should be:
api = API(access_token="blah blah blah", environment='live')
By default the client works on the practice environment. So if you passed a token for a live-account that V20 authorization error was logical.
I would strongly advise you to work on the practice environment first.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
Please help me fix the problem. I tried below code
get a list of trades
from oandapyV20 import API import oandapyV20.endpoints.trades as trades
api = API(access_token="blah blah blah") accountID = "001-011-1926632-001"
r = trades.TradesList(accountID)
show the endpoint as it is constructed for this call
print("REQUEST:{}".format(r)) rv = api.request(r) print("RESPONSE:\n{}".format(json.dumps(rv, indent=2)))
And I got this error message.
REQUEST:v3/accounts/001-011-1926632-001/trades
V20Error Traceback (most recent call last)