-
Notifications
You must be signed in to change notification settings - Fork 230
Open
Description
Versions
OS: Mac, Linux
Python: 3.7.5
krakenex: 2.1.0
What are you trying to achieve?
Place buy 'limit' order with a closing 'stop-loss-profit' order.
# code sample
import json
import os
from krakenex import API
API_KEY = os.getenv('KRAKEN_API_KEY', '')
SECRET_KEY = os.getenv('KRAKEN_SECRET_KEY', '')
if __name__ == '__main__':
api = API(API_KEY, SECRET_KEY)
try_working = False
if try_working:
# this always works
data = {'pair': 'XLTCZUSD', 'type': 'buy', 'ordertype': 'limit', 'price': '80.0', 'volume': '1.25'}
else:
# this always fails with: "EAPI:Invalid key"
data = {'pair': 'XLTCZUSD', 'type': 'buy', 'ordertype': 'limit',
'price': '80.0', 'volume': '1.25', 'close': {'ordertype': 'stop-loss-profit', 'price': '75.0', 'price2': '90.0'}}
ret = api.query_private('AddOrder', data=data)
print(json.dumps(ret, indent=2, sort_keys=True))What do you expect to happen?
The order is placed as per my request.
What happens instead?
"EAPI:Invalid key" is returned when I try to place order with a close following one. It works for a simple order - i.e. without the closing one.
# error message
{
"error": [
"EAPI:Invalid key"
]
}