Skip to content

Commit 5453759

Browse files
authored
Merge pull request #385 from louisnw01/2.0
2.0
2 parents d34acfb + e4f53a8 commit 5453759

89 files changed

Lines changed: 5824 additions & 2373 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ ___
2222
## Features
2323
1. Streamlined for live data, with methods for updating directly from tick data.
2424
2. Multi-pane charts using [Subcharts](https://lightweight-charts-python.readthedocs.io/en/latest/reference/abstract_chart.html#AbstractChart.create_subchart).
25-
3. The [Toolbox](https://lightweight-charts-python.readthedocs.io/en/latest/reference/toolbox.html), allowing for trendlines, rays and horizontal lines to be drawn directly onto charts.
25+
3. The [Toolbox](https://lightweight-charts-python.readthedocs.io/en/latest/reference/toolbox.html), allowing for trendlines, rectangles, rays and horizontal lines to be drawn directly onto charts.
2626
4. [Events](https://lightweight-charts-python.readthedocs.io/en/latest/tutorials/events.html) allowing for timeframe selectors (1min, 5min, 30min etc.), searching, hotkeys, and more.
2727
5. [Tables](https://lightweight-charts-python.readthedocs.io/en/latest/reference/tables.html) for watchlists, order entry, and trade management.
2828
6. Direct integration of market data through [Polygon.io's](https://polygon.io/?utm_source=affiliate&utm_campaign=pythonlwcharts) market data API.
2929

30-
__Supports:__ Jupyter Notebooks, PyQt5, PySide6, wxPython, Streamlit, and asyncio.
30+
__Supports:__ Jupyter Notebooks, PyQt6, PyQt5, PySide6, wxPython, Streamlit, and asyncio.
3131

3232
PartTimeLarry: [Interactive Brokers API and TradingView Charts in Python](https://www.youtube.com/watch?v=TlhDI3PforA)
3333
___

build.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env bash
2+
3+
GREEN='\033[0;32m'
4+
RED='\033[0;31m'
5+
YELLOW='\033[0;33m'
6+
CYAN='\033[0;36m'
7+
NC='\033[0m'
8+
9+
ERROR="${RED}[ERROR]${NC} "
10+
INFO="${CYAN}[INFO]${NC} "
11+
WARNING="${WARNING}[WARNING]${NC} "
12+
13+
rm -rf dist/bundle.js dist/typings/
14+
15+
if [[ $? -eq 0 ]]; then
16+
echo -e "${INFO}deleted bundle.js and typings.."
17+
else
18+
echo -e "${WARNING}could not delete old dist files, continuing.."
19+
fi
20+
21+
npx rollup -c rollup.config.js
22+
if [[ $? -ne 0 ]]; then
23+
exit 1
24+
fi
25+
26+
cp dist/bundle.js src/general/styles.css lightweight_charts/js
27+
if [[ $? -eq 0 ]]; then
28+
echo -e "${INFO}copied bundle.js, style.css into python package"
29+
else
30+
echo -e "${ERROR}could not copy dist into python package ?"
31+
exit 1
32+
fi
33+
echo -e "\n${GREEN}[BUILD SUCCESS]${NC}"
34+

docs/source/examples/gui_examples.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Alternative GUI's
22

33

4-
## PyQt5 / PySide6
4+
## PyQt6 / PyQt5 / PySide6
55

66
```python
77
import pandas as pd

docs/source/examples/toolbox.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def on_timeframe_selection(chart):
3636
if new_data.empty:
3737
return
3838
# The symbol has not changed, so we want to re-render the drawings.
39-
chart.set(new_data, render_drawings=True)
39+
chart.set(new_data, keep_drawings=True)
4040

4141

4242
if __name__ == '__main__':

docs/source/polygon.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ The `websockets` library is required when using live data.
2222
2323
```{important}
2424
When using live data and the standard `show` method, the `block` parameter __must__ be set to `True` in order for the data to congregate on the chart (`chart.show(block=True)`).
25-
If `show_async` is used with live data, `block` can be either value.
25+
`show_async` can also be used with live data.
2626
2727
```
2828

docs/source/reference/abstract_chart.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ___
88
99
1010
11-
```{py:method} set(data: pd.DataFrame, render_drawings: bool = False)
11+
```{py:method} set(data: pd.DataFrame, keep_drawings: bool = False)
1212
Sets the initial data for the chart.
1313
1414
@@ -17,17 +17,19 @@ Columns should be named:
1717
1818
Time can be given in the index rather than a column, and volume can be omitted if volume is not used. Column names are not case sensitive.
1919
20-
If `render_drawings` is `True`, any drawings made using the `toolbox` will be redrawn with the new data. This is designed to be used when switching to a different timeframe of the same symbol.
20+
If `keep_drawings` is `True`, any drawings made using the `toolbox` will be redrawn with the new data. This is designed to be used when switching to a different timeframe of the same symbol.
2121
2222
`None` can also be given, which will erase all candle and volume data displayed on the chart.
23+
24+
You can also add columns to color the candles (https://tradingview.github.io/lightweight-charts/tutorials/customization/data-points)
2325
```
2426
2527
2628
___
2729
2830
2931
30-
```{py:method} update(series: pd.Series, render_drawings: bool = False)
32+
```{py:method} update(series: pd.Series, keep_drawings: bool = False)
3133
Updates the chart data from a bar.
3234
3335
Series labels should be akin to [`set`](#AbstractChart.set).

docs/source/reference/charts.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ ___
4545
4646
4747
48-
```{py:method} show_async(block: bool)
48+
```{py:method} show_async()
4949
:async:
5050
5151
Show the chart asynchronously.
@@ -85,7 +85,7 @@ ___
8585
8686
The `QtChart` object allows the use of charts within a `QMainWindow` object, and has similar functionality to the `Chart` object for manipulating data, configuring and styling.
8787
88-
Either the `PyQt5` or `PySide6` libraries will work with this chart.
88+
Either the `PyQt5`, `PyQt6` or `PySide6` libraries will work with this chart.
8989
9090
Callbacks can be received through the Qt event loop.
9191
___

docs/source/reference/events.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ Fires when the range (visibleLogicalRange) changes.
2222
2323
```
2424
25+
```{py:method} click -> (chart: Chart, time: NUM, price: NUM)
26+
Fires when the mouse is clicked, returning the time and price of the clicked location.
27+
28+
```
29+
2530
````
2631

2732
Tutorial: [Topbar & Events](../tutorials/events.md)

docs/source/tutorials/events.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ async def update_clock(chart):
101101
async def main():
102102
chart = Chart()
103103
chart.topbar.textbox('clock')
104-
await asyncio.gather(chart.show_async(block=True), update_clock(chart))
104+
await asyncio.gather(chart.show_async(), update_clock(chart))
105105

106106

107107
if __name__ == '__main__':
@@ -130,7 +130,6 @@ async def data_loop(chart):
130130
return
131131
chart.update_from_tick(ticks.iloc[i])
132132
await asyncio.sleep(0.03)
133-
i += 1
134133

135134

136135
def on_new_bar(chart):
@@ -150,7 +149,7 @@ async def main():
150149
df = pd.read_csv('ohlc.csv')
151150

152151
chart.set(df)
153-
await asyncio.gather(chart.show_async(block=True), data_loop(chart))
152+
await asyncio.gather(chart.show_async(), data_loop(chart))
154153

155154

156155
if __name__ == '__main__':

index.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<!-- redirect to example page -->
5+
<meta http-equiv="refresh" content="0; URL=src/example/" />
6+
</head>
7+
</html>

0 commit comments

Comments
 (0)