I am trying to place a limit order with a stop loss in python with the kucoin api

467 Views Asked by At

There doesn't seem to be an endpoint for an OCO order or stop limit order in the kucoin api. I can place the stop loss order as a limit order but it is never fulfilled as the funds are held up in the limit sell order. Has anyone found a way around this?

2

There are 2 best solutions below

0
Behzad On

KuCoin API doesn't support OCO orders yet, but you can place your order normally then use STOP orders for your stop loss or take profit orders, and STOP orders doesn't freeze assets, so you're good to go.

Place a new order: https://docs.kucoin.com/#place-a-new-order Place a stop order for stop loss / take profit: https://docs.kucoin.com/#stop-order

0
Benjamin Gichuru On
def set_stoploss(symbol,side,lever,size,price):
    try:
        return client_trade.create_limit_order(symbol=symbol,side=side,lever=lever, size=size,price=price,stopPrice=price,stop='down',stopPriceType='TP',reduceOnly=True)
    except Exception as e:
        print('set_stoploss()::  '+str(e))

print(set_stoploss("LUNCUSDTM",'buy',90,1,0.00014))