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

KUCOIN create stop limit doesnt work properly #22314

Closed
incafox opened this issue Apr 27, 2024 · 5 comments
Closed

KUCOIN create stop limit doesnt work properly #22314

incafox opened this issue Apr 27, 2024 · 5 comments
Assignees
Labels

Comments

@incafox
Copy link

incafox commented Apr 27, 2024

Operating System

mac

Programming Languages

python

CCXT Version

4.2.74

Description

Hi, when im using Kucoin web I can put a stop - limit order with a trigger condition (enter price, bigger than the current price) but using stop-limit in ccxt always ends buying/entering at the current/last price, how can I put an order with a trigger condition using ccxt?.

pic: stop - limit order with trigegr condition using kucoin web
image

Code

  
long_price = (1.3) * last 
short_price = (3) * last

result = exchange.create_stop_limit_order(
        "DPET/USDT", 
        side='buy', 
        amount=100,
        price=short_price,
        stopPrice=long_price,
         )

@incafox incafox changed the title KUcoi KUCOIN create stop limit doesnt work properly Apr 27, 2024
@carlosmiei carlosmiei self-assigned this Apr 28, 2024
@carlosmiei
Copy link
Collaborator

Hello @incafox,
I don't see that option in the WEB UI, so I think it follows the same logic as the API

If the stopPrice is smaller than the current price then the condition will be trigger <=stopPrice, otherwise >=stopPrice

image

@incafox
Copy link
Author

incafox commented Apr 28, 2024

hello @carlosmiei here in this example using the WEB UI you can see the current price is 0.05396 and I created an Buy Stop-Limit order with stop price->0.06 , price->0.1. So the trigger condition to buy 100 DPET is if the current price >= 0.06 and sell condition is 0.1, you can see that in advanced orders section (screenshot).

Place Order x Pasted Graphic 1

Im trying to do the same with CCXT-Kucoin :

long_price = (1.3) * current_price 
short_price = (3) * current_price

result = exchange.create_stop_limit_order(
        "DPET/USDT", 
        side='buy', 
        amount=100,
        price=short_price,
        stopPrice=long_price
)

So using my example above the enter price(long_price) should be 1.3 * 0.05396 = 0.0701 and short_price = 3 * 0.05396 = 0.161, but unfortunately create_stop_limit_order is buying instantly at the current price instead of setting a trigger condition correctly.

@carlosmiei
Copy link
Collaborator

carlosmiei commented Apr 29, 2024

@incafox Ok I think I managed to reproduce the issue, can you please try to provide stop:entry in params?

result = exchange.create_stop_limit_order(
        "DPET/USDT", 
        side='buy', 
        amount=100,
        price=short_price,
        stopPrice=long_price,
        {"stop": "entry"}
)

Iif we don't provide it, it will default to loss and execute if the price <= 0.06 instead of >= 0.06.

@carlosmiei
Copy link
Collaborator

@incafox I think the problem is resolved, so I will close this issue but feel free to reopen it if anything!

@incafox
Copy link
Author

incafox commented Apr 29, 2024

thank you @carlosmiei !

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

2 participants