'python cctx Kucoin futures take profit
I´m using ccxt on python to make a bot with Kucoin. Is there a way to make a Kucoin futures Order with take profit. take and order is easy
kucoin_futures.create_order('XBTUSDTM', "market", "buy", 1, None, {'leverage': 1})
but not a way to add take profit to order
thanks....
Solution 1:[1]
For take profit, create a limit order with same size, opposite side and 'reduceOnly':true parameter.
def setTp(exchange, symbol: str, side: str, size: int, tp: float):
params = dict(reduceOnly=True)
side = 'sell' if side=='buy' else 'buy'
try:
res = exchange.createOrder(symbol, 'limit', side, size, price=tp, params=params)
return res
except Exception as e:
print(e)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | A.Dadkhah |
