Bracket Order with Product Type MIS got rejected

Vishy
Hi,
I have a python client which places buy/Sell orders based on certain conditions.
Following is the python code that places Sell Order.

A Sell order as placed in Ultratech cement and it got rejected even though there was enough cash in account.


Could anyone help me understand the mistake in code? Folloing is the code
def PlaceSellOrder(trade,trading_symbol,low,high,price):
entry_price = price
exit_price = trade['stoploss'] # OR sell level + ATR
# profit_price = trade['Sell Price'] - (trade['stoploss'] - trade['Sell Price'])/2
# quantity = round(GetProfitLimit()/(trade['stoploss'] - trade['Sell Price']))
quantity = round(getNetWworthPerTrade()/trade['Sell Price'])
profit_price = trade['Sell Price'] - GetProfitLimit()/quantity
# quantity = 1 # for testing purpose
kite.place_order(variety = kite.VARIETY_BO,
exchange = kite.EXCHANGE_NSE,
tradingsymbol = trading_symbol,
transaction_type = kite.TRANSACTION_TYPE_SELL,
quantity = quantity,
product = kite.PRODUCT_MIS,
order_type = kite.ORDER_TYPE_LIMIT,
price = entry_price,
squareoff=profit_price,
stoploss=exit_price)
  • rakeshr
    @Vishy
    As the error states, there is insufficient margin availability.You can check both the available margin and required margin in the above rejection statement.
Sign In or Register to comment.