OpenBB-finance / OpenBB

Investment Research for Everyone, Everywhere.
https://openbb.co
Other
34.25k stars 3.15k forks source link

[Bug] fx> summary command error: Insufficient authorization to perform request #417

Closed arisliang closed 3 years ago

arisliang commented 3 years ago

Describe the bug A clear and concise description of what the bug is. I've added my oanda API key to GT_OANDA_TOKEN and GT_OANDA_ACCOUNT in .env file, but got error "Insufficient authorization to perform request" when running "fx" -> "summary"

To Reproduce Steps(from the start) and commands to reproduce the behavior

  1. Added oanda API key to GT_OANDA_TOKEN and GT_OANDA_ACCOUNT in .env file
  2. fx
  3. summary

Screenshots image

Desktop (please complete the following information):

alokan commented 3 years ago

Are you sure the account number and keys were added correctly?

arisliang commented 3 years ago

Yeah, I'm sure the account number and keys are correct. Although is there something on Oanda we could give sufficient authorization to these keys? I suspect some additional Oanda configuration for these keys are needed.

alokan commented 3 years ago

No, there isn't anything on Oanda that you need to change. Are you using a live account?

arisliang commented 3 years ago

Yes, it's a live account. I just generated a new token from the account, doesn't help. I use the account and key with a previously working script, it wasn't working either. I contact Oanda support, see if they can help to check.

DidierRLopes commented 3 years ago

I've created a Oanda account just to test this Forex menu and didn't have any issue.

I'm gonna change some digits but this is what my OANDA details look like:

OANDA_ACCOUNT = "101-000-6233123-121"
OANDA_TOKEN = "55a7c1234d5a3531a613ffff713fb68f-5e72de1d26934274359ef7ddb99efe50"

Can you confirm you are setting these correctly?

arisliang commented 3 years ago

Yeah, what I put looks like these as well (only anonymized).

GT_OANDA_ACCOUNT=001-003-1234567-001 GT_OANDA_TOKEN=1111111111111111111111111111111-222222222222222222222222222222

alokan commented 3 years ago

Is the key a V20 REST API key?

arisliang commented 3 years ago

Somehow it's working with oanda summary now. Maybe because I did a git pull.

arisliang commented 3 years ago

By the way, I understood from Oanda support their base url for live and practice account are different. So this only works with live account, is it?

devwolff commented 3 years ago

I'm using an practice account. So I changed environment from "live" -> "practice". I also got "Insufficient authorization to perform request".

Just double checking.. So the code on oanda only work with "live" account?

I tried below with my practice account

curl -H "Authorization: Bearer 12345678900987654321-abc34135acde13f13530" https://api-fxpractice.oanda.com/v3/accounts/{account_ID}/summary

and it works fine.