Closed uelel closed 5 years ago
It seems most likely that your processed token from file is incorrect. Check if your code works with providing the token as a string instead of reading it from file. The authentication itself works, so I close this issue.
The error still persists when provided the token as a string.
Can you please hint the code line in boandav20
that controls creating GET request for
https://api-fxpractice.oanda.com:443/v3/accounts/{accountNo}/summary
(as stated in my error message?)?
You may also try to generate a new Token and give it a try. Also ensure you provide the correct credentials for your practice account (since the example you provided is using a practice account)
Indeed, a wrong account has been provided (fxpractice
).
fxpractice
URL should be called in case of demo
account and fxtrade
in case of trade
account.
Thank you for your help!
I am glad you worked it out!
For a practice account you would set practice=True, for a live account practice=False. No need to set any urls, since the endpoints are hardcoded already.
Practice Account
oandastore = btoandav20.stores.OandaV20Store(token=YYY, account=XXX, practice=True)
Live Account
oandastore = btoandav20.stores.OandaV20Store(token=YYY, account=XXX, practice=False)
It is not possible to authenticate via
OandaV20Store
object. The output is:GET https://api-fxpractice.oanda.com:443/v3/accounts/001-004-3121847-001/summary expected status 200, got 401 (Unauthorized) Insufficient authorization to perform request.
The debug log of this snippet is here.
The authentication to Oanda API is possible (according to this page) thus the token is correct.
btoandav20
is installed together withpyyaml 5.1.2
,v20 3.0.25.0
,backtrader 1.9.74.123
Where should I look for the problem?