limit on the number of NFO tickers I can subscribe to ?

sunny
Hello there,

My trading strategy normally involves analyzing whole of market data ? Is there any way, I can subscribe all F&O market data available ?
I understand that there are around 50,000 F&O contracts available. I am not sure if Kite servers can push live streaming of all of them.

Thanks,
Sunny
  • rakeshr
    @sunny , You can subscribe for up to 1000 instruments on a single WebSocket connection.So, three socket connection can fetch upto 3000 instrument.Their is restriction of maximum of three connections per api_key.
  • Ashok121
    Ashok121 edited July 2018
    @rakeshr ,
    Hi,
    Could you please let me know how to put socket data for multiple stocks in particular manner so that same can be used for generating candle sticks?

    Below code is for one stock and generating tick data in 10.txt file. Now I want multiple stock tick in particular manner for every 5 seconds.
    Example:
    @ zero second
    Reliance - 970
    Yesbank - 350
    Biocon - 400
    after 5 seconds
    Reliance - 972
    Yesbank - 352
    Biocon - 403 Something like this. They should not be shuffle


    Python Code:
    {
    from kiteconnect import KiteConnect
    api_key=open('api_key.txt','r').read()
    api_secret=open('api_secret.txt','r').read()
    kite=KiteConnect(api_key=api_key)
    kite.set_access_token(open('access_token.txt','r').read())
    import datetime
    import os
    import time
    os.environ["TZ"] = "Asia/Kolkata"
    time.tzset()
    import logging
    from kiteconnect import KiteTicker
    access_token=(open('access_token.txt','r').read())
    logging.basicConfig(level=logging.DEBUG)
    kws = KiteTicker("my api key",access_token)
    from time import sleep
    import time
    import xlrd
    workbook = xlrd.open_workbook('LP.xls')
    worksheet = workbook.sheet_by_index(1)
    H2=round(worksheet.cell(10, 14).value)
    M2=round(worksheet.cell(10, 15).value)
    INTER=round(worksheet.cell(10, 16).value)
    INSTR=round(worksheet.cell(10, 9).value)
    start_time = datetime.time(H2,M2,0,0)
    first_tick_flag = True
    def on_ticks(ws, ticks):
    global first_tick_flag,start_time
    if first_tick_flag:
    first_tick_flag = False
    start_time = time.time()
    end_time = time.time()
    if int(end_time - start_time) >=INTER:
    start_time = end_time
    for tick in ticks:
    YB=tick['last_price']
    rt1=datetime.datetime.now()
    with open('10.txt', 'a') as file:
    file.write(str(YB)+"\n")
    file.write(str(rt1)+"\n")
    def on_connect(ws,response):
    ws.subscribe([INSTR])
    ws.set_mode(ws.MODE_LTP, [INSTR])
    def on_close(ws,code,reason):
    ws.stop()
    kws.on_ticks=on_ticks
    kws.on_connect=on_connect
    kws.on_close=on_close
    kws.connect()
    }

    Thank you in advance.
  • rakeshr
    @Ashok121
    You can prepare fixed token_list , something like token_list=[738561,3050241,2911489] and then iterate receiving ticks with ['intrument_token'] and match that with arranged items of token_list.
Sign In or Register to comment.