Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 2.0 #326

Open
louisnw01 opened this issue Mar 30, 2024 · 29 comments
Open

Version 2.0 #326

louisnw01 opened this issue Mar 30, 2024 · 29 comments

Comments

@louisnw01
Copy link
Owner

louisnw01 commented Mar 30, 2024

Hello everyone!

I have created a new 2.0 branch which i’m planning on releasing in the coming days/weeks. It includes:

  • A complete rework of the backend, which now uses TypeScript
  • A rewrite of the drawing objects (written as plugins) including rectangles
  • Test cases

Now that we are using plugins (and the js/ts source code is readable!) I hope that it will be easier for others to contribute their own ideas, especially on the typescript/javascript side of things.

Some ideas that others could contribute:

  • Fib lines
  • Markers that can be placed at locations on the Y axis
  • Other control panel widgets

Any feedback/testing would be much appreciated!

To Install this branch:

  1. download/clone the 2.0 branch.
  2. in your own venv:
    • pip uninstall lightweight_charts
    • pip install -e path/to/lightweight-charts-python/lightweight_charts/

Louis

@louisnw01 louisnw01 pinned this issue Mar 30, 2024
@cilindro5432
Copy link

I could notice that the horizontal line uses 2 clicks and not 1 as before. changing colors in the lines and box work well. I could see that the center of the rectangle always remains gray and only the edges change color. deleting the drawings do not work or styles do not work either. Suggestion for styles to be able to adjust the tickness of the lines please. Otherwise it works very well, I will be testing it more thoroughly to see if I find more problems. A request for future fibbonacci retracement. Good job, the light weight charts python project looks better every day.

@cilindro5432
Copy link

After second click on horizontal line cant move again. if change time frame drawings desappear and When you return to the tf where the drawings were created, they appear.

@louisnw01
Copy link
Owner Author

Thanks for your feedback @cilindro5432, ill get those ironed out soon.

@alloc7260
Copy link

@louisnw01 How to use this new 2.0 version
please guide through installation??

@Iss-in
Copy link

Iss-in commented Apr 5, 2024

I would love if you can simply make the drawing tools color/behaviour default to same as in tradingview app. They are pretty good already

@axalon
Copy link

axalon commented Apr 6, 2024

Great to hear, thanks for all your work on this @louisnw01 !

Will there be support for PyQt6 in this version?

@armeya25
Copy link

armeya25 commented Apr 9, 2024

I have waited for long for BOX / RECTANGLE to be implemented thanks for your great work.
I am using something like FIBs in my project maybe after 2.0 I will help but only in python.

One suggestion if possible add some examples for BANDs like macd.
Also make separate SECTION for questions and answers,
Maybe discord also

@bobest
Copy link

bobest commented Apr 12, 2024

Hello, can someone help me set up lightweight-charts on Ubuntu 20.4 WLS Installation? I managed to get a static chart but no live one, I get an error about python gtk which I cannot resolve. I use Python 3.11 on Anaconda. Sorry for posting this, maybe a Q&A like armeya25 said would be usefull

@louisnw01
Copy link
Owner Author

I could notice that the horizontal line uses 2 clicks and not 1 as before. changing colors in the lines and box work well. I could see that the center of the rectangle always remains gray and only the edges change color. deleting the drawings do not work or styles do not work either. Suggestion for styles to be able to adjust the tickness of the lines please. Otherwise it works very well, I will be testing it more thoroughly to see if I find more problems. A request for future fibbonacci retracement. Good job, the light weight charts python project looks better every day.

horizontal lines are back to a single click, delete should work now.

Louis

@louisnw01
Copy link
Owner Author

@louisnw01 How to use this new 2.0 version please guide through installation??

I have added an installation section to this issue.

Louis

@cilindro5432
Copy link

Hi Mr. Lois
In the latest version notice that a horizontal line is created with one click and not 2 and the new vertical line uses 2 clicks instead of one. The way clicks are implemented shouldn't matter after they work. I use the Oanda API to get the data. In the first version of the Light weight chart 2.0 I could draw with the problems I had but the drawings were still visible. In this latest version it keeps the drawings in static data but with tick data the drawings disappear from the chart when updating. I tried saving and loading the drawings in drawings.json and it doesn't save or load the drawings. I don't know if it's my mistake but try to verify it as soon as you can. In the previous version it had a handler error at the beginning that many times it did not open the app and other times it did, that was resolved in the latest version and it works very well. Anyway, this latest version works better than the previous one, it's just that the drawings with tick data don't work well for me and the previous version does. Could you tell me which specific files I need to manipulate to control the thinness of the lines, if possible? In the previous version as in this last one I found the same error in the price scale. When you press click and slide up and down the image of the candles look as if the candles were reduced or enlarged. The image does not stay in that position where I left it, in seconds it returns to its original state.

@cilindro5432
Copy link

