小编Sha*_*ley的帖子

如何让ondapyV20完成授权?

这是我的代码:

from oandapyV20 import API
import oandapyV20.endpoints.trades as trades
api = API(access_token="xxx")
accountID = "xxx-xxx-xxxxxxx-xxx"
r = trades.TradesList(accountID)
print("REQUEST:{}".format(r))
rv = api.request(r)
print("RESPONSE:\n{}".format(json.dumps(rv, indent=2)))
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

Traceback (most recent call last):
  File "C:\Users\Administrator\Desktop\oanda tester.py", line 10, in <module>
    rv = api.request(r)
  File "C:\Python37\lib\site-packages\oandapyV20\oandapyV20.py", line 306, in request
    request_args, headers=headers)
  File "C:\Python37\lib\site-packages\oandapyV20\oandapyV20.py", line 243, in __request
    response.content.decode('utf-8'))
oandapyV20.exceptions.V20Error: {"errorMessage":"Insufficient authorization to perform request."}
Run Code Online (Sandbox Code Playgroud)

我的令牌和帐户信息是正确的。

该代码是直接从文档复制的。

我在这里错过了什么吗?

python algorithm finance forex

2
推荐指数
1
解决办法
1540
查看次数

标签 统计

algorithm ×1

finance ×1

forex ×1

python ×1