-
Notifications
You must be signed in to change notification settings - Fork 234
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 giving me invalid Key error. #134
Comments
I forgot to add this email from kraken support. I guess they recently updated the add orders endpoint? I don't really know.
(formatting edited by @veox) |
Search shows something similar in issue #124, and the best explanation then was this:
Which could indeed be explained by "recent changes to REST API endpoints"... ... Except that I've just tried your code near-verbatim (replaced % ipython
Python 3.9.6 (default, Jun 30 2021, 10:22:16)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.19.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: # code sample
...: import krakenex
...: import math
...: import time
...:
...:
...: def round_down(n, decimals=8):
...: multiplier = 10 ** decimals
...: return math.floor(n * multiplier) / multiplier
...:
...: k = krakenex.API()
...: k.load_key('kraken-trade.key')
...: quote_symbol = 'KEEPEUR'
...: symbol = 'KEEPEUR'
...: round_price = 5
...: quote = k.query_public('Ticker', {'pair': quote_symbol})
...: USD2 = 10
...: bp = round(float(str(quote["result"][symbol]["b"][0])), round_price)
...: bv = round_down(USD2 / bp)
...: b1 = k.query_private('AddOrder',
...: {'pair': quote_symbol, 'type': 'buy', 'ordertype': 'limit', 'leverage': 'none', 'volum
...: e':
...: bv, 'price': bp, 'expiretm': '+10'})
...: print(b1)
{'error': [], 'result': {'txid': ['OORDER-ORDER-ORDERO'], 'descr': {'order': 'buy 28.18966003 KEEPEUR @ limit 0.35474'}}}
In [2]: krakenex.version.__version__
Out[2]: '2.1.0'
In [3]: I've tried disabling the "Create & Modify Orders" permission on the key, but then the error is different:
BTW, I had to force-reload Kraken's key permission editing page ( Anyway, I can't reproduce the error.
|
BTW, you may also want to look through https://github.com/veox/python3-krakenex/issues?q=EAPI%3AInvalid+key |
As I understand, you now have several key files to work with. You could try setting the key/secret values manually in the script for testing purposes. Like: k.key = 'KEY-STRING'
k.secret = 'SECRET-STRING' If that works, then it's something with formatting in |
Thank you so much for your help I ended up figuring it out. For the last 6 months I had my API key and Secret listed in the kraken.key.py as strings: "keykeykeykeykeykeykeykey" But I guess after the recent update to the add orders endpoint I can't have them as strings. It just has to be: keykeykeykeykey Sorry for wasting you time, as I see the example has it listed this way without strings. I guess when I first started building my program I programmed it with strings and it worked perfectly until a recent update. |
Versions
What are you trying to achieve?
I am trying to add a limit order. I haven't changed my code in 6 months and it was working perfectly until about four days ago. When I call my balance, it works perfectly. I have created new API Keys to see if the Keys were the issue, but still get the same error on when trying to add an order.
What do you expect to happen?
The limit order to be placed successfully.
What happens instead?
An Invalid API KEY error occurs.
The text was updated successfully, but these errors were encountered: