Place a CNC market SELL order

order_id = kite.place_order(
    variety="regular",
    exchange="NSE",
    tradingsymbol="INFY",
    transaction_type="SELL",
    quantity=1,
    product="CNC",
    order_type="MARKET",
    validity="DAY",
)

Only the transaction_type changed from chapter 44 — but a CNC sell has a constraint a CNC buy doesn't: you can only sell what's actually in your demat holdings (chapter 15), and specifically only the settled quantity, not t1_quantity, unless your broker explicitly supports BTST product handling.

Guard against selling more than you hold

def safe_cnc_sell(kite, exchange: str, symbol: str, qty: int) -> str:
    holdings = kite.holdings()
    held = next((h for h in holdings if h["tradingsymbol"] == symbol), None)
    available_qty = held["quantity"] if held else 0
    if qty > available_qty:
        raise RuntimeError(
            f"Attempting to sell {qty} of {symbol}, only {available_qty} settled and sellable"
        )
    return kite.place_order(
        variety="regular", exchange=exchange, tradingsymbol=symbol,
        transaction_type="SELL", quantity=qty, product="CNC",
        order_type="MARKET", validity="DAY",
    )

What happens if you oversell anyway

The exchange/broker rejects a "short sell" attempt in the CNC product (you cannot short equity delivery in India — short selling is only allowed intraday, via MIS, and must be squared off same day). If your code doesn't pre-check and just fires the order, you'll get an OrderException at placement time — handle it (chapter 57) rather than letting your bot crash on rejection.

Selling immediately after a same-day buy

If you bought via CNC this morning and try to sell before it settles, the sale executes against t1_quantity, which some brokers restrict or flag differently in the order flow (BTST rules and same-day-sell auction risk vary by broker) — check your broker's specific handling before relying on same-day round-trips through the CNC product; MIS (chapter 48) is the correct product for genuine intraday round-trips.

Next: 046 — Place a CNC limit BUY order