getting unsubscribed tokens in websoket streamed ticker

trade_then
I have subscribed to Nifty 50 in full mode.
but count has risen to 300 scrips buy themselves from kite server end randomly.
that is Nifty 50 scrips are being delivered in full mode. but every now and then there are few tickers
arriving on there own. in quote mode or ltp mode.

never subscribed this
[
{
"Mode": "full",
"InstrumentToken": 26440,
"Tradable": true,
"LastPrice": 655.36,
"LastQuantity": 0,
"AveragePrice": 0,
"Volume": 0,
"BuyQuantity": 0,
"SellQuantity": 0,
"Open": 3276.8,
"High": 2.37,
"Low": 264.45,
"Close": 7.62,
"Change": 264.5,
"Bids": null,
"Offers": null,
"LastTradeTime": null,
"OI": 0,
"OIDayHigh": 0,
"OIDayLow": 0,
"Timestamp": "\/Date(327680000)\/"
}
]
never subscribed to this
[
{
"Mode": "ltp",
"InstrumentToken": 184,
"Tradable": true,
"LastPrice": 3489.29,
"LastQuantity": 0,
"AveragePrice": 0,
"Volume": 0,
"BuyQuantity": 0,
"SellQuantity": 0,
"Open": 0,
"High": 0,
"Low": 0,
"Close": 0,
"Change": 0,
"Bids": null,
"Offers": null,
"LastTradeTime": null,
"OI": 0,
"OIDayHigh": 0,
"OIDayLow": 0,
"Timestamp": null
}
]
never subscribed to this.
[
{
"Mode": "ltp",
"InstrumentToken": 3768451073,
"Tradable": true,
"LastPrice": 17998807.05,
"LastQuantity": 0,
"AveragePrice": 0,
"Volume": 0,
"BuyQuantity": 0,
"SellQuantity": 0,
"Open": 0,
"High": 0,
"Low": 0,
"Close": 0,
"Change": 0,
"Bids": null,
"Offers": null,
"LastTradeTime": null,
"OI": 0,
"OIDayHigh": 0,
"OIDayLow": 0,
"Timestamp": null
}
]
they are appearing randomly some are consistent other have arrived just once.
some a few more times.

Total number of scrips which have arrived apart from nifty 50 have risen to 510 in count on their own.

