Description
The place_order() method on the main branch includes the market_protection parameter, but the latest PyPI release (kiteconnect==5.1.0) does not include it.
This causes all market orders placed via the API to fail with the following error:
"Market orders without market protection are not allowed via API. Please set market_protection or use a limit order."
Steps to Reproduce
- Install the latest release from PyPI:
pip install kiteconnect==5.1.0
- Attempt to place a market order:
kite.place_order(
variety=kite.VARIETY_REGULAR,
exchange=kite.EXCHANGE_NSE,
tradingsymbol="RELIANCE",
transaction_type=kite.TRANSACTION_TYPE_BUY,
quantity=1,
product=kite.PRODUCT_MIS,
order_type=kite.ORDER_TYPE_MARKET,
)
- Order fails with the error above because market_protection cannot be passed.
Expected Behavior
The place_order() method should accept the market_protection parameter (as it does on the main branch), allowing market orders to be placed successfully via the API.
Actual Behavior
The market_protection parameter is absent in the PyPI release (v5.1.0), so there is no way to set it. Market orders are rejected by the Kite API.
Root Cause
The main branch signature includes market_protection:
python
def place_order(self,
variety,
exchange,
tradingsymbol,
transaction_type,
quantity,
product,
order_type,
price=None,
validity=None,
validity_ttl=None,
disclosed_quantity=None,
trigger_price=None,
iceberg_legs=None,
iceberg_quantity=None,
auction_number=None,
tag=None,
market_protection=None): # ← present on main
But this change has not been published to PyPI. The latest release 5.1.0 still lacks this parameter.
Workaround
Currently, the only workarounds are:
Install directly from the main branch: pip install git+https://github.com/zerodha/pykiteconnect.git
Use LIMIT orders instead of MARKET orders
Environment
kiteconnect version: 5.1.0 (PyPI)
Python version: 3.x
OS: Windows
Description
The
place_order()method on themainbranch includes themarket_protectionparameter, but the latest PyPI release (kiteconnect==5.1.0) does not include it.This causes all market orders placed via the API to fail with the following error:
Steps to Reproduce
kite.place_order( variety=kite.VARIETY_REGULAR, exchange=kite.EXCHANGE_NSE, tradingsymbol="RELIANCE", transaction_type=kite.TRANSACTION_TYPE_BUY, quantity=1, product=kite.PRODUCT_MIS, order_type=kite.ORDER_TYPE_MARKET, )Expected Behavior
The place_order() method should accept the market_protection parameter (as it does on the main branch), allowing market orders to be placed successfully via the API.
Actual Behavior
The market_protection parameter is absent in the PyPI release (v5.1.0), so there is no way to set it. Market orders are rejected by the Kite API.
Root Cause
The main branch signature includes market_protection:
python def place_order(self, variety, exchange, tradingsymbol, transaction_type, quantity, product, order_type, price=None, validity=None, validity_ttl=None, disclosed_quantity=None, trigger_price=None, iceberg_legs=None, iceberg_quantity=None, auction_number=None, tag=None, market_protection=None): # ← present on mainBut this change has not been published to PyPI. The latest release 5.1.0 still lacks this parameter.
Workaround
Currently, the only workarounds are:
Install directly from the main branch: pip install git+https://github.com/zerodha/pykiteconnect.git
Use LIMIT orders instead of MARKET orders
Environment
kiteconnect version: 5.1.0 (PyPI)
Python version: 3.x
OS: Windows