I am using .net library to get the live data streaming (Market data). Subscribed around 800 stocks for Mode-full. But getting full as quote data as well . But after some time only getting quota data only. After copying recent .dll as well this issue exists. Could you please check once, Why am i getting quote data even though subscribed for full mode data.
@RP7220, You need to setMode after you get onConnected callback? I think the logic is wrong somewhere else. Can you check if both the arrays have same instrument token?
@sujith One need not set mode in OnConnect. I do the same as above and am receiving ticks allright. Unless something turns out to be wrong on investigating the stored ticks. since I am not using them actively yet. but from the looks of it 15600898 seems to be CANBK18MAR240CE Could it be something to do with options data. data does start in quote mode even in active hours. you can copy paste below code in c# interactive (Visual studio). ticker will auto close in a minute.
#r "location of your\KiteConnect.dll" #r "System.Threading"
using KiteConnect ; Ticker kite_ticker ;
void CheckTicker( List<uint> instruments, string mode, string apiKey, string accessTok ) { var tmr = new System.Threading.CountdownEvent( 100 ) ;
if ( kite_ticker == null) {
kite_ticker = new Ticker( APIKey:apiKey, AccessToken:accessTok ) ;
mode is a config entry. At any point of time Mode will be either full or quote. But not both, Also SubscribeTokenNiftyIndes method will always return two value i. e 256265 NIFTY NIFTY 50 260105 BANKNIFTY NIFTY BANK As these scripts does have depth, so i am getting the quotes for these.
Also checked my logic both the arrays completely independent. There is no repeated value. Also FYI as i mentioned above what ever / how many scripts subscribed , the mode would be either quote or full. but not both.
Even today getting more feed for all the scripts as quote compared full. Even though subscribted for full more.
@RP7220 We tried at our end and it works fine. Can you initialize ticker with Debug parameter to True? This will print detailed logs on the command line. Can you post it here? We will investigate.
@RP7220, Let us say you subscribe to 256265 and setMode to modeFull and subscribe to the same instrument token again then the server will start sending you data in modeQuote and you will stop getting data in modeFull.
i mean does not have depth as it was indices. you are write.its typo error. & Please re-check once as even though you set mode as full, In the tick you received mode as 'quote' .
Sujith,
Thanks for information. Initially i have subscribed both indices(quote) and other scripts(full mode) in the same code and so all the instruments are getting only quote mode. Now i have avoided all the indices and only considering the instruments which are having full depth. still i am facing the issue. Here i am getting all the nifty 50 stocks ticks and their near strike price CE and PE 's Ticks.
FYI. Now I have created tow different apps one App for get ticks of incidicies(NIFTY & BANKNIFTY) and second app for the instruments(Options(CEPE) of NIFTY and BankNIFTY) for which having depth. Not seen any issues.
I think, i found the exact issue. I have tried to subscribe indices and other scripts separately, then we are getting ticks as per the given mode. (Note: for indices , as i mentioned in my previous post, its does not matter whether you set mode full and quote, its always returns quote mode only). So if you combine indices with other scripts, Web Socket was providing both quote and full mode for all the scripts. Let me know if my assumptions is wrong.
I did try as you said, only the first tick for 15600898 announced itself as quote and then it became full for the rest of the streaming as was requested. perhaps it is less volatile/liquid. Indices also I placed in full mode. although it does not have depth but from the very beginning it announced itself as in full mode. even if data received had no depths.
Thou I tried it only for 1 minute because my ticker was already up for downloading what I meant to download. so I did not want to push it during market hours lest it did something inadvertently to the data I was downloading.
would you consider using the code I posted above and use it to test the ticker out. at your end since it is separate from your app. you would be able to see clearly if ticker is wrong. or somewhere in your app something Is happening which has not caught your eye. you only have to copy paste it. it will shut itself down in a minute.
C# interactive in VS2017 community edition is located at View -> Other windows -> C# interactive
Attached the ticks of SBI(779521) from last 2 hours. Subscribed in full mode. Intermittently getting quote data as well. but getting most data in full mode only.
I also provisioned for SBI see if it matches your data I don't see quote in mine. Change .pdf to .zip and unzip it. You will find files with minute timestamps precisioned to milliseconds i.e all ticks for one minute are stored in one file.
public void Load_TickJsonAndPrint() { var a = new DirectoryInfo( @"locationOfUnziping\NSE_SBIN" ) ; if ( a.Exists == false ) return ; var b = a.GetFiles( "*.json" )?.ToList() ; if ( b == null || b.Count <= 0 ) return ;
foreach( var fl in b ) { System.Diagnostics.Debug.WriteLine( fl.Name );
using( var c = new FileStream( fl.FullName, FileMode.Open ) ) using( var d = new StreamReader( c ) ){
var f = d.ReadToEnd(); var i = JsonDeSerialize<List<KiteConnect.Tick>>( f ) ;
if ( i.IsNullOrEmpty() ) return ; foreach( var item in i ) { System.Diagnostics.Debug.WriteLine( $"{ JsonSerialize( item ) }" ) ; }
Subscribed for 106 instruments for today in full mode. Majorly getting full mode ticks. but intermittently seeing quote mode ticks, but very less when compared to full mode ticks.
Please check the attached .xls for the instruments subscribed and instruments wise ticks counts thre received today for full and quote.
I have subscribed for 900+ instruments in full mode, which contains options scripts as well. Intermittently getting the ticks with quote mode. For you reference attached BHARTIARTL, BHARTIARTL18MAR400CE & BHARTIARTL18MAR400PE tick for last 4 hours.
please check once.
Let me know if you need the ticks of any other stock?
Eg.
LiveDate Mode Instrumenttoken Tradable LastPrice LastQuantity AveragePrice Volume BuyQuantity SellQuantity Open High Low Close
06-03-2018 11:27 quote 15600898 1 56.4 1600 0 0 16000 20800 0 0 0 54.4
06-03-2018 11:23 quote 15600898 1 56.4 1600 0 0 16000 19200 0 0 0 54.4
06-03-2018 11:27 full 15600898 1 56.4 1600 0 0 16000 20800 0 0 0 54.4
06-03-2018 11:24 quote 15600898 1 56.4 1600 0 0 16000 19200 0 0 0 54.4
06-03-2018 11:23 quote 15600898 1 56.4 1600 0 0 16000 19200 0 0 0 54.4
06-03-2018 11:25 quote 15600898 1 56.4 1600 0 0 16000 19200 0 0 0 54.4
06-03-2018 11:24 quote 15600898 1 56.4 1600 0 0 16000 19200 0 0 0 54.4
06-03-2018 11:31 quote 15600898 1 56.4 1600 0 0 19200 19200 0 0 0 54.4
06-03-2018 11:32 quote 15600898 1 56.4 1600 0 0 17600 32000 0 0 0 54.4
06-03-2018 11:32 quote 15600898 1 56.4 1600 0 0 17600 32000 0 0 0 54.4
https://github.com/zerodhatech/dotnetkiteconnect/releases/tag/3.0.0beta2
private static void initTicker()
{
ticker = new Ticker(api_key, access_token);
ticker.OnTick += onTick;
ticker.OnReconnect += onReconnect;
ticker.OnNoReconnect += oNoReconnect;
ticker.OnError += onError;
ticker.OnClose += onClose;
ticker.OnConnect += onConnect;
ticker.EnableReconnect(Interval: 5, Retries: 50);
ticker.Connect();
// Subscribing to NIFTY50 and setting mode to LTP
//ticker.Subscribe(Tokens: new UInt32[] { 256265 });
//ticker.SetMode(Tokens: new UInt32[] { 256265 }, Mode: Constants.MODE_LTP);
if (mode == "full")
{
List instruments = SubscribeTokens();
ticker.Subscribe(Tokens: instruments.ToArray());
ticker.SetMode(Tokens: instruments.ToArray(), Mode: Constants.MODE_FULL);
}
else
{
List instrumentsIndex = SubscribeTokensNiftyIndes();
ticker.Subscribe(Tokens: instrumentsIndex.ToArray());
ticker.SetMode(Tokens: instrumentsIndex.ToArray(), Mode: Constants.MODE_QUOTE);
}
}
You need to setMode after you get onConnected callback?
I think the logic is wrong somewhere else. Can you check if both the arrays have same instrument token?
15600898 seems to be CANBK18MAR240CE
Could it be something to do with options data. data does start in quote mode even in active hours.
you can copy paste below code in c# interactive (Visual studio). ticker will auto close in a minute. Thanks
Regards
256265 NIFTY NIFTY 50
260105 BANKNIFTY NIFTY BANK
As these scripts does have depth, so i am getting the quotes for these.
Also checked my logic both the arrays completely independent. There is no repeated value. Also FYI as i mentioned above what ever / how many scripts subscribed , the mode would be either quote or full. but not both.
Even today getting more feed for all the scripts as quote compared full. Even though subscribted for full more.
Eg:
LiveDate Mode Instrumenttoken Tradable LastPrice LastQuantity AveragePrice Volume BuyQuantity SellQuantity Open High Low Close Change OrdersBids1 OrdersBids2 OrdersBids3 OrdersBids4 OrdersBids5 QuantityBids1 QuantityBids2 QuantityBids3 QuantityBids4 QuantityBids5 PriceBids1 PriceBids2 PriceBids3 PriceBids4 PriceBids5 OrdersOffers1 OrdersOffers2 OrdersOffers3 OrdersOffers4 OrdersOffers5 QuantityOffers1 QuantityOffers2 QuantityOffers3 QuantityOffers4 QuantityOffers5 PriceOffers1 PriceOffers2 PriceOffers3 PriceOffers4 PriceOffers5 LastTradeTime OI OIDayHigh OIDayLow Timestamp
07-03-2018 12:57 quote 20434946 1 7.25 4500 7.28 504000 499500 292500 6.8 8.95 5.85 6.95 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
07-03-2018 12:56 full 20434946 1 7.25 4500 7.28 504000 508500 301500 6.8 8.95 5.85 6.95 0 1 2 4 1 4 4500 9000 22500 9000 40500 48:00.0 7.15 7.1 7.05 6.9 3 2 2 4 1 13500 22500 36000 22500 13500 7.4 7.45 7.7 7.95 8 55:24.0 207000 270000 202500 07-03-2018 12:56
07-03-2018 12:56 quote 20434946 1 7.25 4500 7.28 504000 508500 301500 6.8 8.95 5.85 6.95 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
07-03-2018 12:55 quote 20434946 1 7.25 4500 7.28 504000 513000 292500 6.8 8.95 5.85 6.95 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
07-03-2018 12:55 quote 20434946 1 7.15 4500 7.29 495000 508500 319500 6.8 8.95 5.85 6.95 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
07-03-2018 12:54 quote 20434946 1 7.15 4500 7.29 495000 508500 310500 6.8 8.95 5.85 6.95 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
07-03-2018 12:53 quote 20434946 1 7.6 4500 7.29 468000 495000 315000 6.8 8.95 5.85 6.95 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
07-03-2018 12:51 quote 20434946 1 7.6 4500 7.29 468000 504000 324000 6.8 8.95 5.85 6.95 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
07-03-2018 12:50 quote 20434946 1 7.2 4500 7.28 459000 499500 319500 6.8 8.95 5.85 6.95 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
07-03-2018 12:50 quote 20434946 1 7.2 4500 7.28 459000 504000 306000 6.8 8.95 5.85 6.95 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
Regards,
RP7220
I checked above two in full mode. it returns allright for a minute sends lastPrice since it is indice.
Thanks
Regards
Let us say you subscribe to 256265 and setMode to modeFull and subscribe to the same instrument token again then the server will start sending you data in modeQuote and you will stop getting data in modeFull.
i mean does not have depth as it was indices. you are write.its typo error. & Please re-check once as even though you set mode as full, In the tick you received mode as 'quote' .
Sujith,
Thanks for information. Initially i have subscribed both indices(quote) and other scripts(full mode) in the same code and so all the instruments are getting only quote mode. Now i have avoided all the indices and only considering the instruments which are having full depth. still i am facing the issue. Here i am getting all the nifty 50 stocks ticks and their near strike price CE and PE 's Ticks.
FYI. Now I have created tow different apps one App for get ticks of incidicies(NIFTY & BANKNIFTY) and second app for the instruments(Options(CEPE) of NIFTY and BankNIFTY) for which having depth. Not seen any issues.
Regards,
RP7220
I think, i found the exact issue. I have tried to subscribe indices and other scripts separately, then we are getting ticks as per the given mode. (Note: for indices , as i mentioned in my previous post, its does not matter whether you set mode full and quote, its always returns quote mode only). So if you combine indices with other scripts, Web Socket was providing both quote and full mode for all the scripts. Let me know if my assumptions is wrong.
Thanks & Regards,
RP7220
Thou I tried it only for 1 minute because my ticker was already up for downloading what I meant to download. so I did not want to push it during market hours lest it did something inadvertently to the data I was downloading.
would you consider using the code I posted above and use it to test the ticker out. at your end since it is separate from your app. you would be able to see clearly if ticker is wrong. or somewhere in your app something Is happening which has not caught your eye.
you only have to copy paste it. it will shut itself down in a minute.
C# interactive in VS2017 community edition is located at View -> Other windows -> C# interactive
Thanks
Regards
Attached the ticks of SBI(779521) from last 2 hours. Subscribed in full mode. Intermittently getting quote data as well. but getting most data in full mode only.
Regards,
RP7220
Regards
Please check the attached .xls for the instruments subscribed and instruments wise ticks counts thre received today for full and quote.
Regards
RP7220
I have subscribed for 900+ instruments in full mode, which contains options scripts as well. Intermittently getting the ticks with quote mode. For you reference attached BHARTIARTL, BHARTIARTL18MAR400CE & BHARTIARTL18MAR400PE tick for last 4 hours.
please check once.
Let me know if you need the ticks of any other stock?
Regards,
RP7220
26-03-2018 14:52 quote 14219778 0.75 NULL NULL NULL NULL
26-03-2018 14:52 quote 14219522 2.3 NULL NULL NULL NULL
26-03-2018 13:52 quote 54273 143.5 NULL NULL NULL NULL
26-03-2018 13:52 quote 14219778 1.1 NULL NULL NULL NULL
26-03-2018 13:27 quote 14219522 2.1 NULL NULL NULL NULL
26-03-2018 11:36 quote 54273 143.35 NULL NULL NULL NULL
26-03-2018 11:36 quote 14219522 2.2 NULL NULL NULL NULL
26-03-2018 11:36 quote 14219778 1.3 NULL NULL NULL NULL
Regards,
RP7220