Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loop issues #34

Closed
bitRomney opened this issue Jul 26, 2017 · 3 comments
Closed

Loop issues #34

bitRomney opened this issue Jul 26, 2017 · 3 comments
Labels

Comments

@bitRomney
Copy link

I run this code in a loop to constantly scan for opportunities with my bot. 90% of the time after 5 min my code ends in an error like this:

File "tradeKraken.py", line 34, in
balances = k.query_private('Balance')
File "/usr/local/var/pyenv/versions/3.4.3/bin/krakenex/api.py", line 122, in query_private
return self._query(urlpath, req, conn, headers)
File "/usr/local/var/pyenv/versions/3.4.3/bin/krakenex/api.py", line 83, in _query
return json.loads(ret)
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/init.py", line 339, in loads
return _default_decoder.decode(s)
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 382, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

any ideas?

@bitRomney
Copy link
Author

Upon inspecting what's happening in api.py at that time I have printed ret and get that it times out at that point.

What happened?

The web server reported a gateway time-out error.

What can I do?

Please try again in a few minutes.

any idea on how to fix this so it can continue looping?

@bitRomney
Copy link
Author

I ended up using this
def is_json(myjson):
try:
json_object = json.loads(myjson)
except ValueError, e:
return False
return True

if is_json(ret):
return json.loads(ret)
else:
time.sleep(30)
print "got here"
return json.loads(ret)
but not sure how long to pause it. probable "a few minutes" like it says in the html?

@veox
Copy link
Owner

veox commented Jul 26, 2017

Kraken has had load issues for the last several months. There is nothing that can be done except for waiting on timeouts.

"A few minutes" should be reasonable.

Marking as "invalid", since not specific to krakenex.


In the future, please format code blocks with backticks. It is otherwise unreadable.

Also, do provide OS/Python/krakenex versions.

@veox veox closed this as completed Jul 26, 2017
@veox veox added the invalid label Jul 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants