Skip to content

Add Features: Area & Bar & custom Candlestick series types, Grouping series in Legend, + plugins: Trend Trace, Fill area between 2 series, VolumeProfile, + Indicators, Settings+Context menu #473

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

Open
wants to merge 123 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
402f935
Update handler.ts
EsIstJosh Oct 27, 2024
042dcfc
Update abstract.py
EsIstJosh Oct 27, 2024
4b574a5
Update abstract.py
EsIstJosh Oct 27, 2024
5e52329
Update handler.ts
EsIstJosh Oct 27, 2024
49d49ab
Update bundle.js
EsIstJosh Oct 27, 2024
899ddb1
Update abstract.py
EsIstJosh Oct 27, 2024
a981127
Update abstract.py
EsIstJosh Oct 28, 2024
6720a48
Added LegendGroup
EsIstJosh Oct 30, 2024
3ec9692
handle LegendGroups
EsIstJosh Oct 30, 2024
d57734e
Add group parameter to Line, .create_line
EsIstJosh Oct 30, 2024
541296f
Merge pull request #1 from EsIstJosh/LegendGroup
EsIstJosh Oct 30, 2024
288c222
Update bundle.js
EsIstJosh Oct 31, 2024
7038770
Add group, legend_symbol to Area, Histogram, Bar series types
EsIstJosh Oct 31, 2024
5d54397
Add legend_symbol, group to series types
EsIstJosh Oct 31, 2024
3cd9166
Add legend_symbol, group to series types
EsIstJosh Oct 31, 2024
d17365b
Update bundle.js
EsIstJosh Oct 31, 2024
d3aa486
Re-Implement Legend Groups
EsIstJosh Nov 12, 2024
24cbb2d
Export LegendItem interface for use in handler, legend
EsIstJosh Nov 12, 2024
cb4146d
Adapt to changes made in legend.ts
EsIstJosh Nov 12, 2024
a02e92d
Add Custom Candle Series Renderer with Aggregation and Advanced Drawi…
EsIstJosh Nov 16, 2024
148ce64
Update renderer.ts
EsIstJosh Nov 17, 2024
af3647f
add bar_width option
EsIstJosh Nov 17, 2024
ec4fa2d
Enhance bar specific rendering logic
EsIstJosh Nov 20, 2024
a8c4d11
Update ohlc-series.ts
EsIstJosh Nov 20, 2024
f2515fc
Add files via upload
EsIstJosh Nov 20, 2024
e3af7d5
Enhance: Context Menu
EsIstJosh Dec 13, 2024
5983882
Improve Context Menu
EsIstJosh Dec 14, 2024
0c64eb9
Update and rename abstract.py to a
EsIstJosh Dec 14, 2024
dac0b5d
Fix minor issues in context menu, ohlc series, formatting
EsIstJosh Dec 30, 2024
3860bda
Merge branch 'plugin-CustomCandles' of https://github.com/EsIstJosh/l…
EsIstJosh Dec 30, 2024
8d42803
fix legend display for ohlc series
EsIstJosh Dec 31, 2024
76f8b5d
Merge pull request #2 from EsIstJosh/plugin-CustomCandles
EsIstJosh Jan 4, 2025
8f71b2a
Add feature: Trend Trace
EsIstJosh Jan 20, 2025
ad4e91b
fix line trace
EsIstJosh Jan 20, 2025
38b087f
Add Feature: VolumeProfile, other minor improvements.
EsIstJosh Jan 24, 2025
da11ce7
minor improvements
EsIstJosh Jan 24, 2025
f69f488
Merge pull request #4 from EsIstJosh/plugin-CustomCandles
EsIstJosh Jan 24, 2025
dc61e82
Bump vite from 4.5.5 to 4.5.6
dependabot[bot] Jan 24, 2025
f814c52
Merge pull request #5 from EsIstJosh/dependabot/npm_and_yarn/vite-4.5.6
EsIstJosh Jan 24, 2025
1dd5dc8
bug fixes
EsIstJosh Jan 24, 2025
bae5e51
Merge pull request #6 from EsIstJosh/dev
EsIstJosh Jan 24, 2025
acc58ac
minor improvements
EsIstJosh Jan 25, 2025
195dd49
Legend Improvements
EsIstJosh Jan 29, 2025
1d5bd70
Merge pull request #7 from EsIstJosh/dev
EsIstJosh Jan 29, 2025
7e43af5
add Indicators from KLineCharts
EsIstJosh Jan 30, 2025
944a288
Merge pull request #8 from EsIstJosh/dev
EsIstJosh Jan 30, 2025
fe8e1fe
legend bug fixes
EsIstJosh Jan 30, 2025
4f2ae82
Merge pull request #9 from EsIstJosh/dev
EsIstJosh Jan 30, 2025
1facb55
Add more indicators from pinescript
EsIstJosh Jan 30, 2025
a34e80b
bug fixes
EsIstJosh Jan 30, 2025
635f7f3
Merge pull request #10 from EsIstJosh/dev
EsIstJosh Jan 30, 2025
73d44b1
Update to lightweight-charts v5.0.1
EsIstJosh Feb 1, 2025
14213b3
Merge pull request #11 from EsIstJosh/dev
EsIstJosh Feb 1, 2025
3eac9df
Add Pitchfork Indicator
EsIstJosh Feb 7, 2025
e835f6e
Merge pull request #12 from EsIstJosh/dev
EsIstJosh Feb 7, 2025
42d8a34
Added saving options
EsIstJosh Feb 7, 2025
b7a8221
Merge pull request #13 from EsIstJosh/dev
EsIstJosh Feb 7, 2025
f7b264a
update packages
EsIstJosh Feb 7, 2025
a7901d6
fix
EsIstJosh Feb 7, 2025
4141321
Merge branch 'main' into dev
EsIstJosh Feb 7, 2025
8e9b98c
Merge pull request #14 from EsIstJosh/dev
EsIstJosh Feb 7, 2025
0b6c75f
Update README.md
EsIstJosh Feb 7, 2025
7de2b27
Add files via upload
EsIstJosh Feb 7, 2025
dac3900
Update README.md
EsIstJosh Feb 7, 2025
894fd3b
Update README.md
EsIstJosh Feb 7, 2025
84b33e0
Rename Screenshot 2025-02-07 114921.png to Screenshot2025-02-07114921…
EsIstJosh Feb 7, 2025
89f98c9
Update README.md
EsIstJosh Feb 7, 2025
34e0884
Update README.md
EsIstJosh Feb 7, 2025
bca8396
Update README.md
EsIstJosh Feb 7, 2025
469665e
settings menu
EsIstJosh Feb 8, 2025
7016f3e
Merge branch 'dev' of https://github.com/EsIstJosh/lightweight-charts…
EsIstJosh Feb 8, 2025
290e083
Merge pull request #15 from EsIstJosh/dev
EsIstJosh Feb 8, 2025
e71c837
Rename LICENSE to MIT_LICENSE
EsIstJosh Feb 16, 2025
f02db55
Create AGPL_LICENSE
EsIstJosh Feb 16, 2025
3e066a9
minor improvements, adopt AGPL license to allow for pinets implementa…
EsIstJosh Feb 16, 2025
7855c94
Update README.md
EsIstJosh Feb 16, 2025
43a17ff
minor improvements
EsIstJosh Feb 17, 2025
af45ba5
PineTS integration
EsIstJosh Mar 1, 2025
6a24d08
Merge pull request #16 from EsIstJosh/pinets
EsIstJosh Mar 2, 2025
e869aea
Bump esbuild and vite
dependabot[bot] Mar 7, 2025
046c5db
Merge pull request #17 from EsIstJosh/dependabot/npm_and_yarn/multi-e…
EsIstJosh Mar 7, 2025
1c21ac3
Symbol Series, improve trend trace, fixes
EsIstJosh Mar 14, 2025
9e9d436
Merge pull request #18 from EsIstJosh/dev
EsIstJosh Mar 14, 2025
87af153
Update and rename pinets.dev.es.js to .old
EsIstJosh Mar 14, 2025
95d28fa
Update README.md
EsIstJosh Mar 14, 2025
4874ad1
Update README.md
EsIstJosh Mar 14, 2025
b922517
Update README.md
EsIstJosh Mar 14, 2025
637ed5e
Update README.md
EsIstJosh Mar 14, 2025
5accbb3
Update README.md
EsIstJosh Mar 16, 2025
ec7693a
pinets optimization, line fill
EsIstJosh Mar 17, 2025
7c3861c
package-lock
EsIstJosh Mar 17, 2025
311270d
Merge branch 'main' into dev
EsIstJosh Mar 17, 2025
d7aeb37
Merge pull request #19 from EsIstJosh/dev
EsIstJosh Mar 17, 2025
85841ae
optimize live pineTS calc
EsIstJosh Mar 17, 2025
f18d2f2
Merge branch 'dev' of https://github.com/EsIstJosh/lightweight-charts…
EsIstJosh Mar 17, 2025
2ec1fa1
Merge pull request #20 from EsIstJosh/dev
EsIstJosh Mar 17, 2025
fc2ec0b
fix
EsIstJosh Mar 17, 2025
4e253b6
Merge pull request #21 from EsIstJosh/dev
EsIstJosh Mar 17, 2025
e1f51e5
Bump vite from 6.2.1 to 6.2.3
dependabot[bot] Mar 31, 2025
51573e3
Update colors.ts
EsIstJosh Mar 31, 2025
6e8e8c2
Merge pull request #22 from EsIstJosh/dependabot/npm_and_yarn/vite-6.2.3
EsIstJosh Mar 31, 2025
54059ed
Potential fix for code scanning alert no. 59: Prototype-polluting fun…
EsIstJosh Mar 31, 2025
2a6c267
Create codacy.yml
EsIstJosh Mar 31, 2025
71f038b
Merge pull request #23 from EsIstJosh/dev
EsIstJosh Mar 31, 2025
34197c5
Bump vite from 6.2.3 to 6.2.4
dependabot[bot] Apr 1, 2025
c87c7b6
Merge pull request #24 from EsIstJosh/dependabot/npm_and_yarn/vite-6.2.4
EsIstJosh Apr 5, 2025
a1960fe
Bump vite from 6.2.4 to 6.2.5
dependabot[bot] Apr 5, 2025
55210cb
Merge pull request #26 from EsIstJosh/dependabot/npm_and_yarn/vite-6.2.5
EsIstJosh Apr 5, 2025
54642f8
minor fixes
EsIstJosh Apr 9, 2025
4928847
add python method for symbol series
EsIstJosh Apr 18, 2025
36d13b2
update
EsIstJosh Apr 18, 2025
48688dc
fix
EsIstJosh Apr 18, 2025
34fbb12
fix
EsIstJosh Apr 18, 2025
198ad0d
f
EsIstJosh Apr 18, 2025
1893897
fix
EsIstJosh Apr 18, 2025
625d198
Merge branch 'main' into dev
EsIstJosh Apr 18, 2025
f78e6b1
Merge pull request #29 from EsIstJosh/dev
EsIstJosh Apr 18, 2025
e4a9cdb
Rename
EsIstJosh Apr 18, 2025
578428e
fix
EsIstJosh Apr 18, 2025
0586871
Merge branch 'dev' of https://github.com/esistjosh/lightweight-charts…
EsIstJosh Apr 18, 2025
accb57e
Merge pull request #30 from EsIstJosh/dev
EsIstJosh Apr 18, 2025
cde6d5a
rename
EsIstJosh Apr 18, 2025
381f506
Merge pull request #31 from EsIstJosh/dev
EsIstJosh Apr 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/codacy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# This workflow checks out code, performs a Codacy security scan
# and integrates the results with the
# GitHub Advanced Security code scanning feature. For more information on
# the Codacy security scan action usage and parameters, see
# https://github.com/codacy/codacy-analysis-cli-action.
# For more information on Codacy Analysis CLI in general, see
# https://github.com/codacy/codacy-analysis-cli.

name: Codacy Security Scan

on:
push:
branches: [ "main" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
schedule:
- cron: '31 3 * * 0'

permissions:
contents: read

jobs:
codacy-security-scan:
permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
name: Codacy Security Scan
runs-on: ubuntu-latest
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout code
uses: actions/checkout@v4

# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
- name: Run Codacy Analysis CLI
uses: codacy/codacy-analysis-cli-action@d840f886c4bd4edc059706d09c6a1586111c540b
with:
# Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository
# You can also omit the token and run the tools that support default configurations
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
verbose: true
output: results.sarif
format: sarif
# Adjust severity of non-security issues
gh-code-scanning-compat: true
# Force 0 exit code to allow SARIF file generation
# This will handover control about PR rejection to the GitHub side
max-allowed-issues: 2147483647

# Upload the SARIF file generated in the previous step
- name: Upload SARIF results file
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarif
1 change: 1 addition & 0 deletions .vscode/configurationCache.log
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"buildTargets":[],"launchTargets":[],"customConfigurationProvider":{"workspaceBrowse":{"browsePath":[],"compilerArgs":[]},"fileIndex":[]}}
661 changes: 661 additions & 0 deletions AGPL_LICENSE

Large diffs are not rendered by default.

File renamed without changes.
137 changes: 130 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,139 @@
<div align="center">

