Place a CNC limit BUY order

A limit order specifies the worst price you're willing to accept — it will fill at that price or better, or not at all.

order_id = kite.place_order(
    variety="regular",
    exchange="NSE",
    tradingsymbol="INFY",
    transaction_type="BUY",
    quantity=10,
    product="CNC",
    order_type="LIMIT",
    price=1470.00,       # will not buy above this price
    validity="DAY",
)

Price must be a valid tick

def round_to_tick(price: float, tick_size: float) -> float:
    return round(round(price / tick_size) * tick_size, 2)

limit_price = round_to_tick(1470.03, tick_size=0.05)   # -> 1470.05

Sending an unrounded price (e.g. 1470.03 when tick_size=0.05) is rejected by the exchange — always fetch tick_size from the instrument master (chapter 21) for the specific symbol and round before sending.

Limit price relative to current market — three outcomes

  1. At or above current ask — fills immediately (or near-immediately), behaving much like a market order but with price protection.
  2. Below current ask, above current bid — rests in the order book at your price, waiting for the market to come to you.
  3. At or below current bid, aggressively low — rests indefinitely (for a DAY validity, until end of day) unless price genuinely falls there — common mistake when the underlying has moved and your limit price is now stale.

Freshness check before placing

def place_limit_with_sanity_check(kite, exchange, symbol, qty, limit_price, tick_size, max_deviation_pct=2.0):
    ltp = kite.ltp([f"{exchange}:{symbol}"])[f"{exchange}:{symbol}"]["last_price"]
    deviation = abs(limit_price - ltp) / ltp * 100
    if deviation > max_deviation_pct:
        raise ValueError(f"Limit price {limit_price} is {deviation:.1f}% from LTP {ltp} — likely stale")
    return kite.place_order(
        variety="regular", exchange=exchange, tradingsymbol=symbol,
        transaction_type="BUY", quantity=qty, product="CNC",
        order_type="LIMIT", price=round_to_tick(limit_price, tick_size),
        validity="DAY",
    )

This guards against a common bug class: computing a limit price from a stale cached quote (chapter 42's staleness check applies here too) and sending an order that's wildly off current market.

Next: 047 — Place a CNC limit SELL order