Patrick Dillon
Patrick Dillon

Reputation: 1

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

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?

Upvotes: 0

Views: 735

Answers (2)

Benjamin Gichuru
Benjamin Gichuru

Reputation: 1

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))

Upvotes: 0

Behzad
Behzad

Reputation: 1

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

Upvotes: 0

Related Questions