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

Add order with leverage result in error, but order still get through. #52

Closed
ivan-achlaqullah opened this issue Sep 15, 2017 · 7 comments

Comments

@ivan-achlaqullah
Copy link

Using query_private with leverage result in error, but somehow kraken still accept the order.

using Windows 10, with python 3.6.

The code :

## Test open long posiition
print(k.query_private('AddOrder',
                {'pair': 'USDTUSD',
                 'type': 'buy',
                 'ordertype': 'market',
                 'volume': '5',
                 'leverage': '2'}))

The order in kraken
image

Error massage :

# error message
---------------------------------------------------------------------------
timeout                                   Traceback (most recent call last)
<ipython-input-12-b2fec10e7464> in <module>()
      5                  'ordertype': 'market',
      6                  'volume': '5',
----> 7                  'leverage': '2'}))

D:\Anaconda3\lib\site-packages\krakenex\api.py in query_private(self, method, req, conn)
    180         }
    181 
--> 182         return self._query(urlpath, req, conn, headers)

D:\Anaconda3\lib\site-packages\krakenex\api.py in _query(self, urlpath, req, conn, headers)
    128                 conn = self.conn
    129 
--> 130         ret = conn._request(url, req, headers)
    131         return json.loads(ret)
    132 

D:\Anaconda3\lib\site-packages\krakenex\connection.py in _request(self, url, req, headers)
     77 
     78         self.conn.request('POST', url, data, headers)
---> 79         response = self.conn.getresponse()
     80 
     81         return response.read().decode()

D:\Anaconda3\lib\http\client.py in getresponse(self)
   1329         try:
   1330             try:
-> 1331                 response.begin()
   1332             except ConnectionError:
   1333                 self.close()

D:\Anaconda3\lib\http\client.py in begin(self)
    295         # read until we get a non-100 response
    296         while True:
--> 297             version, status, reason = self._read_status()
    298             if status != CONTINUE:
    299                 break

D:\Anaconda3\lib\http\client.py in _read_status(self)
    256 
    257     def _read_status(self):
--> 258         line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
    259         if len(line) > _MAXLINE:
    260             raise LineTooLong("status line")

D:\Anaconda3\lib\socket.py in readinto(self, b)
    584         while True:
    585             try:
--> 586                 return self._sock.recv_into(b)
    587             except timeout:
    588                 self._timeout_occurred = True

D:\Anaconda3\lib\ssl.py in recv_into(self, buffer, nbytes, flags)
   1000                   "non-zero flags not allowed in calls to recv_into() on %s" %
   1001                   self.__class__)
-> 1002             return self.read(nbytes, buffer)
   1003         else:
   1004             return socket.recv_into(self, buffer, nbytes, flags)

D:\Anaconda3\lib\ssl.py in read(self, len, buffer)
    863             raise ValueError("Read on closed or unwrapped SSL socket.")
    864         try:
--> 865             return self._sslobj.read(len, buffer)
    866         except SSLError as x:
    867             if x.args[0] == SSL_ERROR_EOF and self.suppress_ragged_eofs:

D:\Anaconda3\lib\ssl.py in read(self, len, buffer)
    623         """
    624         if buffer is not None:
--> 625             v = self._sslobj.read(len, buffer)
    626         else:
    627             v = self._sslobj.read(len)

timeout: The read operation timed out

Here the python notebook attached
https://drive.google.com/file/d/0BxSBFRJpBUpYX0MyNG51TGpLVzg/view?usp=sharing

@veox
Copy link
Owner

veox commented Sep 16, 2017

Looks like a general network error.

Does this consistently happen on all orders with leverage?.. Asking since I've seen this happen on regular ones, too. The order does in fact get placed in Kraken's trading engine, but the connection is dropped.

Anecdotal, somewhat OT:

Sometimes, I can even make a query for open orders, and the order is not there; yet repeating the same query after a while shows it as placed.

The latter is indicative of load issues on the other end.

@veox
Copy link
Owner

veox commented Sep 16, 2017

Oh! Which version of krakenex is this?..

krakenex.version.__version__

@veox
Copy link
Owner

veox commented Sep 16, 2017

As to the error itself, it's been mentioned in issue #46, too.

#11 (comment) has notes on using requests for networking, which might work around this particular problem; but that branch is rather experimental (see link).

@ivan-achlaqullah
Copy link
Author

ivan-achlaqullah commented Sep 18, 2017

I'm using pip install krakenex, which give me version 0.1.4

Well i have tried twice (opening and closing long order), on the day I submited the bug report. All of them get the same error, and all of them are accepted by kraken. Although I didn't know whatever the problem are on my connection, the krakenex code, or from Kraken themselves.

Edit : All of them are using leverage. I haven't tested opening order without leverage

@veox
Copy link
Owner

veox commented Sep 21, 2017

You could try with the recently released v1.0.0 (also on PyPI by now), but that won't help much AFAIU, since the particular network error shown here is not handled.

You could also try the (very alha quality!) requests-updated branch, as mentioned in #11 (comment) - if you're up to installing the package manually, and not through pip. That uses requests for networking, and doesn't fiddle with the connection (as highlighted in issue #53).

Other than that, don't think there's much that can be done.

@veox
Copy link
Owner

veox commented Sep 21, 2017

Marking invalid, since seems network-related, or an issue with Kraken's internal service topology.

Unless there's a reproducible test case that can demontrate that this is indeed due to using leverage, I don't think there's anything that can be done (other than as mentioned in previous comment).

@veox veox closed this as completed Sep 21, 2017
@veox
Copy link
Owner

veox commented Sep 21, 2017

Do reopen if I'm wrong.

@veox veox added not a bug and removed invalid labels Sep 15, 2021
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

2 participants