sammchardy / python-kucoin

Kucoin REST and Websocket API python implementation
https://python-kucoin.readthedocs.io/en/latest/
MIT License
352 stars 148 forks source link

Cancel_Order Fails on PIP 0.1.7 #10

Closed arenstar closed 5 years ago

arenstar commented 6 years ago

I recieve on a cancel_order

404 SYMBOL NOT FOUND

so reverted to 0.1.0

sammchardy commented 6 years ago

Hi @arenstar can you update to v0.1.8 and try again.

If it's still failing can you give an example of how you're calling it.

h3ct0rjs commented 6 years ago

What symbol are you trying ?

Djusk8 commented 6 years ago

Have the same problem Python 3.6 Python-kucoin v0.1.8 PIP 9.0.1 (I'll try v 0.1.0 later)

try1 open_curr2_orders = client.get_activeorders(pair) #pair = 'CAG-BTC'_ active_buy_order = open_curr2orders['BUY'][0][5] # active_buyorder = '5a658ecc36918d53e9ffa00f' client.cancel_order(active_buy_order, 'BUY')

get error b'{"timestamp":1516607937246,"status":404,"error":"Not Found","message":"No message available","path":"/cancel-order"}'

_try2 open_curr2_orders = client.get_activeorders(pair) #pair = 'CAG-BTC'_ active_buy_order = open_curr2orders['BUY'][0][5] # active_buyorder = '5a658ecc36918d53e9ffa00f' client.cancel_order(active_buyorder, 'BUY', curr2) # curr2 = 'CAG'_

get error KucoinAPIException ERROR: SYMBOL NOT FOUND

sammchardy commented 6 years ago

@Djusk8 I wasn't sure if the Not Found meant it couldn't find the order_id, if that's not the case then it means the symbol/pair is required and I need to enforce that. So many parameters when just an order_id should be all you need...

In your second example you just pass 'CAG' which is incorrect, it should be your pair value of 'CAG-BTC', can you try that.

Djusk8 commented 6 years ago

Yes, I have 2 different errors:

v1 (w/o symbol/pair) - can't find order_id v2 (w symbol pair) - can't find SYMBOL

v3

                    open_curr2_orders = client.get_active_orders(pair)  # {'SELL': [], 'BUY': [[1516605133000, 'BUY', 5.085e-05, 19.665683, 0.0, '5a658ecc36918d53e9ffa00f']]}
                    active_buy_order = open_curr2_orders['BUY'][0][5]  # '5a658ecc36918d53e9ffa00f'

                    # v1
                    #  client.cancel_order(active_buy_order, Client.SIDE_BUY)
                    # v2
                    #  client.cancel_order(active_buy_order, 'BUY', curr2)
                    # v3
                    client.cancel_order(active_buy_order, 'BUY', 'CAG-BTC')

error KucoinAPIException ERROR: SYMBOL NOT FOUND

Actually I need to cancel order by it's Oid (v1), but when I get the error I tryed another variations of this command and found that its not working with any parameters.

Djusk8 commented 6 years ago

Downgrade Python-kucoin to 0.1.7 and try

                    # v2
                    client.cancel_order(active_buy_order, pair, 'BUY')  # pair = "CAG-BTC"

And it's work well

Djusk8 commented 6 years ago

I think i just found the problem! :)

Check your documentation at https://python-kucoin.readthedocs.io/en/latest/trading.html

description: cancel_order(order_id, order_type, symbol=None)

sample: client.cancel_order(1, 'KCS-BTC', 'BUY')

Now it's working well, so I think issue can be closed

h3ct0rjs commented 6 years ago

I've tested that @Djusk8 , it works like a charm.

Thank you

sammchardy commented 5 years ago

Closing because of new API version