Help with Placing Limit, Stop-Loss, and Target Orders for Options

Hi everyone,

I’m looking for guidance on placing a set of orders for an option using the Upstox API.

Here’s my scenario:

  • I want to place a limit order to buy the Nifty 25400 CE option when the price reaches ₹100 (current price is ₹93).
  • After the limit order is executed, I want to set a stop-loss order at ₹90 and a target order at ₹110.

Could someone guide me on the correct sequence of API calls and the order types I should use to achieve this?

I assume I’ll need to place:

  1. A limit buy order at ₹100.
  2. Once the order is executed, set a stop-loss at ₹90 and a target order at ₹110.

Should I use the SL (stop-loss) order type for the stop-loss and a simple limit order for the target? Also, do I need to use the GTT (Good Till Triggered) feature, or is there a more straightforward approach?

Any help or example code would be greatly appreciated!

Thanks in advance!

Hi @Praveen_Reddy

Yes your assumed method is right. While we’re working to ship GTT and TSL orders via API soon, the approach you mentioned should work good meanwhile.

Suggestion, during the placement of buy order, best of you could make it into and SL (stop-loss) order. And then just the Target order would be remaining once the buy order is executed.

1 Like

Call-out: you intend to place two option sell orders basically, which would required much higher margin than option buy order.

Let us assume that selling option requires 10x margin, and you are working with 1 lot (25 units). So, your stop loss and target orders will require:-

Limit order margin = 25 x 100 = 2,500

Stop loss margin = 90 x 25 x 10 = 22,500
Target margin = 110 x 25 x 10 = 27,500
Total margin requirement for selling orders = 50,000

Also, don’t forget cancel stop loss order once your target order is executed and vice-versa. And rmemeber, 10x sell margin is just an example I took for ease of calculation! It may be more.

Also, keep programmatically monitoring if your stop loss order is missed due to a sudden large drop in price.

@MohitGolecha : please confirm if this is correct. If not please help explain so that I can also benefit. Target and stop loss selling margins is what has stopped me from going this route and wait for the GTT / suare off APIs.