From eb56a889a9ded9aaf4a5cfd17685c7298fa499f3 Mon Sep 17 00:00:00 2001 From: David Brazda Date: Wed, 26 Jun 2024 09:09:52 +0200 Subject: [PATCH 1/9] Update README.md --- README.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/README.md b/README.md index b88bf5a..99815cd 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,46 @@ Fork of lightweight-charts with enhancements and supporting proprietary workflow image +## Examples + +```python +from lightweight_charts import chart, Panel + +# Example usage +pane1 = Panel( + ohlcv=(t1data.data["BAC"],), #(series, entries, exits, other_markers) + histogram=[(order_imbalance_allvolume, "oivol",None, 0.3)], # [(series, name, "rgba(53, 94, 59, 0.6)", opacity)] + + #following attributes assign lineseries series to different priceScaleIds, format: # [(series, name, entries, exits, other_markers)] + right=[(bbands)], #multioutput indicator, outputs are autom.extracted + left=[(sma, "sma", short_signals, short_exits) #simple vbt indicator with markers in and outs + (supertrend.trend, "ST_trend") #explicitly just one output of multioutput indicator + ], + middle1=[], + middle2=[], +) + +pane2 = Panel( + ohlcv=(t1data.data["BAC"],), + right=[], + left=[(sma, "sma_below", short_signals, short_exits)], + middle1=[], + middle2=[], + histogram=[(order_imbalance_sma, "oisma")], +) + +ch = chart([pane1, pane2], sync=True, title="Title", size) + +#quick few liner +pane1 = Panel( + right=[(close, "close")], +) +ch = chart([pane1]) + +#one liner +close.lw.plot() + +```
From 9f9f22eb93848630725b6b323e102d6ca62f65ec Mon Sep 17 00:00:00 2001 From: David Brazda Date: Wed, 26 Jun 2024 14:21:43 +0200 Subject: [PATCH 2/9] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 99815cd..a82b98e 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ Fork of lightweight-charts with enhancements and supporting proprietary workflow * colored legends -* self picking colors +* automatic colors if not provided * support for left price scale -* support from pd series as input to set series +* supports series in df,pd.series or vectorbt indicator object * new markers_set method allowing to set pd.series or dataframe as markers input * allows vbt indicators as input for set() method (extracting real values series from that) From 9b8e43e1e883068c8beef0ab862ed6bb4c0068b8 Mon Sep 17 00:00:00 2001 From: David Brazda Date: Wed, 26 Jun 2024 14:23:51 +0200 Subject: [PATCH 3/9] Update README.md --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index a82b98e..67537f8 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,8 @@ Fork of lightweight-charts with enhancements and supporting proprietary workflow * colored legends * automatic colors if not provided * support for left price scale -* supports series in df,pd.series or vectorbt indicator object +* as inputs it supports df,pd.series or vectorbtpro indicator object (including multi outputs) for set() method * new markers_set method allowing to set pd.series or dataframe as markers input -* allows vbt indicators as input for set() method (extracting real values series from that) image From 105ea66731081c939125c0c48ad9ffc4c59feeda Mon Sep 17 00:00:00 2001 From: David Brazda Date: Wed, 26 Jun 2024 14:43:07 +0200 Subject: [PATCH 4/9] Update README.md --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 67537f8..51103bd 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,12 @@ Fork of lightweight-charts with enhancements and supporting proprietary workflow * colored legends * automatic colors if not provided -* support for left price scale -* as inputs it supports df,pd.series or vectorbtpro indicator object (including multi outputs) for set() method +* support for left and mid price scales +* as inputs it supports df,pd.series or vectorbtpro indicator object (including unpacking multi outputs) for set() method * new markers_set method allowing to set pd.series or dataframe as markers input +* supports simple df/sr accessors `close.lw.plot()` for quick visualization of single panel chart +* supports `ch = chart([pane1, pane2], sync=True, title="Title", size="m")` to quickly display chart with N panes (`Panels`). +* image From 6de9ba9c33e42369040e879fb91127d64228de33 Mon Sep 17 00:00:00 2001 From: David Brazda Date: Wed, 26 Jun 2024 14:50:07 +0200 Subject: [PATCH 5/9] Update README.md --- README.md | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 51103bd..f61fc01 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Fork of lightweight-charts with enhancements and supporting proprietary workflow * as inputs it supports df,pd.series or vectorbtpro indicator object (including unpacking multi outputs) for set() method * new markers_set method allowing to set pd.series or dataframe as markers input * supports simple df/sr accessors `close.lw.plot()` for quick visualization of single panel chart -* supports `ch = chart([pane1, pane2], sync=True, title="Title", size="m")` to quickly display chart with N panes (`Panels`). +* supports `ch = chart([pane1, pane2], sync=True, title="Title", size="m")` to quickly display chart with N panes (`Panels`). Also supports syncing the Panels `sync=True` or using xloc. * image @@ -15,7 +15,18 @@ Fork of lightweight-charts with enhancements and supporting proprietary workflow ```python from lightweight_charts import chart, Panel -# Example usage +#one liner, displays close series as line on single Panel +close.lw.plot() + +#quick few liner, displays close series with label "close" on right pricescale and rsi on left price scale, all on single Panel +pane1 = Panel( + right=[(close, "close")], + left=[(rsi,"rsi")] +) +ch = chart([pane1]) + +# display two Panels +# on first displays ohlcv data, orderimbalance volume as histogram with opacity, bbands on the right pricescale and sma with short_signals and short_exits on the left pricescale pane1 = Panel( ohlcv=(t1data.data["BAC"],), #(series, entries, exits, other_markers) histogram=[(order_imbalance_allvolume, "oivol",None, 0.3)], # [(series, name, "rgba(53, 94, 59, 0.6)", opacity)] @@ -28,7 +39,7 @@ pane1 = Panel( middle1=[], middle2=[], ) - +#on second panel displays also ohlcv data, and sma on the left pricescale and histogram pane2 = Panel( ohlcv=(t1data.data["BAC"],), right=[], @@ -38,16 +49,8 @@ pane2 = Panel( histogram=[(order_imbalance_sma, "oisma")], ) -ch = chart([pane1, pane2], sync=True, title="Title", size) - -#quick few liner -pane1 = Panel( - right=[(close, "close")], -) -ch = chart([pane1]) - -#one liner -close.lw.plot() +#display both Panels, sync them and pick size, use xloc +ch = chart([pane1, pane2], sync=True, title="Title", size="l", xloc=slice("1-1-2024","1-2-2024") ``` From 19b1834a6dc2558c7fe20fc3deb7df631f135128 Mon Sep 17 00:00:00 2001 From: David Brazda Date: Wed, 26 Jun 2024 14:50:20 +0200 Subject: [PATCH 6/9] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f61fc01..6c107b7 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Fork of lightweight-charts with enhancements and supporting proprietary workflow * new markers_set method allowing to set pd.series or dataframe as markers input * supports simple df/sr accessors `close.lw.plot()` for quick visualization of single panel chart * supports `ch = chart([pane1, pane2], sync=True, title="Title", size="m")` to quickly display chart with N panes (`Panels`). Also supports syncing the Panels `sync=True` or using xloc. -* + image From ea2f53b79470a9241ac607273560c46a3dff345c Mon Sep 17 00:00:00 2001 From: David Brazda Date: Wed, 26 Jun 2024 14:51:19 +0200 Subject: [PATCH 7/9] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6c107b7..9cf4d9a 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,8 @@ pane1 = Panel( ch = chart([pane1]) # display two Panels -# on first displays ohlcv data, orderimbalance volume as histogram with opacity, bbands on the right pricescale and sma with short_signals and short_exits on the left pricescale +# on first displays ohlcv data, orderimbalance volume as histogram with opacity, bbands on the right pricescale and +# sma with short_signals and short_exits on the left pricescale pane1 = Panel( ohlcv=(t1data.data["BAC"],), #(series, entries, exits, other_markers) histogram=[(order_imbalance_allvolume, "oivol",None, 0.3)], # [(series, name, "rgba(53, 94, 59, 0.6)", opacity)] From da029fcbb739d93c342fcc42d9fee99ff2166057 Mon Sep 17 00:00:00 2001 From: David Brazda Date: Wed, 26 Jun 2024 15:12:58 +0200 Subject: [PATCH 8/9] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9cf4d9a..6f8ecac 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Fork of lightweight-charts with enhancements and supporting proprietary workflow +Fork of original [lightweight-charts](louisnw01/lightweight-charts-python) with enhancements and supporting proprietary workflow * colored legends * automatic colors if not provided * support for left and mid price scales From c27401a59d0b47bc6d9a2735dc2ae814c05c6019 Mon Sep 17 00:00:00 2001 From: David Brazda Date: Thu, 27 Jun 2024 13:35:53 +0200 Subject: [PATCH 9/9] Update README.md --- README.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/README.md b/README.md index 6f8ecac..c51bff5 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,35 @@ ch = chart([pane1, pane2], sync=True, title="Title", size="l", xloc=slice("1-1-2 ``` +## Example with markers + +```python + +#assume i want to display simple entries or exits on series or ohlcv +#based on tuple positions it determines entries or exits (and set colors and shape accordingly) +pane1 = Panel( + ohlcv=(ohlcv_df, clean_long_entries, clean_short_entries) +) +ch = chart([pane1], title="Chart with Entry/Exit Markers", session=None, size="s") +``` +image + +```python +#if you want to display more entries or exits, use tuples with their colors + +# Create Panel with OHLC data and entry signals +pane1 = Panel( + ohlcv=(data.ohlcv.get(), + [(clean_long_entries, "yellow"), (clean_short_entries, "pink")], #list of entries tuples with color + [(clean_long_exits, "yellow"), (clean_short_exits, "pink")]), #list of exits tuples with color +) + +# # Create the chart with the panel +ch = chart([pane1], title="Chart with EntryShort/ExitShort (yellow) and EntryLong/ExitLong markers (pink)", sync=True, session=None, size="s") +``` +image + +
# lightweight-charts-python