How to cancel an order?
Versions
OS: Linux
Python: 3
krakenex:
What are you trying to achieve?
To cancel an order that was not executed.
I managed to buy with the code below. I want the same to cancel an order. Where's the documentation about what query_private() can accept as arguments instead of AddOrder?
# code sample
k.query_private('AddOrder',
{'pair': tradepair,
'type': 'buy',
'ordertype': 'limit',
'price': buy_price,
'volume': volume_units,
# only `ordertype`, `price` and `price2` are valid
'close[ordertype]': 'limit',
'close[price]': sell_price,
# these will be ignored!
'close[pair]': tradepair,
'close[type]': 'sell',
'close[volume]': volume_units})
What do you expect to happen?
Order should be cancelled.
What happens instead?
# error message
Where's the documentation about what query_private() can accept as arguments instead of AddOrder?
For the most up-to-date list of public/private Kraken API methods, see their API documentation.
It will look something like:
kraken.query_private('CancelOrder', {'txid': 'ORDERS-GOES-HERESS'})
Where's the documentation about what query_private() can accept as arguments instead of AddOrder?
For the most up-to-date list of public/private Kraken API methods, see their API documentation.
It will look something like:
kraken.query_private('CancelOrder', {'txid': 'ORDERS-GOES-HERESS'})
Hi when I use this to cancel an order (using correct, known txid) I am getting the Error response Eorder: 'invalid order'
My keys are set to allow any activity so wondering if you could think what might cause this.
Happy to open a new question/thread if you prefer.
Thanks
@TOTANICS Check if the order is not closed already.
@TOTANICS Check if the order is not closed already.
I am running some code to test... the code first places an order. I am also logged into my orders page on Kraken.com and as the code runs I see the order place. The code pauses for a good while and then uses the txid which is given by the placed order, and uses this in a CancelOrder call. But the response I get is as I have described.
I am wondering if I need to have done something in the AddOrder code which I am not perhaps? If the close type parameter is not set for example, would this mean the order can't be canceled?
For example my AddOrder code only goes as far as
{'pair': tradepair,
'type': 'buy',
'ordertype': 'limit',
'price': buy_price,
'volume': volume_units,
I haven't specified Close ordertype as 'limit' as well. Does this seem the likely cause?
Thanks
@TOTANICS This is considerably more complex than this particular issue.
Do open a new issue then, with a full example script that can reliably reproduce the behaviour you describe.
@TOTANICS This is considerably more complex than this particular issue.
Do open a new issue then, with a full example script that can reliably reproduce the behaviour you describe.
Thank you, I have opened a new issue.
I'm having the same issue as mentioned above. Wonder if there is any solution or has answered in another thread?
Which one of the above?
Thank you, I have opened a new issue.
FTR, this was opened as https://github.com/veox/python3-krakenex/issues/110, and shortly closed by the author without explanation. :/