The Problems with Straddle Bot - Alice Blue Python API

Straddle Bot’s primary objective is to close the order if 20% per leg stop loss is breached.

But,

If you execute 100 accounts at market price then the prices will be different.

So,

The next possible solution is to read from the position and see the “Avg Price” of the trade that is executed right?

But,

What if, The customer or Another strategy has taken a trade on the same strike price?

Then,

It will show different “Avg Price” which will be deceptive.

So,

The another way is to do is to read the orderbook. When you fire an order you get the orderID. The response looks like -

{"status":"success","message":"Order placed successfully","data":{"oms_order_id":"200711000002290"}}

We can extract order_id and use the order history module to check the past history of the order. The price at which it will be executed. It should be there, right? Refer - https://antplus.aliceblueonline.com/#order-history

But I got this instead -

   "status":"success",
   "message":"",
   "data":[
      {
         "validity":null,
         "trigger_price":0.0,
         "transaction_type":"B",
         "trading_symbol":"BANKNIFTY2072321500PE",
         "rejection_reason":"RMS:Bad Input",
         "quantity":40,
         "product":"NRML",
         "price_to_fill":0.0,
         "order_status":"rejected",
         "oms_order_id":"200711000002290",
         "nest_request_id":null,
         "filled_quantity":0,
         "exchange_time":"--",
         "exchange_order_id":null,
         "exchange":"NFO",
         "disclosed_quantity":"0",
         "client_id":"WBK293",
         "average_price":0.0
      },
      {
         "validity":null,
         "trigger_price":0.0,
         "transaction_type":"B",
         "trading_symbol":"BANKNIFTY2072321500PE",
         "rejection_reason":"--",
         "quantity":40,
         "product":"NRML",
         "price_to_fill":0.0,
         "order_status":"validation pending",
         "oms_order_id":"200711000002290",
         "nest_request_id":null,
         "filled_quantity":0,
         "exchange_time":"--",
         "exchange_order_id":null,
         "exchange":"NFO",
         "disclosed_quantity":"0",
         "client_id":"WBK293",
         "average_price":0.0
      },
      {
         "validity":null,
         "trigger_price":0.0,
         "transaction_type":"B",
         "trading_symbol":"BANKNIFTY2072321500PE",
         "rejection_reason":"--",
         "quantity":40,
         "product":"NRML",
         "price_to_fill":0.0,
         "order_status":"put order req received",
         "oms_order_id":"200711000002290",
         "nest_request_id":null,
         "filled_quantity":0,
         "exchange_time":"--",
         "exchange_order_id":null,
         "exchange":"NFO",
         "disclosed_quantity":"0",
         "client_id":"WBK293",
         "average_price":0.0
      },
      {
         "validity":null,
         "trigger_price":0.0,
         "transaction_type":"S",
         "trading_symbol":"CRUDEOIL20JUL3200CE",
         "rejection_reason":"error user/user_target not logged in",
         "quantity":1,
         "product":"NRML",
         "price_to_fill":0.0,
         "order_status":"rejected",
         "oms_order_id":"200711000002290",
         "nest_request_id":null,
         "filled_quantity":0,
         "exchange_time":"--",
         "exchange_order_id":null,
         "exchange":"MCX",
         "disclosed_quantity":"0",
         "client_id":"WBK293",
         "average_price":0.0
      },
      {
         "validity":null,
         "trigger_price":0.0,
         "transaction_type":"S",
         "trading_symbol":"CRUDEOIL20JUL3200CE",
         "rejection_reason":"--",
         "quantity":1,
         "product":"NRML",
         "price_to_fill":0.0,
         "order_status":"put order req received",
         "oms_order_id":"200711000002290",
         "nest_request_id":null,
         "filled_quantity":0,
         "exchange_time":"--",
         "exchange_order_id":null,
         "exchange":"MCX",
         "disclosed_quantity":"0",
         "client_id":"WBK293",
         "average_price":0.0
      }
   ]
}

If you see at the downside, You can find that there is a CrudeOil order out of nowhere. The primary question here is - Why there is a stupid Crude Oil doing inside on a BankNIFTY order?

Do note - That this Crude Oil Order does not shows in the Aliceblue Orders page at all.

what about putting a SL-M order immediately ?

In Initial,

Lets think You sold x PE at 100. But in another account You have it sold at 98 ot 102. Because of Slippage.

Now the 20% SL will be based on 100. So, it changes the dynamics dynamically.