Open henzycuong1 opened 1 year ago
yes, the live client does not work at th moment. any patches are welcome.
+1
+1
+1 Any progress?
yes, the live client does not work at th moment. any patches are welcome.
made a quick fix: https://github.com/happydasch/btplotting/pull/52
Ima hang on here. So far, i beat down the LiveClient Class to stop all this madness. But, im a bit clueless, as im getting now nonstop;
okehUserWarning: ColumnDataSource's columns must be of the same length. Current lengths: ('125298583893104', 109), ('125298583916176', 109), ('125298583916464', 109), ('125298632135248', 109), ('125298632135488', 109), ('125298632136208', 109), ('125298632165280close', 109), ('125298632165280colors_bars', 109), ('125298632165280colors_outline', 109), ('125298632165280colors_volume', 109), ('125298632165280colors_wicks', 109), ('125298632165280high', 109), ('125298632165280low', 109), ('125298632165280open', 109), ('125298632165280volume', 109), ('datetime', 109), ('index', 114) BokehUserWarning: ColumnDataSource's columns must be of the same length. Current lengths: ('125298583893104', 103), ('125298583916176', 103), ('125298583916464', 103), ('125298632135248', 103), ('125298632135488', 103), ('125298632136208', 103), ('125298632165280close', 103), ('125298632165280colors_bars', 103), ('125298632165280colors_outline', 103), ('125298632165280colors_volume', 103), ('125298632165280colors_wicks', 103), ('125298632165280high', 103), ('125298632165280low', 103), ('125298632165280open', 103), ('125298632165280volume', 103), ('datetime', 103), ('index', 114) BokehUserWarning: ColumnDataSource's columns must be of the same length. Current lengths: ('125298583893104', 106), ('125298583916176', 106), ('125298583916464', 106), ('125298632135248', 106), ('125298632135488', 106), ('125298632136208', 106), ('125298632165280close', 106), ('125298632165280colors_bars', 106), ('125298632165280colors_outline', 106), ('125298632165280colors_volume', 106), ('125298632165280colors_wicks', 106), ('125298632165280high', 106), ('125298632165280low', 106), ('125298632165280open', 106), ('125298632165280volume', 106), ('datetime', 106), ('index', 115)
And im a bit lost, why and how. Im feeding 1sec candles, havent tested other bigger timeframes yet.
Here is the LiveClient; https://gist.github.com/itsXactlY/915f610145b8c2f486fb309d91526f49
Any input is much appreciated, as the live plot wont draw newest incoming data.
https://github.com/happydasch/btplotting/pull/65
ColumnDataSource's columns still exist, but not my beer. Only wanted live plots.
Uncaught exception GET / (::1) HTTPServerRequest(protocol='http', host='localhost', method='GET', uri='/', version='HTTP/1.1', remote_ip='::1') Traceback (most recent call last): File "C:\Users\Four\AppData\Local\Programs\Python\Python39\lib\site-packages\tornado\web.py", line 1713, in _execute result = await result File "C:\Users\Four\AppData\Local\Programs\Python\Python39\lib\site-packages\bokeh\server\views\doc_handler.py", line 52, in get session = await self.get_session() File "C:\Users\Four\AppData\Local\Programs\Python\Python39\lib\site-packages\bokeh\server\views\session_handler.py", line 120, in get_session session = await self.application_context.create_session_if_needed(session_id, self.request, token) File "C:\Users\Four\AppData\Local\Programs\Python\Python39\lib\site-packages\bokeh\server\contexts.py", line 218, in create_session_if_needed self._application.initialize_document(doc) File "C:\Users\Four\AppData\Local\Programs\Python\Python39\lib\site-packages\bokeh\application\application.py", line 171, in initialize_document h.modify_document(doc) File "C:\Users\Four\AppData\Local\Programs\Python\Python39\lib\site-packages\bokeh\application\handlers\function.py", line 132, in modify_document self._func(doc) File "C:\Users\Four\AppData\Local\Programs\Python\Python39\lib\site-packages\btplotting\webapp.py", line 54, in make_document model = self._model_factory_fnc(doc) File "C:\Users\Four\AppData\Local\Programs\Python\Python39\lib\site-packages\btplotting\analyzers\plot.py", line 64, in _app_cb_build_root_model client = LiveClient(doc, File "C:\Users\Four\AppData\Local\Programs\Python\Python39\lib\site-packages\btplotting\live\client.py", line 56, in __init__ self.refreshmodel() File "C:\Users\Four\AppData\Local\Programs\Python\Python39\lib\site-packages\btplotting\live\client.py", line 255, in refreshmodel self._datahandler = LiveDataHandler(self) File "C:\Users\Four\AppData\Local\Programs\Python\Python39\lib\site-packages\btplotting\live\datahandler.py", line 22, in __init__ self._fill() File "C:\Users\Four\AppData\Local\Programs\Python\Python39\lib\site-packages\btplotting\live\datahandler.py", line 96, in _fill df = app.get_data(figid=figid, back=lookback) File "C:\Users\Four\AppData\Local\Programs\Python\Python39\lib\site-packages\btplotting\app.py", line 448, in get_data dt_idx = data_clock.get_dt_list(startidx, endidx) File "C:\Users\Four\AppData\Local\Programs\Python\Python39\lib\site-packages\btplotting\clock.py", line 214, in get_dt_list val = bt.num2date(val, tz=None if not localized else self._tz) File "C:\Users\Four\AppData\Local\Programs\Python\Python39\lib\site-packages\backtrader\utils\dateintern.py", line 165, in num2date ix = int(x) ValueError: cannot convert float NaN to integer
andWARNING:bokeh.server.views.ws:Failed sending message as connection was closed Exception in callback functools.partial(<bound method IOLoop._discard_future_result of <tornado.platform.asyncio.AsyncIOMainLoop object at 0x000001578A5C6A00>>, <Task finished name='Task-10353' coro=<_needs_document_lock.<locals>._needs_document_lock_wrapper() done, defined at C:\Users\Four\AppData\Local\Programs\Python\Python39\lib\site-packages\bokeh\server\session.py:51> exception=KeyError('index')>) Traceback (most recent call last): File "C:\Users\Four\AppData\Local\Programs\Python\Python39\lib\site-packages\tornado\ioloop.py", line 740, in _run_callback ret = callback() File "C:\Users\Four\AppData\Local\Programs\Python\Python39\lib\site-packages\tornado\ioloop.py", line 764, in _discard_future_result future.result() File "C:\Users\Four\AppData\Local\Programs\Python\Python39\lib\site-packages\bokeh\server\session.py", line 71, in _needs_document_lock_wrapper result = await result File "C:\Users\Four\AppData\Local\Programs\Python\Python39\lib\site-packages\tornado\gen.py", line 216, in wrapper result = ctx_run(func, *args, **kwargs) File "C:\Users\Four\AppData\Local\Programs\Python\Python39\lib\site-packages\btplotting\live\datahandler.py", line 42, in _cb_push p_data, s_data = fp.get_cds_patchdata_from_series(idx, patch) File "C:\Users\Four\AppData\Local\Programs\Python\Python39\lib\site-packages\btplotting\cds.py", line 166, in get_cds_patchdata_from_series idx_map = {d: idx for idx, d in enumerate(self._cds.data['index'])} KeyError: 'index'
someone help me fix it