Skip to content

JSONDecodeError: Expecting property name enclosed in double quotes #47

@jeremytanjianle

Description

@jeremytanjianle

These's are the exact codes from which I copy from a popular oanda sample code in some "Mastering Python for Finance" book. But no matter what I do, I keep getting JSON errors!

if __name__ == "__main__":

   key = token
   account_id = account_ID
   system = ForexSystem(environment="practice", access_token=token)
   system.begin(accountId=account_id,
                instruments="EUR_USD",
                qty=1000,
                resample_interval="10s",
                mean_period_short=5,
                mean_period_long=20,
                buy_threshold=1.,
                sell_threshold=1.)

The Errors responses are the following. Can someone tell me how to fix this? I hear its OANDA's problem


__main__:37: UserWarning: Streamer() supports the use of multiple endpoints use the rates() method instead
Traceback (most recent call last):

  File "<ipython-input-8-06ee8e5a22a1>", line 13, in <module>
    sell_threshold=1.)

  File "<ipython-input-5-43a3e04216f9>", line 37, in begin
    self.start(**params)  # Start streaming prices

  File "/home/vinitrinh/anaconda3/lib/python3.6/site-packages/oandapy/stream/stream.py", line 73, in start
    self.run("v1/prices", params=params)

  File "/home/vinitrinh/anaconda3/lib/python3.6/site-packages/oandapy/stream/stream.py", line 104, in run
    data = json.loads(line.decode("utf-8"))

  File "/home/vinitrinh/anaconda3/lib/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)

  File "/home/vinitrinh/anaconda3/lib/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())

  File "/home/vinitrinh/anaconda3/lib/python3.6/json/decoder.py", line 355, in raw_decode
    obj, end = self.scan_once(s, idx)

JSONDecodeError: Expecting property name enclosed in double quotes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions