tg12 / FAIG

Fully Automated IG Trading
148 stars 60 forks source link

Any idea for the Json serializable issue? #31

Closed RonnSanji closed 4 years ago

RonnSanji commented 4 years ago

Tried to run faig.py but got the error below :

$ python faig.py Traceback (most recent call last): File "faig.py", line 9, in api = API() File "/FAIG-master/ig.py", line 27, in init d = super().session() File "/FAIG-master/igclient.py", line 27, in wrap return f(*args, **kwargs) File "/FAIG-master/igclient.py", line 75, in session r = self._handlereq( requests.post(self.API_ENDPOINT + '/session', data=json.dumps(data), headers=self.session_headers) ) File "/lib/python3.6/json/init.py", line 231, in dumps return _default_encoder.encode(obj) File "/lib/python3.6/json/encoder.py", line 199, in encode chunks = self.iterencode(o, _one_shot=True) File "/lib/python3.6/json/encoder.py", line 257, in iterencode return _iterencode(o, 0) File "/lib/python3.6/json/encoder.py", line 180, in default o.class.name) TypeError: Object of type 'bytes' is not JSON serializable

RobBickel commented 4 years ago

The script error'd on login. Either you forgot to put in your credentials, or you don't have the right type of account at IG.

tg12 commented 4 years ago

The script error'd on login. Either you forgot to put in your credentials, or you don't have the right type of account at IG.

Most likely this.

RonnSanji commented 4 years ago

Got it... thanks .. will check the account again..

RonnSanji commented 4 years ago

The script error'd on login. Either you forgot to put in your credentials, or you don't have the right type of account at IG.

Most likely this. Hi tg12,

Thanks for the suggestion. The Json problem has been solved. Now, there is another issue. When I run the faig.py by using my demo account, the account information can be retrieved correctly however, it shows an warning below :

WARNING:root:Server error:ERROR CS.D.CHFNOK.TODAY.IP: Price change 0.05%

Seems the order is also not placed. Any idea about this issue ?

tg12 commented 4 years ago

That's a market issue not to do with this code. It's probably because it's not tradeable or you haven't got the required margin for that instrument.