@armeya25 If you dont have any or just a little knolodge in python try chat gpt to setup your chat.

@armeya25
Copy link

armeya25 commented Apr 19, 2024

@armeya25 If you dont have any or just a little knolodge in python try chat gpt to setup your chat.

I am noob in python but I used lightweight charts before it was working fine for 2.0 it's shows error for same code that was working fine for older version of lightweight charts

@cilindro5432
Copy link

@armeya25 If you dont have any or just a little knolodge in python try chat gpt to setup your chat.

I am noob in python but I used lightweight charts before it was working fine for 2.0 it's shows error for same code that was working fine for older version of lightweight charts

I had some issues with my code too in first version of this branch. The first version of this branch had several problems when starting the app. I had to modify my code. The second version does not have these problems, try with the latest update of light weight charts. As I told you, if you don't have much experience in python, chat gpt can help you a lot, it can identify errors more clearly.

@armeya25
Copy link

export WEBKIT_DISABLE_COMPOSITING_MODE="1"

After this command works on arch linux i3wm

@armeya25
Copy link

@louisnw01 box implementation working or not
Test works fine but It didn't draw box
This is code,
What I am doing wrong here

#344

@cilindro5432
Copy link

@armeya25
Copy link

armeya25 commented May 4, 2024

the drawings disappear https://github.com/louisnw01/lightweight-charts-python/assets/150294229/31d06830-ee18-4c2a-b34f-c9431d19eecc

My drawing doesn't disappeared though,
But it's only working on manual drawing,
Chart.box() doesn't draw it automatically

@armeya25
Copy link

armeya25 commented May 4, 2024

Should that also be raised as big ?

@cilindro5432
Copy link

@armeya25

"A complete rework of the backend, which now uses TypeScript
A rewrite of the drawing objects (written as plugins) including rectangles
Test cases
Now that we are using plugins (and the js/ts source code is readable!) I hope that it will be easier for others to contribute their own ideas, especially on the typescript/javascript side of things.

Some ideas that others could contribute:

Fib lines
### Markers that can be placed at locations on the Y axis
Other control panel widgets
Any feedback/testing would be much appreciated!"

You want a marker as rectangle. Now is time to be creative

@Tapanhaz
Copy link

Tapanhaz commented May 9, 2024

It gives error :
DEBUG:PyQt5.uic.uiparser:pop widget QStatusBar statusbar
DEBUG:PyQt5.uic.uiparser:new topwidget MainWindow
DEBUG:PyQt5.uic.uiparser:pop widget QMainWindow MainWindow
DEBUG:PyQt5.uic.uiparser:new topwidget None
Traceback (most recent call last):
File "D:\Installed_Python\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "D:\Installed_Python\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "E:\Works\Project VI\charting\chart_project_1_prblm.py", line 711, in
window = HistoricalChart()
File "E:\Works\Project VI\charting\chart_project_1_prblm.py", line 121, in init
self.chart = QtChart(self, toolbox=True)
File "D:\Py_Env\v311\lib\site-packages\lightweight_charts\widgets.py", line 89, in init
{abstract.TEMPLATE[:85]}
AttributeError: module 'lightweight_charts.abstract' has no attribute 'TEMPLATE'

@emma-uw
Copy link

emma-uw commented May 15, 2024

My app has a lot of early development rust on it at this point. Very excited for the next 2.0 release so I can finally rebuild it.

Thanks for your hard work, Louis. Without this library a lot of the ideas would just stay in our heads forever.

@amirzamli
Copy link

Encountered a bug in 2.0 presented here:
#362

@anilwarbhe
Copy link

anilwarbhe commented May 22, 2024

in python-lightweight-charts v 2.0 adding marker throwing the following error:

chart.marker(time=date.at[i], position = 'above', shape= 'arrow_down', color= 'red', text ='SEXIT')

