Please add DateTime stamp in portfolio/positions JSON

ramatius
Hi,
Can you pls add a DateTime field in the JSON returned by https://api.kite.trade/portfolio/positions ? This will help in properly timestamping the m2m entries. Right now we are using our server's DateTime, which may not match up with Kite server's DateTime. This will cause issues in building m2m candles with respect to tick data.
  • sujith
    It doesn't make sense what timestamp are you expecting? Timestamp of when a position is created?
  • ramatius
    Timestamp when m2m is calculated.
  • sudhirshettyk
    @Sujith , one place i too find this useful is to "consolidate" my local database post a local interruption at my end. Say , i have been placing orders and simultaenously record i record on my local database . Against each of these entries i perform separate confirmation on order being placed at your server etc. Accordingly i make a entry to my portfolio records.
    Now say my machine/cloud server crashed. When i recover (say immediately, or post midnight when you are doing your dayend;before or after it etc) , i would do first check to consolidate holdings+positions with my local database , perge closed orders etc. In this case having timestamp against the records in positions helps to do certain sanity check , determine if it is a non-consolidated record etc.
    There may be other and better ways to achieve this , but timestamp is one good datapoint that is useful to do sanity checks.
  • sujith
    wait what you are polling positions to just get latest m2m. You can just calculate it at your end.
    It is equal to P&L for intraday positions and (close price - last price) for overnight positions.

    You check out the formula for calculating P&L here.
  • ramatius
    If Kite is providing m2m for everything, why should it be recalculated (especially if trade volume is high)? Also, Kite's m2m would be the closest to reality and also displayed in kiteweb for all users. So it makes sense to get it directly from api.
  • sujith
    We definitely don't recommend polling and we do calculate it in the same way as mentioned above.
    For real-time calculation of m2m you can use websockets to fetch live last price and calculate at your end.
    I am afraid we can't add the timestamp for positions response.
This discussion has been closed.