pythonpyalgotrade

How can I place a Bracket Order in Angelone Smartapi


I have following method -

def place_order(token,symbol,qty,buy_sell,ordertype,price,variety= 'NORMAL',exch_seg='NSE',triggerprice=0):
    try:
        orderparams = {
            "variety": variety,
            "tradingsymbol": symbol,
            "symboltoken": token,
            "transactiontype": buy_sell,
            "exchange": exch_seg,
            "ordertype": ordertype,
            "producttype": "INTRADAY",
            "duration": "DAY",
            "price": price,
            "squareoff": "0",
            "stoploss": "0",
            "quantity": qty,
            "triggerprice":triggerprice
            }
        orderId = costantine.SMART_API_OBJ.placeOrder(orderparams)
        print(f"The instrument {symbol} order id is: {orderId}")
    except Exception as e:
        print(f'instrument {symbol} Order placement failed:  {e}')

All available data I can gather is from below text

I had tried following call

place_orderX('ROBO', instrument, symboltoken, 1 , "BUY", "LIMIT", 'BO', ltp, slDelta, targetDelta,slDelta)

BO order is rejected due to below error - "BO is not allowed for this stock. Kindly place an order with a different product type." I am stuck here


Solution

  • The API call actually placing the BO order , above code is actually working fine .

    But main issue is that some symbol does not support BO order and while placing the order need to careful about the symbol to trade. Only for those symbols BO order will be rejected due to below error - "BO is not allowed for this stock. Kindly place an order with a different product type."

    I am searching for a list which consists of BO order compatible symbols but not able to find till now.