Exception in thread Thread-2 (loop):
Traceback (most recent call last):
File "/home/anil/pyprojects/trado5/lightweight-charts-python/lightweight_charts/chart.py", line 89, in loop
window.evaluate_js(arg)
File "/home/anil/pyprojects/trado5/venv5/lib/python3.11/site-packages/webview/window.py", line 50, in wrapper
return function(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/anil/pyprojects/trado5/venv5/lib/python3.11/site-packages/webview/window.py", line 444, in evaluate_js
raise JavascriptException(result)
webview.errors.JavascriptException: {'name': 'SyntaxError', 'message': "Unexpected number '09'. Expected '}' to end an object literal.", 'line': 4, 'column': 33, 'sourceURL': 'http://127.0.0.1:52941/test.html', 'stack': 'eval@[native code]\nglobal code@http://127.0.0.1:52941/test.html:4:33'}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
self.run()
File "/usr/lib/python3.11/threading.py", line 975, in run
self._target(*self._args, **self._kwargs)
File "/home/anil/pyprojects/trado5/lightweight-charts-python/lightweight_charts/chart.py", line 94, in loop
raise JavascriptException(f"\n\nscript -> '{arg}',\nerror -> {msg['name']}[{msg['line']}:{msg['column']}]\n{msg['message']}")
webview.errors.JavascriptException:

script -> '
window.dppwcgvk.markers.push({
time: 2024-04-24 09:15:00,
position: 'aboveBar',
color: 'red',
shape: 'arrowDown',
text: 'SEXIT 349.8',
id: 'window.zcmtakbs'
});
window.dppwcgvk.series.setMarkers(window.dppwcgvk.markers)',
error -> SyntaxError[4:33]
Unexpected number '09'. Expected '}' to end an object literal.

@Tapanhaz
Copy link

Tapanhaz commented May 23, 2024

Is this v2.0 based on https://github.com/rwitzlib/lightweight-charts fork ?

@louisnw01
Copy link
Owner Author

Is this v2.0 based on https://github.com/rwitzlib/lightweight-charts fork ?

Nope; all drawing plugins have only been written by me (so far)

@louisnw01
Copy link
Owner Author

in python-lightweight-charts v 2.0 adding marker throwing the following error:

chart.marker(time=date.at[i], position = 'above', shape= 'arrow_down', color= 'red', text ='SEXIT')

Exception in thread Thread-2 (loop): Traceback (most recent call last): File "/home/anil/pyprojects/trado5/lightweight-charts-python/lightweight_charts/chart.py", line 89, in loop window.evaluate_js(arg) File "/home/anil/pyprojects/trado5/venv5/lib/python3.11/site-packages/webview/window.py", line 50, in wrapper return function(self, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/anil/pyprojects/trado5/venv5/lib/python3.11/site-packages/webview/window.py", line 444, in evaluate_js raise JavascriptException(result) webview.errors.JavascriptException: {'name': 'SyntaxError', 'message': "Unexpected number '09'. Expected '}' to end an object literal.", 'line': 4, 'column': 33, 'sourceURL': 'http://127.0.0.1:52941/test.html', 'stack': 'eval@[native code]\nglobal code@http://127.0.0.1:52941/test.html:4:33'}

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.11/threading.py", line 1038, in _bootstrap_inner self.run() File "/usr/lib/python3.11/threading.py", line 975, in run self._target(*self._args, **self._kwargs) File "/home/anil/pyprojects/trado5/lightweight-charts-python/lightweight_charts/chart.py", line 94, in loop raise JavascriptException(f"\n\nscript -> '{arg}',\nerror -> {msg['name']}[{msg['line']}:{msg['column']}]\n{msg['message']}") webview.errors.JavascriptException:

script -> ' window.dppwcgvk.markers.push({ time: 2024-04-24 09:15:00, position: 'aboveBar', color: 'red', shape: 'arrowDown', text: 'SEXIT 349.8', id: 'window.zcmtakbs' }); window.dppwcgvk.series.setMarkers(window.dppwcgvk.markers)', error -> SyntaxError[4:33] Unexpected number '09'. Expected '}' to end an object literal.

Fixed

@anilwarbhe
Copy link

I am receiving following error when I am doing following:

  1. I have created lines
  2. I have set the lines
  3. I delete all the lines
  4. I am creating the lines again
  5. I am setting them again

When I get a bar data for a perticulat stock I create indicators and set them. I search the stock and set the candle data for another stock and now I have to delete the old indicator lines and recreate and reset them.

Exception in thread Thread-2 (loop):
Traceback (most recent call last):
File "/home/anil/pyprojects/trado5/lightweight-charts-python/lightweight_charts/chart.py", line 89, in loop
window.evaluate_js(arg)
File "/home/anil/pyprojects/trado5/venv5/lib/python3.11/site-packages/webview/window.py", line 50, in wrapper
return function(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/anil/pyprojects/trado5/venv5/lib/python3.11/site-packages/webview/window.py", line 444, in evaluate_js
raise JavascriptException(result)
webview.errors.JavascriptException: {'name': 'TypeError', 'message': "undefined is not an object (evaluating 'window.vcaisayp.legend.lines.forEach')", 'line': 3, 'column': 41, 'stack': 'eval code@\neval@[native code]\nglobal code@http://127.0.0.1:32628/test.html:4:33'}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
self.run()
File "/usr/lib/python3.11/threading.py", line 975, in run
self._target(*self._args, **self._kwargs)
File "/home/anil/pyprojects/trado5/lightweight-charts-python/lightweight_charts/chart.py", line 94, in loop
raise JavascriptException(f"\n\nscript -> '{arg}',\nerror -> {msg['name']}[{msg['line']}:{msg['column']}]\n{msg['message']}")
webview.errors.JavascriptException:

@emma-uw
Copy link

emma-uw commented May 25, 2024

@louisnw01 I think clear_markers missing self._update_markers() call after the clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests