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

How to cancel an order? #85

Open
dtlink opened this issue Feb 8, 2018 · 8 comments
Open

How to cancel an order? #85

dtlink opened this issue Feb 8, 2018 · 8 comments
Labels

Comments

@dtlink
Copy link

dtlink commented Feb 8, 2018

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
@veox
Copy link
Owner

veox commented Feb 9, 2018

Where's the documentation about what query_private() can accept as arguments instead of AddOrder?

From the README:

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'})

@veox veox added the question label Feb 9, 2018
@veox veox changed the title Cancel order How to cancel an order? Feb 9, 2018
@TOTANICS
Copy link

Where's the documentation about what query_private() can accept as arguments instead of AddOrder?

From the README:

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

@veox
Copy link
Owner

veox commented Dec 21, 2018

@TOTANICS Check if the order is not closed already.

@TOTANICS
Copy link

@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

@veox
Copy link
Owner

veox commented Dec 21, 2018

@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
Copy link

@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.

@Juik
Copy link

Juik commented Apr 13, 2020

I'm having the same issue as mentioned above. Wonder if there is any solution or has answered in another thread?

@veox
Copy link
Owner

veox commented Apr 17, 2020

Which one of the above?


Thank you, I have opened a new issue.

FTR, this was opened as #110, and shortly closed by the author without explanation. :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants