☰
Login
Signup
Home
›
Market data (WebSockets)
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Register
Categories
Recent Discussions
Activity
Categories
14K
All Categories
0
Incidents
156
Node JS client
40
Go client
794
.Net API client
383
Kite Publisher
537
.Net / VBA / Excel (3rd party)
462
Algorithms and Strategies
1K
Java client
1.1K
API clients
405
PHP client
4K
Python client
349
Mobile and Desktop apps
1.4K
Market data (WebSockets)
3.4K
General
In this Discussion
July 2017
Vivek
July 2017
sujith
Writing streaming data into dataframe
nithishkailas
July 2017
edited July 2017
in
Market data (WebSockets)
rom kiteconnect import WebSocket as wb
kws = wb(api_key, public_token, user_id)
import pandas
def on_tick(tick, ws) : print(tick,"\n")
def on_tick(tick,ws) : new = pandas.DataFrame(tick,ws)
def on_connect(ws): ws.subscribe[408065]
def on_connect(ws):ws.set_mode(ws.MODE_LTP,[408065])
kws.on_tick=on_tick
kws.on_connect=on_connect
kws.connect()
THIS CODE IS SHOWING ME THIS ERROR
ERROR:websocket:error from callback >: 'WebSocket' object is not iterable
ERROR:websocket:error from callback >: 'WebSocket' object is not iterable
ERROR:websocket:error from callback >: 'WebSocket' object is not iterable
guys, please help me fix this code. any other methods to write data into dataframe.
sujith
July 2017
Hi
@nithishkailas
,
It seems like Pandas is iterating through websocket object. I would suggest checking Pandas documentation.
Vivek
July 2017
You should be initializing empty Panda's dataframe for ticks data structure and then append ticks to the frame.
Reference -
https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.append.html
Sign In
or
Register
to comment.
It seems like Pandas is iterating through websocket object. I would suggest checking Pandas documentation.
Reference - https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.append.html