hootnot / oanda-api-v20

OANDA REST-V20 API wrapper. Easy access to OANDA's REST v20 API with oandapyV20 package. Checkout the Jupyter notebooks!
MIT License
398 stars 107 forks source link

Connection error. #157

Closed JAB64 closed 4 years ago

JAB64 commented 4 years ago

Sorry to ask a simple question but I've been working on for a few weeks with no success. I get the follow error "TypeError: init() takes 1 positional argument but 2 were given" with the following code. Thank you.

import json
from oandapyV20 import API    # the client
import oandapyV20.endpoints.trades as trades

access_token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
accountID = "xxx-xxx-xxxxxx-xxx"
client = API(access_token=access_token)

# request trades list
r = trades.TradesList(accountID)
rv = client.request(r)
print("RESPONSE:\n{}".format(json.dumps(rv, indent=2)))
hootnot commented 4 years ago

Title of the issue is: Connection Error, in your description you talk about a TypeError.

This code works fine on my side. Please check what you posted here and what you run.

If you have connection issues you can troubleshoot these with curl and one of the examples from docs.oanda.com like getting the accounts: http://developer.oanda.com/rest-live-v20/account-ep/

If that works, the code will not raise a connection error.