Thanks
Regards


  • sujith
    You mean to say, you have subscribed only to 256265(Nifty 50) but you are getting ticks for other tokens as well?
  • sujith
    In both quote and full mode?
  • trade_then
    @sujith
    Thanks for the reply
    What I mean is that I have subscribed to all scrips in Nifty 50 index ( hdfc, hdfcbank, reliance etc. etc.. ). in full mode. but apart from those 50 I am recieveing these other scrips also randomly in quote mode or ltp mode from kite server side. current count has risen to 910 as of 11.01 am 21-feb-2018.

    Thanks
    Regards

  • trade_then
    trade_then edited February 2018
    Sample:-

    [
    {
    "Mode": "ltp",
    "InstrumentToken": 4,
    "Tradable": true,
    "LastPrice": 7400980.48,
    "LastQuantity": 0,
    "AveragePrice": 0,
    "Volume": 0,
    "BuyQuantity": 0,
    "SellQuantity": 0,
    "Open": 0,
    "High": 0,
    "Low": 0,
    "Close": 0,
    "Change": 0,
    "Bids": null,
    "Offers": null,
    "LastTradeTime": null,
    "OI": 0,
    "OIDayHigh": 0,
    "OIDayLow": 0,
    "Timestamp": null
    }
    ]
  • tonystark
    Can you give me example code for all the instrument tokens you were subscribing? We will investigate at our end.
  • trade_then

    these are all kite instrument tokens.

    Thanks
    Regards
  • tonystark
    It will be helpful if you can give it as a selectable list. Just open this folder in command prompt and do "dir" and paste the result here. :smile:
  • trade_then
    trade_then edited February 2018
    @tonystark
    here is the list

    Thanks
    Regards


    Sorry forgot the selectable part here is list of names

    Thanks
    Regards

  • trade_then
    giving the source code that is bit tricky.
    because it is separated over various services. while app is in the making.
    I can give a gist/snippets thou.
    if required.

    Thanks
    Regards
  • tonystark
    tonystark edited February 2018
    Your list contains exchange tokens. You have to use instrument tokens from latest instrument CSV dump. Also, the list has >1000 instruments. Max limit of tokens you can subscribe is 1000.
  • trade_then

    I have not subscribed to these scrips.
    They are randomly being thrown at me.
    and which ever token it is kitetoken or exchange token I am showing here how it Is arriving.

    Thanks
    Regards
  • tonystark
    I'm trying to reproduce the issue. Can you give the list of tokens you are subscribing?
  • trade_then
    for what it is worth here are few code snippets

    1. client makes this request to a service that deal with curating kite ticks..

    public ( TickerAdapter tikAda, OrderUpdateAdapter ordAda )? StartNifty50FeedAndOrderStorage()
    {
    var usr = new Right_Then.KiteDataDownloader.KiteUserInfoGatherer().CheckLatestUserInfo();

    if ( usr == null ) return null ;

    var dir = KiteStorageInfo.WhereAbouts.DirectoryLocations.InstrumentList_Today();
    var fln = Path.Combine( dir, "Nse_NIFTY_Kite_Instrument_tokens.csv" );

    var lst = new Right_Then.KiteDataDownloader
    .KiteInstrumentListGatherer()
    .Load_instrumentList_from_csv_file(
    new FileInfo( fln ) ) ;

    List<string> nifty_tokens = new List<string>();

    lst.ForEach( x => nifty_tokens.Add( x.InstrumentToken.ToString() ) );

    var infoPriceTicker = new TickOrderServiceCommunicator();
    var infoOrderTicker = new TickOrderServiceCommunicator() ;

    TickerAdapter tickerAdapter = null;
    OrderUpdateAdapter orderUpdateAdapter = null;
    infoPriceTicker = new TickOrderServiceCommunicator
    {
    Mode = "full",
    ScripIds = nifty_tokens,
    DoMockTicker = false,
    Api_Key = usr?.APIKey,
    Public_Token = usr?.PublicToken,
    AcessToken = usr?.AccessToken,
    Api_Secret = "",
    User_ID = usr?.UserId,
    StoreOrdersToDisk = true,
    StoreTicksToDisk = true
    };
    infoOrderTicker = new TickOrderServiceCommunicator
    {
    Mode = "full",
    ScripIds = nifty_tokens,
    DoMockTicker = false,
    Api_Key = usr?.APIKey,
    Public_Token = usr?.PublicToken,
    AcessToken = usr?.AccessToken,
    Api_Secret = "",
    User_ID = usr?.UserId,
    StoreOrdersToDisk = true,
    StoreTicksToDisk = true
    };
    try
    {

    if ( tickerAdapter == null ){
    tickerAdapter = new TickerAdapter( infoPriceTicker ) ;
    tickerAdapter.Start() ;

    }
    if ( orderUpdateAdapter == null ){

    CancellationTokenSource source = new CancellationTokenSource();
    CancellationToken token = source.Token;
    try
    {
    Task.Run( () =>
    {
    while( tickerAdapter.Ticker_Service_Client.FirstTickArrived == false )
    {
    if ( token.IsCancellationRequested ) break;
    }

    }, token ).Wait( TimeSpan.FromMinutes( 1 ) ) ;
    }
    finally
    {
    source.Cancel();
    }
    if( tickerAdapter.Ticker_Service_Client.FirstTickArrived == true )
    {
    orderUpdateAdapter = new OrderUpdateAdapter( infoOrderTicker ) ;
    orderUpdateAdapter.Start() ;
    }
    }

    return ( tickerAdapter, orderUpdateAdapter ) ;
    }
    catch {
    tickerAdapter?.Stop() ;
    orderUpdateAdapter?.Stop() ;
    }

    return null ;
    }
    2. when it reaches the service. after auditing if the requested scrips have allready been subscribed or not
    final request is made to you like this.

    public virtual void InitTicker()
    {
    if ( Kite_WS_Ticker == null) {

    Kite_WS_Ticker = new Ticker( Api_Key, AcessToken ) ;

    Kite_WS_Ticker.OnTick += onTick ;
    Kite_WS_Ticker.OnReconnect += onReconnect ;
    Kite_WS_Ticker.OnNoReconnect += oNoReconnect ;
    Kite_WS_Ticker.OnError += onError ;
    Kite_WS_Ticker.OnClose += onClose ;
    Kite_WS_Ticker.OnConnect += onConnect ;
    Kite_WS_Ticker.OnOrderUpdate += onOrderUpdate ;

    Kite_WS_Ticker.EnableReconnect( Interval: 5, Retries: 50 ) ;
    Kite_WS_Ticker.Connect() ;


    var sids = new List<uint>( ) ;
    ScripIds.ForEach( x => sids.Add( uint.Parse(x) ) ) ;

    Kite_WS_Ticker.Subscribe( Tokens: sids.ToArray() ) ;
    Kite_WS_Ticker.SetMode( Tokens: sids.ToArray(), Mode: Mode ) ;
    }
    }
    Thanks
    Regards
  • trade_then
    Instrument_token
    3861249
    325121
    60417
    70401
    1510401
    4267265
    81153
    134657
    2714625
    7458561
    558337
    177665
    5215745
    225537
    232961
    1207553
    1850625
    341249
    345089
    348929
    359937
    356865
    340481
    424961
    1270529
    7712001
    415745
    1346049
    408065
    492033
    2939649
    2672641
    519937
    2815745
    2977281
    633601
    3834113
    738561
    779521
    857857
    2953217
    884737
    895745
    3465729
    2889473
    2952193
    784129
    969473
    3050241
    975873

    these are the only tokens I have subscribed too.

    Thanks
    Regards
  • trade_then
    @tonystark

    My Ticker subscription is on. so you can check it live at your server, if I am sending these requests of subscription. or something is happening at your end.

    Thanks
    Regards
  • tonystark
    tonystark edited February 2018
    @trade_then We have fixed this issue and released an update. You can download the new DLL from Github repo and use it.
  • trade_then
    Thanks a million
    Will check it.

    Thanks
    Regards
  • trade_then
    @tonystark

    Just for the humor of information. i just reached the part of my Application where data delivery of stored data to requiring parts was to be formalized. it turns out all this while for last 15 days i was storing more of gibberish rather than actual data. now i am writing the code to vet out unrequired data from actual data. Had i not chanced upon this today it would have continued like this. Tomorrow would be tested how much of difference in storage space will it make due to the changes made by you.

    Thanks
    Regards
Sign In or Register to comment.