You can setup a timer that executes every 15 minutes. When it executes you can create a new connection, subscribe to the token, and after the first tick you can unsubscribe and disconnect.
can you please guide me for how to calculate open high low close for 15 minutes candle stick if I schedule my application for every 15 minutes for creating a new connection and subscribing for the token.
Hi @sunnypatel, One of the ways is to build a 5minute candle using five 1minute candles and to build 1minute candle, you need to listen to all the ticks in a minute and create a candle. You can create a candle with following values for OHLC
Open - > LTP of first candle. Close -> LTP of last candle. High -> highest LTP of that minute. Low -> lowest LTP of that minute.
Hi @sunnypatel, I am afraid, we don't have example code as of now. Basically, you need to store all the ticks somewhere and create candles data. As mentioned above, Value of open will be LTP of the first tick data of that minute, value of close will be LTP of the last tick data of that minute, value of high will be highest LTP of that minute, value of low will be lowest LTP of that minute.
Hi @sunnypatel, Both data sources are different. It is not possible for any platform to capture all the ticks over the internet. Check out this thread for more information.
@sujith why does MODE_LTP show close price (weighted average of last 30 mins of trading) not the actual last traded price. For e.g. if you check the LTP of ACC on the NSE website today, it states LTP as 1819.30 and close price as 1818.05. The Kite API data stream shows 1818.05 as LTP. Close price is good information but can be misleading for people who build strategies using LTP. Instrument token for ACC is 5633 . Thanks for your help.
I am getting different values of ohlc from historical data web service in live market and after close market for 15 min candlestick can you please explain why it is like this and how to fix it
You can setup a timer that executes every 15 minutes. When it executes you can create a new connection, subscribe to the token, and after the first tick you can unsubscribe and disconnect.
One of the ways is to build a 5minute candle using five 1minute candles and to build 1minute candle, you need to listen to all the ticks in a minute and create a candle.
You can create a candle with following values for OHLC
Open - > LTP of first candle.
Close -> LTP of last candle.
High -> highest LTP of that minute.
Low -> lowest LTP of that minute.
The Kite ticker will give you OHLC of the day.
please guide me how to get a 1-minute candle from WebSocket. It would be great if you can share some code also. thanks in advance.
I am afraid, we don't have example code as of now.
Basically, you need to store all the ticks somewhere and create candles data.
As mentioned above,
Value of open will be LTP of the first tick data of that minute,
value of close will be LTP of the last tick data of that minute,
value of high will be highest LTP of that minute,
value of low will be lowest LTP of that minute.
You can check out Kite ticker usage example here.
but I am getting the same value of open price, close price, high price and low price on every tick, but when I see the chart the values are different.
tickerProvider.setOnTickerArrivalListener(new OnTick() {
@Override
public void onTick(ArrayList ticks) {
for(Tick tick :ticks){
// System.out.println(new Date());
System.out.println(tick);
}
//tickerProvider.disconnect();
}
});
Both data sources are different. It is not possible for any platform to capture all the ticks over the internet.
Check out this thread for more information.
I am getting different values of ohlc from historical data web service in live market and after close market for 15 min candlestick can you please explain why it is like this and how to fix it
Thanks in advance
Check out this thread which is based on same topic https://kite.trade/forum/discussion/2356/difference-in-prices-between-kite-chart-and-websocket-historical-apis#latest