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

How to set timeout? #67

Closed
Endogen opened this issue Nov 12, 2017 · 8 comments
Closed

How to set timeout? #67

Endogen opened this issue Nov 12, 2017 · 8 comments

Comments

@Endogen
Copy link
Contributor

Endogen commented Nov 12, 2017

Versions

OS: macOS 10.13.1
Python: 3.6.3
krakenex: 2.0.0c2

What are you trying to achieve?

Get a response from Kraken

kraken = krakenex.API()
kraken.load_key("kraken.key")

res_add_order = kraken.query_private("AddOrder", req_data)

What do you expect to happen?

Request should wait till response is returned

What happens instead?

I get no response

@veox veox added the question label Nov 12, 2017
@veox
Copy link
Owner

veox commented Nov 12, 2017

OT: How long have you tried to wait?..

For me, all queries return a response (or raise a requests exception) within 1 minute. Most queries that would interact with Kraken's trade execution engine are "resolved" within 10-20 seconds, but quite often go up to 30.

@Endogen
Copy link
Contributor Author

Endogen commented Nov 12, 2017

Sorry, my bad. I get an requests error. I just didn't catch it.

requests.exceptions.HTTPError: 502 Server Error: Bad Gateway for url: https://api.kraken.com/0/private/AddOrder

Is it just me or isn't it possible right now to create an order at Kraken via API? Sorry for the mess, i do realize that this has nothing todo with my initial question...

@veox
Copy link
Owner

veox commented Nov 12, 2017

No problem!

ATM, Kraken is indeed a mess; 502s were fairly common in recent months, but there's ample 504s and 520s now.

@veox
Copy link
Owner

veox commented Nov 12, 2017

BTW, careful with 502s: PSA on /r/krakenex.

@veox
Copy link
Owner

veox commented Nov 12, 2017

Please don't close the issue, though: the topic question is still valid.

@veox veox added this to the v2.x milestone Nov 12, 2017
@TheSeven
Copy link

TheSeven commented Dec 4, 2017

Tonight I had a situation where quite likely my internet connection was dropped while krakenex was waiting for a reply. That ended up waiting for that reply endlessly (hours), so adding a (reasonable) timeout would still be a good idea, even if this only occurs rarely.

@moppymopperson
Copy link
Contributor

I sometimes have the same problem as @TheSeven. I run a script that queries the public endpoint for the current price at regular intervals, and occasionally I’ll get a response that never comes back. Currently I have to manually inspect and reset, but I’d really like to handle it with a timeout to just give up and move on.

moppymopperson added a commit to moppymopperson/python3-krakenex that referenced this issue Dec 24, 2017
This is proposed solution to veox#67. The newly added timeout parameter is None by default, so the default behavior remains unchanged, but gives the option to add a timeout to those who wish to use one.
@veox
Copy link
Owner

veox commented Dec 24, 2017

PR #77 has been merged - introducing a timeout arg to the query_{public,private} functions.

The value passed should be a number (int or float).

For now, there is no way to set a default timeout (for all queries and/or connection opening).

@veox veox closed this as completed Dec 24, 2017
@veox veox removed the question label Feb 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants