How to place a GTT order using API in node

    const requestData = {
                quantity: 25,
                product: "D",
                validity: "DAY",
                price: 0,
                tag: "string",
                instrument_token: "NSE_FO|41296",
                order_type: "MARKET",
                transaction_type: "BUY",
                disclosed_quantity: 0,
                trigger_price: 0,
                is_amo: false
            };

buy using this code i placed order but i wanna add a target order and stop lose order
after the above order placed in node.js

Currently, it is not possible to place a GTT (Good Till Triggered) order via API v2. We are actively working on enabling GTT functionality within the V2 API. Updates will be provided to you as soon as it becomes available.

In the meantime, you can still manage your trades by placing a buy order followed by a stop-loss (sell) order.

let say i wanna place order if ltp is 100

so my target is to sell if that ltp becomes 110
and also i wanna sell if ltp becomes 90

give me idea of how can i do this using node.js

You can achieve the above mentioned example as follows

  1. place a limit sell order with price of 110 (target sell order)
  2. place a stop loss sell order with trigger price of 90.

For details on place order have a look at Place Order , also you can refer Example codes for implementations

for suppose my position option buy CE is running at 90s

if(ltp> 100){
close order
}

if(ltp<80){
close order
}

for closing order:

can i use this cancel order to exit/square off of position

Cancel order API is used to cancel an open or pending which can be applied to both After Market Orders (AMO) and regular orders, for more information please refer this Cancel Order API
To exit/square off a position you need to place an order of opposite leg.

@Ketan what is the timeline when we can expect gtt orders via upstox api v2

@Anand_Yadav This item is currently in our backlog and will be scheduled for development soon. While we do not have an exact ETA at the moment, we will notify you once it has been selected for development.

1 Like

But will this method will work for option buyers , if we bought and option premium lets say for 100 INR, So can we place a sell order at 90 INR which can act as a stop loss and then modify it as the price increases, just not sure if we need a quite a large margin for this as it might be considered as a new and fresh sell order. kindly put some light in this direction.

@Gaurav_Chouhan I think you can use this and large margin may not be required for this as you already hv a position on the buy side

Bro today my script created an buy signal for a option CE for nifty 50 and then SL-M order request was sent initially, but it was unsuccessful with the comment SL-M order not allowed for this script.
Then i used Market order which was successfully placed giving response of 200, and i had a open position, then from mobile app i tried to sell the same Nifty 50 CE option with same quantity but not squaring it off or closing the position and it was showing that i need a huge margin. and moreover if i am selling then if its considering my position then there should not be any capital at all required. please share if you have some insight on this or any idea what could be the issue here.

When we can place a GTT order? Zerodha is providing this service using API. if you canā€™t able to do it by next 1 week then I have to move my Demat account from Upstox to Zerodh

Hi @pratik9722,

We are happy to let you know that we are already working on this feature and it should be available in the next couple of months.

We will update it here once it is live! Appreciate your patience, thanks.

Hello,

Any timeline for this functionality availablity?

Thanks and Regards,
Arun

@Arunachalam_Sakthive