# lightweight-charts-python

[![PyPi Release](https://img.shields.io/pypi/v/lightweight-charts?color=32a852&label=PyPi)](https://pypi.org/project/lightweight-charts/)
[![Made with Python](https://img.shields.io/badge/Python-3.8+-c7a002?logo=python&logoColor=white)](https://python.org "Go to Python homepage")
[![License](https://img.shields.io/github/license/louisnw01/lightweight-charts-python?color=9c2400)](https://github.com/louisnw01/lightweight-charts-python/blob/main/LICENSE)
## Forked to Add Features
![Cover Image](https://raw.githubusercontent.com/EsIstJosh/lightweight-charts-python/main/Screenshot2025-02-07114921.png)

### PineTS integration (original PineTS source: https://github.com/alaa-eddine/PineTS, edited source: https://github.com/EsIstJosh/PineTS)
### PineTS related code is licensed seperately using the AGPL3.0 license: [AGPL License](./AGPL_LICENSE)
Simple scripting capabilities similar to pinescript,
see the [PineTS ReadMe](https://github.com/EsIstJosh/PineTS/blob/bd79b7f2d21d15f7470da118eab4f71638ce07da/README.md)
for more information


![ezgif-88d432c58012aa](https://github.com/user-attachments/assets/ffbe2b3d-6be6-4d1f-8b42-86e950800712)




### Series Types
- Area
- Bar
- Custom Candlestick implementation
| | |
V V V
- Capable of candle data aggregation
for displaying multiple timeframes
simultaneously
- Customizable Line Width
- Customizable Line Style
- Customizable Bar Spacing
- Customizable Shape:
- Rectangle
- Rounded
- Ellipse
- Arrow
- Polygon
- Bar
- 3d
- Volume Color Opacity


### Plugins
- Fill Area: Shades the area between two series.
- Pitch Fork: Tool for drawing (added to toolbox):
- Standard
- Schiff
- Modified Schiff
- Inside
- Volume Profile: Displays volume profiles based on the visible range and supports drawing.

- Trend Trace: A transformable/scalable replica of a section of series between a drawings points. Similar to 'Bars Pattern' in TradingView (instantiated from and linked to existing drawing: box, trendline etc)


### Indicators (implemented in typescript, from KLineChart primarily ( https://github.com/klinecharts/KLineChart ))

Overlay Indicators:
- Arnaud Legoux Moving Average
- Bollinger Bands
- Exponential Moving Average
- Highest High
- Highest High Lowest Low
- Linear Regression Indicator
- Lowest Low
- Median
- Moving Average
- Rolling Moving Average
- Simple Moving Average
- Stop and Reverse
- Super Trend
- Symmetric Weighted Moving Average
- Triple Exponentially Smoothed Average
- Volume Weighted Average Price
- Volume Weighted Moving Average
- Weighted Moving Average

Oscillator Indicators:
- Awesome Oscillator
- Average True Range
- Bias
- BRAR
- Bull and Bear Index
- Commodity Channel Index
- Current Ratio
- Difference of Moving Average
- Directional Movement Index
- Momentum
- Moving Average Convergence Divergence
- Psychological Line
- Rate of Change
- Relative Strength Index
- Stochastic Oscillator
- Variance
- Williams %R
- Change
- Range
- Standard Deviation

### Context Menu
- Upgraded context menu for better control over chart/series/primitive settings.
- Ability to save options for chart, series, and primitives to JSON.

### Legend
- Upgraded to allow for collapsible grouping of series.
- Tree-style display of groups > series > primitives.

### Series Cloning / Type Conversion
- Simple cloning to different series types




## License

Unless otherwise stated, all code in this repository is licensed under the MIT License.

Additional license: See the [AGPL License](./AGPL_LICENSE) for specific components covered under AGPL.

For full details, refer to the [MIT License](./MIT_LICENSE).
---####################################################################################---
## Original


[![PyPi Release](https://img.shields.io/pypi/v/lightweight-charts?color=32a852&label=PyPi)](https://pypi.org/project/lightweight-charts/)
[![Made with Python](https://img.shields.io/badge/Python-3.8+-c7a002?logo=python&logoColor=white)](https://python.org "Go to Python homepage")
[![Documentation](https://img.shields.io/badge/documentation-006ee3)](https://lightweight-charts-python.readthedocs.io/en/latest/index.html)

![cover](https://raw.githubusercontent.com/louisnw01/lightweight-charts-python/main/cover.png)

lightweight-charts-python aims to provide a simple and pythonic way to access and implement [TradingView's Lightweight Charts](https://www.tradingview.com/lightweight-charts/).
</div>
**lightweight-charts-python** aims to provide a simple and Pythonic way to access and implement [TradingView's Lightweight Charts](https://www.tradingview.com/lightweight-charts/).

---


## Installation

```bash
pip install lightweight-charts


## Installation
Expand Down
Binary file added Screenshot2025-02-07114921.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if [[ $? -ne 0 ]]; then
exit 1
fi

cp dist/bundle.js src/general/styles.css lightweight_charts/js
cp dist/bundle.js src/general/styles.css lightweight_charts_esistjosh/js
if [[ $? -eq 0 ]]; then
echo -e "${INFO}copied bundle.js, style.css into python package"
else
Expand Down
5 changes: 5 additions & 0 deletions defaults/area.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lineColor": "#021698",
"topColor": "rgba(9, 32, 210, 0.4)",
"bottomColor": "rgba(0, 0, 0, 0.5)"
}
7 changes: 7 additions & 0 deletions defaults/bar.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"upColor": "#006721",
"downColor": "#6E0000",
"borderUpColor": "#006721",
"borderDownColor": "#6E0000"
}

9 changes: 9 additions & 0 deletions defaults/candlestick.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"upColor": "rgba(0, 103, 33, 0.33)",
"downColor": "rgba(110, 0, 0, 0.33)",
"borderUpColor": "#006721",
"borderDownColor": "#6E0000",
"wickUpColor": "#006721",
"wickDownColor": "#6E0000"
}

Loading