@xameeramir Calculating change from open is not the right way, you will get the change only from open. To get change from previous close, you need to calc using close.
@kiteapi, The earlier version of the Quote API was doing the calculation while sending the response. I think in the newer version it is not done. I have asked the concerned team if they can do something about this. But still, it is a very small change that can be handled at the client's end. For a very long time, the net change is being calculated at the Kite Connect libraries (locally). I think only for indices the value is coming from the Kite Ticker.
@xameeramir, The net_change used on the trading platforms usually means the difference between the last traded price and the previous day close AFAIK. In European markets, I guess the change value is displayed based on the open price of the day. It is up to your use case. Kite also offers a setting where a user can view change based on open price.
@sujith thanks for ack'ing that this is a bug or feature that has broken, which was working fine earlier.
While clients can handle it, I was doing a search yesterday regarding this, there are lots of users who trade intraday based on gainers/losers, and for this purpose they need net_change, but not historically, if they get net_change in todays quote data, that is just fine for them, that means they do not have to store yesterdays data in DB/CSV. They may just need data for NIFTY50, but sometimes they need more as the list changes, so they invariably need to download for at least NIFTY500 (does not make sense) and store it and churn it.
Let me give my example, as you know am trying to build options_chain using API and net_change is missing, so everyday I need to store LTP in the evening for 25k - 35k NFP-OPT instruments (And if I get net_change for those options quotes, I dont need to store in DB too, if not I need to do it.), that is just current month expiry. Am sure you guys can easily handle this and I can easily dump the data everyday in DB/CSV (and keep churning). And this is just me, if lot of people do this (definitely your servers wont even feel a glitch with this load, as this is nothing), but does not make sense for a feature that was working fine earlier and now broken, you still have the field in the packet "net_change: 0" but zero all the time . And there are so many people asking for this, found it by searching "net_change"
I hope, like your said the concerned team would look into this and fix it.
No need to store anything, the close price you see in the quote api response is the previous day's close price. You shouldn't store last LTP of previous day and do the calculation since close price is published by the exchange in the BHAV copy after the settlement process.
Ah! my bad. I thought OHLC is todays OHLC (including close, same as LTP), thought you are providing that for easy candle re-creation. I checked a few scrips the OHL is for today, but the close in OHLC is yesterdays close which serves the purpose and I do not have to save anything
Oh! yea BTW, the net_change in NIFTY spot/index that you see is in points, not change percentage, am not sure what its supposed to have.
Change percentage is percentage change of LTP from the previous close which is,
change_percent = ((LTP - closePrice) * 100 / closePrice)
and absolute_change is the change of LTP from the previous close which is,
change = lastTradedPrice - closePrice
Also, I feel this is a bug with Zerodha or they stopped giving this data at some point of time, definitely not a bug with exchanges - net_change - my analysis - https://kite.trade/forum/discussion/8184/bug-in-net-change-in-quote-data#latest
The earlier version of the Quote API was doing the calculation while sending the response. I think in the newer version it is not done. I have asked the concerned team if they can do something about this.
But still, it is a very small change that can be handled at the client's end.
For a very long time, the net change is being calculated at the Kite Connect libraries (locally). I think only for indices the value is coming from the Kite Ticker.
@xameeramir,
The net_change used on the trading platforms usually means the difference between the last traded price and the previous day close AFAIK.
In European markets, I guess the change value is displayed based on the open price of the day. It is up to your use case. Kite also offers a setting where a user can view change based on open price.
While clients can handle it, I was doing a search yesterday regarding this, there are lots of users who trade intraday based on gainers/losers, and for this purpose they need net_change, but not historically, if they get net_change in todays quote data, that is just fine for them, that means they do not have to store yesterdays data in DB/CSV. They may just need data for NIFTY50, but sometimes they need more as the list changes, so they invariably need to download for at least NIFTY500 (does not make sense) and store it and churn it.
Let me give my example, as you know am trying to build options_chain using API and net_change is missing, so everyday I need to store LTP in the evening for 25k - 35k NFP-OPT instruments (And if I get net_change for those options quotes, I dont need to store in DB too, if not I need to do it.), that is just current month expiry. Am sure you guys can easily handle this and I can easily dump the data everyday in DB/CSV (and keep churning). And this is just me, if lot of people do this (definitely your servers wont even feel a glitch with this load, as this is nothing), but does not make sense for a feature that was working fine earlier and now broken, you still have the field in the packet "net_change: 0" but zero all the time . And there are so many people asking for this, found it by searching "net_change"
I hope, like your said the concerned team would look into this and fix it.
Appreciate your prompt replies always!
Oh! yea BTW, the net_change in NIFTY spot/index that you see is in points, not change percentage, am not sure what its supposed to have.
{'NSE:NIFTY 50': {'instrument_token': 256265, 'tradingsymbol': 'NIFTY 50', 'timestamp': datetime.datetime(2020, 7, 21, 18, 5, 5), 'last_price': 11162.25, 'net_change': 140.05, 'ohlc': {'open': 11126.1, 'high': 11179.55, 'low': 11113.25, 'close': 11022.2}}
You may want to convey that info to the concerned team as well.
For now I will use C from OHLC for my calculations.
Appreciate your help!
Are you talking about the instruments master dump or the ltp API? Can you point to the right API from documentation.