☰
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
13.2K
All Categories
0
Incidents
128
Node JS client
39
Go client
769
.Net API client
364
Kite Publisher
532
.Net / VBA / Excel (3rd party)
436
Algorithms and Strategies
972
Java client
1K
API clients
401
PHP client
3.8K
Python client
331
Mobile and Desktop apps
1.3K
Market data (WebSockets)
3.2K
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