API market_protection parameter — clarification needed on correct usage

Hi,

I am running an automated algo trading bot for CNC delivery orders on NIFTYBEES (NSE) using the KiteConnect Python SDK. I ran into a sequence of errors today and wanted to document what happened and ask for clarification on the correct usage of market_protection.

What happened:

My first few API order attempts were rejected with:

“Market orders without market protection are not allowed via API. Please set market protection or use a Limit order.”

After adding market_protection to the order, I received:

“Invalid request (failed to decode market_protection, got: True (expected decimal))”

This told me the parameter expects a decimal value, not a boolean. I updated it to market_protection=1.0 (i.e. 1% protection band) and the orders went through successfully.

The code that worked:

order_id = kite.place_order(
    variety          = KiteConnect.VARIETY_REGULAR,
    exchange         = "NSE",
    tradingsymbol    = "NIFTYBEES",
    transaction_type = KiteConnect.TRANSACTION_TYPE_BUY,
    quantity         = 73,
    product          = KiteConnect.PRODUCT_CNC,
    order_type       = KiteConnect.ORDER_TYPE_MARKET,
    market_protection = 1.0,
)

My questions:

  1. Is 1.0 (1%) the correct and recommended value for market_protection on equity CNC market orders, or is there a different recommended value?

  2. The KiteConnect SDK documentation does not clearly document the expected type and range for market_protection. Could this be updated?

  3. I received an automated IVR call to my account holder’s registered mobile number citing issues with order protection. Since the successful orders used market_protection=1.0 and both filled completely, can you confirm whether the IVR was triggered by the earlier failed attempts (before the fix) or if there is still an outstanding issue with my orders?

Both orders executed today show COMPLETE status in the Zerodha app with full 73/73 quantity filled, so I believe the fix is correct — but would appreciate official confirmation.

Thank you.

#kiteconnect #api

This was done not via the account mapped to this profile’s email address but via account ID IBU639.

@nivas_k @Sravanthi_Bh

You can use -1 for the automatic market protection applied by the system, or use the values greater than 0 and up to 100 for Custom market protection percentage(e.g., 2 means 2% protection, 10 means 10% protection). Learn more.

This will be updated shortly.

Could you please create a ticket at http://support.zerodha.com with details of the issue so we can check this? If you have already created the ticket, please DM us the ticket number.

Additionally, we have a dedicated forum for Kite Connect API-related queries. We encourage you to post any future questions or concerns there.