-
Notifications
You must be signed in to change notification settings - Fork 236
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
Adding 'close' order doesn't work: EAPI:Invalid key #124
Comments
Can confirm locally (Arch Linux, Python 3.8, |
Note that this has not been the syntax the last it was tested: response = kraken.query_private('AddOrder',
{'pair': 'XXBTZEUR',
'type': 'buy',
'ordertype': 'limit',
'price': '1',
'volume': '1',
# `ordertype`, `price`, `price2` are valid
'close[ordertype]': 'limit',
'close[price]': '9001',
# these will be ignored!
'close[pair]': 'XXBTZEUR',
'close[type]': 'sell',
'close[volume]': '1'}) Can confirm the above still works; with ( In [39]: data = {'pair': 'XXBTZEUR',
...: 'type': 'buy',
...: 'ordertype': 'limit',
...: 'price': '80.0',
...: 'volume': '0.01',
...: 'close[ordertype]': 'limit',
...: 'close[price]': '90.0'
...: }
In [40]: kraken.query_private('AddOrder', data=data)
Out[40]:
{'error': [],
'result': {'descr': {'order': 'buy 0.01000000 XBTEUR @ limit 80.0',
'close': 'close position @ limit 90.0'},},
'txid': ['POTATO-POTATO-POTATO']}} Syntax as in issue report doesn't work: In [41]: data = {'pair': 'XXBTZEUR',
...: 'type': 'buy',
...: 'ordertype': 'limit',
...: 'price': '80.0',
...: 'volume': '0.01',
...: 'close': {'type': 'sell',
...: 'price': '90.0'
...: }}
In [42]: kraken.query_private('AddOrder', data=data)
Out[42]: {'error': ['EAPI:Invalid key']} |
The documentation at https://www.kraken.com/features/api#add-standard-order is likely misleading/outdated. |
Also it looks like Check the order interfaces for what is available to you. It's possible this is also dependent on trading tier. |
This syntax "works": In [55]: data = {'pair': 'XXBTZEUR',
...: 'type': 'buy',
...: 'ordertype': 'limit',
...: 'price': '80.0',
...: 'volume': '0.01',
...: 'close[type]': 'stop-loss-profit',
...: 'close[price]': '70.0',
...: 'close[price2]': '90.0'
...: }
In [56]: kraken.query_private('AddOrder', data=data)
Out[56]:
{'error': [],
'result': {'descr': {'order': 'buy 0.01000000 XBTEUR @ limit 80.0'},
'txid': ['POTATO-POTATO-POTATO']}} However, checking the order on Kraken (and also via the API This is because |
Marking issue as upstream, due to their outdated/misleading docs; nothing to do on this end. Still, note you're using improper syntax, too. This "works", showing that the provided In [77]: kraken.query_private('AddOrder', data={'pair': 'XXBTZEUR',
...: 'type': 'buy',
...: 'ordertype': 'limit',
...: 'price': '90.0',
...: 'volume': '0.01',
...: 'close[ordertype]': 'stop-loss-profit',
...: 'close[price]': '80.0',
...: 'close[price2]': '100.0'
...: })
Out[77]: {'error': ['EGeneral:Invalid arguments:/close-ordertype']} As to the nature of the rather-misleading error... {
"error": [
"EAPI:Invalid key"
]
} This is probably because the nested |
Versions
What are you trying to achieve?
Place buy 'limit' order with a closing 'stop-loss-profit' order.
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.
The text was updated successfully, but these errors were encountered: