Price already below GTT stop loss price by the time the order is placed

sensexboy edited July 2022 in Python client
Hi All,

Yesterday, I observed a behavior and wanted to check if anyone has any ideas on how can we go about preventing it.
So yesterday after I placed a order for a buy, i simultaneously placed a GTT order to sell at a stop loss of (buy price - 5) and trigger of buy_price + 10. What I saw was that by the time the code placed the GTT, the quote price of the stock was already buy_price - 7 and so the GTT order didnt trigger at all and the loss continue to mount. I didnt realize the trigger price has to be crossed and even if the value if less than the stop loss trigger price it wont get executed.

Options to handle this:

a) I was thinking to place another GTT with the original one where the stop loss would be a bigger buy_price - 10 types and hope to catch the above scenario. Though the problem is its not full proof (if the fall is more than 10 by the time i place) and also once the original GTT gets executed then this one stays open and can interfere with future trades unless i cancel it (more logic and complexity)

b) find the latest price again before placing the GTT order and see if the quote price is above the stop loss then place else exit the position by placing sell trade with the latest price. This seems to be better but price movements can be super fast thus again making this trade not catch the falling price.

Any suggestions ?
  • rakeshr
    Your option b seems more apt to me as per your requirement. You can have the condition before placing GTT to check for current price/ltp w.r.t your desired stop loss and target price and place a counter market order for the same.
    price movements can be super fast thus again making this trade not catch the falling price
    Yes, market order execution comes at the cost of slippage.
  • sensexboy
    thanks rakeshhr!
This discussion has been closed.