Exceptions in streaming.py and _app.py
ecamaj opened this issue · 5 comments
So Looks like there are some issues with version 1.0.4 in streaming.py.
line 128:
self.WS.run_forever(ping_interval=self._ping_interval, ping_timeout=self._ping_timeout,
ping_payload=self._ping_payload, skip_utf8_validation=self._skip_utf8_validation)
- Exception since WebSockets run_forever does not expect ping_payload argument.
line 625:
def _default_on_open(self, _ws: ws_client.WebSocketApp, *args):
- Exception in _app.py, line 340, since _default_on_open is called without _ws argument (true part in if clause):
def _callback(self, callback, *args):
if callback:
try:
if inspect.ismethod(callback):
callback(*args)
else:
callback(self, *args)
To Reproduce
Just trying to initialise StockStream and call start_stream_thread after subscribing to trades.
Environment Details:
MacOS, Python 3.6, WebSockets 9.1
Hey @ecamaj
Thanks for reporting the issue. I'm travelling over the course of a few days so won't be able to dig in.
Be sure to checkout the market maker lite/polygon repository which has callback streamer running without issues to ensure you followed the order and sequence of the function calls.
That repo will have some additional stuff like redis
and postgres
DB. Ignore them if not needed.
You should also be able to just copy the third example from readme and run it.
I'll look for the bugs when i get back in a few days.
Feel free to join in the discord server for discussions.
Thanks
P S
One more thing.
In _app.py:
if callback:
try:
if inspect.ismethod(callback):
callback(*args)
else:
callback(self, *args)
This throws exception if given callback is static method (no "self" as the first argument). Which, I would say, should be static since you can have one handler per client/cluster.
ah, it is websockets package, not yours.
so a follow up on the potential bug reports as I'm back from the travel @ecamaj
Exception since WebSockets run_forever does not expect ping_payload argument.
I could not reproduce this. Here, look at the method signature which includes ping_payload
since _default_on_open is called without _ws argument (true part in if clause):
i could not see/reproduce this. here is how the only _callback
method looks like (also note that it's inside the websocket-client pacakge, not polygon package)
Lemme know if you have any additional information or reports on the issues.
Thanks
P S
I'll be closing this one for lack of activity in a few days @ecamaj
feel free to re-open this or open new issue if there is further info.