GetPosition is not having updated value.

vishwash_yadav
When i call GetPositions its always giving me value 10 -15 second old data.
For ex
In Terminal PNL is 100 at (10:20)
but through API getting 100 at (10:25)
Tagged:
  • sujith
    sujith edited January 2018
    Hi @vishwash_yadav,
    It is not recommended to poll positions for updated P&L. You need to calculate that at your end using this formula
    pnl = (sellValue - buyValue) + (netQuantity * lastPrice * multiplier);
  • vishwash_yadav
    In case of commodity or Future&Option how i can give multiplier
  • sujith
    You can use this formula for all the segments. We use the same formula on our platforms.
  • vishwash_yadav
    thanx a lot sujith for this.
  • vishwash_yadav
    vishwash_yadav edited February 2018
    Hi @sujith
    One more thing when i place Cover order and the time when it gets executed successfully, it places one more order for stoploss. How can i get order id of that order and how to exit that order.
  • sujith
    If you place a cover order with entry type market then it will be filled immediately. If you place a limit type cover order then it gets filled according to the availability of counterparty.
    In both the cases, the stop-loss order is placed immediately when you place the first leg order.
    Once you place a cover order, for successful placement you will get order id in the response which is the parent order id for the second leg order.
    In order to fetch second leg order, you need to fetch orderbook and look order with parent order id same as first order id.
  • sujith
    Please open a new thread for new queries. It will help others who are looking for the same.
This discussion has been closed.