kite.positions not giving correct values. I read already in the forum that we need to maintain buy and sell and calculate PnL accordingly. But it's not my case. I am basically a discretionary trader. I only want to use algo script for the emergency portfolio SL. So, I will be entering trades manually but if in case some unexpected event happens and loss goes greater than 2%, I need to square it all. So, I am trying to poll using kite.positions and calculating PnL. But it was giving old value and not real-time value. how to handle this case? Entry manually but emergency SL using algo.
I already read this. I am not entering orders through the script, so I can't know the buy price. You mean to say get the buy price from kite.positions once and then get LTP of each and calculate at my end? LTP will be coming live right?
You can read more about it here.
If you are trying to place stoploss then I would suggest using GTT.
I am not entering orders through the script, so I can't know the buy price.
You mean to say get the buy price from kite.positions once and then get LTP of each and calculate at my end?
LTP will be coming live right?
Currently I am getting live price in python using:
url = "https://api.kite.trade/quote/ohlc?api_key=" + api_key + "&access_token=" + access_token + "&i=NFO:" + symbol
res = requests.get(url)
data=res.json()
Are you talking about the same? or any better way than this?