It looks like you're new here. If you want to get involved, click one of these buttons!
import pandas as pd
from kiteconnect import KiteTicker
class TICKER:
def __init__(self, instruments, api_key, access_token):
self.instrument_ticker = KiteTicker(api_key, access_token)
self.instruments = [int(v) for v in instruments.values()]
self.set_instrument_ticker_callbacks()
self.instrument_ticker.connect()
def connect_indices(self):
def on_connect(ws, response):
ws.subsribe(self.instruments)
ws.set_mode(ws.MODE_FULL, self.instruments)
return on_connect
def print_instrument_ticks(self, ticks):
curr_prices = [i['last_price'] for i in ticks]
self.subscribe_levels(curr_prices)
print(ticks)
def subsribe_levels(self, curr_prices):
return
def instrument_ticks(self):
def on_ticks(ws, ticks):
self.print_instrument_ticks(ticks)
return on_ticks
def instrument_ticker_close(self):
def on_close(ws, code, reason):
self.print_instrument_ticks(reason)
ws.close()
return on_close
def set_instrument_ticker_callbacks(self):
self.instrument_ticker.on_connect = self.connect_indices()
self.instrument_ticker.on_ticks = self.instrument_ticks()
self.instrument_ticker.on_close = self.instrument_ticker_close()
import pandas as pd
def on_instrument_connect(instruments):
def on_connect(ws, response):
ws.subsribe(instruments)
ws.set_mode(ws.MODE_FULL, instruments)
return on_connect
def on_instrument_ticks():
def on_ticks(ws, ticks):
print(ticks)
# Do Other Shit
return on_ticks
def on_instrument_close():
def on_close(ws, code, reason):
ws.stop()
return on_close
Connection error: 1006 - connection was closed uncleanly (I dropped the WebSocket TCP connection: 'KiteTicker' object has no attribute 'subsribe')
subscribe
notsubsribe
.