ccxt / ccxt

A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading API with support for more than 100 bitcoin/altcoin exchanges
https://docs.ccxt.com
MIT License
32.98k stars 7.53k forks source link

Bybit integrated take profit on limit position. #15940

Open Gorgias26 opened 1 year ago

Gorgias26 commented 1 year ago

Hello all, I'm looking for a solution to put limit positions in queue with their integrated take profit.

It's been 5 hours that I'm trying things by searching on the internet, and impossible to get there.

Manually it's very easy to do : Image1

but impossible to reproduce this with CCXT.

The only thing I found was this:

params = {'stop_px': TP2, 'base_price':ticker}

but it doesn't do at all what I'm looking for: Image2

So if you have the solution to my problem, I will be eternally grateful ;)

good day all.

carlosmiei commented 1 year ago

Hello @Gorgias26, That should be very easy to set, can you try to do something like this?

Example:

params = {
    "stopLossPrice":38,
    "takeProfitPrice":99
}
order = await bybit.create_order("LTC/USDT:USDT", "limit", "buy", 2.5, 40, params),
Gorgias26 commented 1 year ago

Thank you very much for the answer, I just tried it, but I have the impression that it does not put the SL and TP.

I think I should update my CCXT which is old if not. But on my other computer, I found that ccxt didn't work at all after the update. Even after uninstalling and restarting CCXT an old version of CCXT. I don't dare to do it again on this PC.

I'll try it on a virtual machine this afternoon.

thinks you agains for your answer !

image1 image2

Gorgias26 commented 1 year ago

well I did the ccxt update and solved several problems due to the update, but I still can't do the TP/SP.

When I use this, I have a price problem

params = {
    "stopLossPrice":0.01,
    "takeProfitPrice":0.1
}
order = bybit.create_order(symbol, "limit", "buy", 1, 0.02, params)

Ereur

on the other hand when I put in shorts, it puts me a trigger order, and without TP/SL

resultat

Yet my numbers are good for being in a long and not in a short.

frosty00 commented 1 year ago

@Georgias

make sure the price is of the stopLossPrice is above the market price for a buy order