oanda / oandapy

Python wrapper for the OANDA REST API
MIT License
324 stars 148 forks source link

Python 3.x compatibility + live endpoint updated #10

Closed ranaroussi closed 9 years ago

ranaroussi commented 9 years ago

To make oandapy.py compatible with Python 3.x, I had to change lines 279-280 from:

data = json.loads(line)
if not (ignore_heartbeat and data.has_key("heartbeat")):
    ...

to

data = json.loads(line.decode("utf-8"))
if not (ignore_heartbeat and "heartbeat" in data):
    ...

. Also, line 246 had to update the live api endpoint from

self.api_url = 'https://stream-fxtrade.oanda.com/v1/quotes'

to

self.api_url = 'https://stream-fxtrade.oanda.com/v1/prices'