@sujith I am getting this error since last 2 days:
using kiteconnect==3.5
Exception in thread Thread-5156 (most likely raised during interpreter shutdown): Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner File "/usr/lib/python2.7/threading.py", line 1073, in run File "/usr/local/lib/python2.7/dist-packages/kiteconnect/__init__.py", line 1019, in _timer : 'NoneType' object has no attribute 'time'
@sujith - Any relevant portion you would need to see? Asking since code base is large.
Running websocket on MCX instruments. Code works fine starting 10am. But, connection seems to develop issue between 16:30 and 17:30. 3rd day straight.
I am logging on "on_error" callback. Can you help point to the Exception object documentation so that I can find the correct error string. error.message is returning blank.
Is there any API rate limit issue (though doesnt look likely since I am just subscribing to ticks on a single instrument via websocket) or any time out after some set hours?
Code reliability has become an issue after running for some 6.5 to 7.0 hrs (starting 10 am).
I know for sure that the code is working without any error once it fires up in the morning. But between 16:30 and 17:30, something fails. Is this a known issue if a websocket is open for long?
To clarify further, at present I am just using live Tick data to do "paper trading" of my strategy. No orders are being hit. So, I don't need to login to Kite and hence not yet using KiteConnect. Code is entirely based on capturing ticks and simulating a defined strategy.
python2.7 websocket-client==0.44.0 kiteconnect==3.5 (though, not using in my current code)
I am running 5 instances of same codebase to track 5 different scripts and do "paper trading" on each. In each instance, I establish a websocket connection, subscribe to a single script, listen for ticks and then simulate a strategy on live data.
@vivek - That is not the issue. time module is available. The earlier crash code was because a None was being returned instead an object of type 'time'. I fixed the code to handle that and print a proper error message.
You can look at the error log trace above. Effectively, websocket is throwing an error, gets disconnected, retries connection. Sometimes it connects, other times (usually around 16:30), it fails to reconnect. SInce this is happening every day around same time, I suspect whether there is a pattern here.
Can you paste complete code?
Running websocket on MCX instruments. Code works fine starting 10am. But, connection seems to develop issue between 16:30 and 17:30. 3rd day straight.
I am logging on "on_error" callback. Can you help point to the Exception object documentation so that I can find the correct error string. error.message is returning blank.
Is there any API rate limit issue (though doesnt look likely since I am just subscribing to ticks on a single instrument via websocket) or any time out after some set hours?
Code reliability has become an issue after running for some 6.5 to 7.0 hrs (starting 10 am).
Make sure to print error message.
https://kite.trade/docs/pykiteconnect/exceptions.m.html
kws = WebSocket(api_key, access_token, userID)
kws.on_error = on_error
def on_error(error, ws):
print error.message
Is this good enough?
I know for sure that the code is working without any error once it fires up in the morning. But between 16:30 and 17:30, something fails. Is this a known issue if a websocket is open for long?
We will check on Monday.
Make sure you print error message and let us know on that Monday.
We haven't come across any issue like this.
2017-07-31 09:15:04, on_connect
2017-07-31 10:46:01, on_error, Connection is already closed.
2017-07-31 10:46:02, on_reconnect
2017-07-31 10:46:03, on_connect
2017-07-31 12:42:01, on_error, Connection is already closed.
After this, the python process died
Stating again the callback functions registered and connetion params:
kws.on_tick = on_tick
kws.on_connect = on_connect
kws.on_error = on_error
kws.on_reconnect = on_reconnect
kws.on_noreconnect = on_noreconnect
kws.enable_reconnect(reconnect_interval=1, reconnect_tries=500)
kws.connect(threaded=False)
python2.7
websocket-client==0.44.0
kiteconnect==3.5 (though, not using in my current code)
I am running 5 instances of same codebase to track 5 different scripts and do "paper trading" on each. In each instance, I establish a websocket connection, subscribe to a single script, listen for ticks and then simulate a strategy on live data.
You can look at the error log trace above. Effectively, websocket is throwing an error, gets disconnected, retries connection. Sometimes it connects, other times (usually around 16:30), it fails to reconnect. SInce this is happening every day around same time, I suspect whether there is a pattern here.