qcharts 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- qcharts-1.0.0/.gitignore +220 -0
- qcharts-1.0.0/PKG-INFO +286 -0
- qcharts-1.0.0/README.md +264 -0
- qcharts-1.0.0/README_ZH.md +264 -0
- qcharts-1.0.0/pyproject.toml +56 -0
- qcharts-1.0.0/qcharts/__init__.py +5 -0
- qcharts-1.0.0/qcharts/_data.py +90 -0
- qcharts-1.0.0/qcharts/js/index.js +8770 -0
- qcharts-1.0.0/qcharts/js/styles.css +29 -0
- qcharts-1.0.0/qcharts/pane.py +22 -0
- qcharts-1.0.0/qcharts/series.py +102 -0
- qcharts-1.0.0/qcharts/utils.py +25 -0
- qcharts-1.0.0/qcharts/widget.py +311 -0
- qcharts-1.0.0/uv.lock +1719 -0
qcharts-1.0.0/.gitignore
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
# Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
# poetry.lock
|
|
109
|
+
# poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
# pdm.lock
|
|
116
|
+
# pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
# pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# Redis
|
|
135
|
+
*.rdb
|
|
136
|
+
*.aof
|
|
137
|
+
*.pid
|
|
138
|
+
|
|
139
|
+
# RabbitMQ
|
|
140
|
+
mnesia/
|
|
141
|
+
rabbitmq/
|
|
142
|
+
rabbitmq-data/
|
|
143
|
+
|
|
144
|
+
# ActiveMQ
|
|
145
|
+
activemq-data/
|
|
146
|
+
|
|
147
|
+
# SageMath parsed files
|
|
148
|
+
*.sage.py
|
|
149
|
+
|
|
150
|
+
# Environments
|
|
151
|
+
.env
|
|
152
|
+
.envrc
|
|
153
|
+
.venv
|
|
154
|
+
env/
|
|
155
|
+
venv/
|
|
156
|
+
ENV/
|
|
157
|
+
env.bak/
|
|
158
|
+
venv.bak/
|
|
159
|
+
|
|
160
|
+
# Spyder project settings
|
|
161
|
+
.spyderproject
|
|
162
|
+
.spyproject
|
|
163
|
+
|
|
164
|
+
# Rope project settings
|
|
165
|
+
.ropeproject
|
|
166
|
+
|
|
167
|
+
# mkdocs documentation
|
|
168
|
+
/site
|
|
169
|
+
|
|
170
|
+
# mypy
|
|
171
|
+
.mypy_cache/
|
|
172
|
+
.dmypy.json
|
|
173
|
+
dmypy.json
|
|
174
|
+
|
|
175
|
+
# Pyre type checker
|
|
176
|
+
.pyre/
|
|
177
|
+
|
|
178
|
+
# pytype static type analyzer
|
|
179
|
+
.pytype/
|
|
180
|
+
|
|
181
|
+
# Cython debug symbols
|
|
182
|
+
cython_debug/
|
|
183
|
+
|
|
184
|
+
# PyCharm
|
|
185
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
186
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
188
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
189
|
+
# .idea/
|
|
190
|
+
|
|
191
|
+
# Abstra
|
|
192
|
+
# Abstra is an AI-powered process automation framework.
|
|
193
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
194
|
+
# Learn more at https://abstra.io/docs
|
|
195
|
+
.abstra/
|
|
196
|
+
|
|
197
|
+
# Visual Studio Code
|
|
198
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
199
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
200
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
201
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
202
|
+
# .vscode/
|
|
203
|
+
# Temporary file for partial code execution
|
|
204
|
+
tempCodeRunnerFile.py
|
|
205
|
+
|
|
206
|
+
# Ruff stuff:
|
|
207
|
+
.ruff_cache/
|
|
208
|
+
|
|
209
|
+
# PyPI configuration file
|
|
210
|
+
.pypirc
|
|
211
|
+
|
|
212
|
+
# Marimo
|
|
213
|
+
marimo/_static/
|
|
214
|
+
marimo/_lsp/
|
|
215
|
+
__marimo__/
|
|
216
|
+
|
|
217
|
+
# Streamlit
|
|
218
|
+
.streamlit/secrets.toml
|
|
219
|
+
|
|
220
|
+
.idea/
|
qcharts-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: qcharts
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: The Lightweight Charts Jupyter extension
|
|
5
|
+
Project-URL: Homepage, https://github.com/niutool/qcharts
|
|
6
|
+
Project-URL: Repository, https://github.com/niutool/qcharts
|
|
7
|
+
Author: niutool
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
Keywords: charts,jupyter,lightweight-charts,stock,tradingview
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Framework :: Jupyter
|
|
12
|
+
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Topic :: Office/Business :: Financial :: Investment
|
|
17
|
+
Requires-Python: >=3.12
|
|
18
|
+
Requires-Dist: anywidget>=0.11.0
|
|
19
|
+
Requires-Dist: jupyterlab>=4.5.7
|
|
20
|
+
Requires-Dist: pandas>=3.0.3
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# QCharts
|
|
24
|
+
|
|
25
|
+
A Jupyter stock charting extension built on TradingView [Lightweight Charts](https://github.com/nicehash/lightweight-charts). Create interactive candlestick charts, technical indicators, and volume charts in Jupyter Notebook via a Python API.
|
|
26
|
+
|
|
27
|
+
[中文文档](#中文文档)
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Features
|
|
32
|
+
|
|
33
|
+
- **6 Chart Types** — Candlestick, Line, Area, Bar, Baseline, Histogram
|
|
34
|
+
- **Multi-Pane Support** — Stack multiple panels in a single chart (main chart + volume + MACD + KDJ, etc.)
|
|
35
|
+
- **Built-in Technical Indicators** — `add_ma()` Moving Averages, `add_macd()` MACD, `add_kdj()` KDJ
|
|
36
|
+
- **Volume** — Auto-colored by up/down, compressed at the bottom of the candlestick pane
|
|
37
|
+
- **Trade Markers** — Annotate buy/sell signals on the chart via `set_markers()`
|
|
38
|
+
- **Interactive Legend** — Real-time OHLC, price change %, and volume on crosshair hover
|
|
39
|
+
- **Responsive Sizing** — Fixed dimensions or auto-fill container
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Installation
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pip install qcharts
|
|
47
|
+
# or with uv
|
|
48
|
+
uv add qcharts
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**Dependencies:**
|
|
52
|
+
- Python >= 3.12
|
|
53
|
+
- anywidget >= 0.11.0
|
|
54
|
+
- pandas >= 3.0.3
|
|
55
|
+
- JupyterLab >= 4.5 (for widget display)
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Quick Start
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
import pandas as pd
|
|
63
|
+
from qcharts import Chart
|
|
64
|
+
|
|
65
|
+
# Load stock data
|
|
66
|
+
df = pd.read_csv("stock.csv", parse_dates=["date"])
|
|
67
|
+
|
|
68
|
+
# Create chart and set data
|
|
69
|
+
chart = Chart(height=400)
|
|
70
|
+
chart.set_stock_data(df, "603629")
|
|
71
|
+
chart # Display in Jupyter
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Usage Guide
|
|
77
|
+
|
|
78
|
+
### 1. Basic Candlestick + Volume
|
|
79
|
+
|
|
80
|
+
`set_stock_data()` creates candlestick and volume in one step:
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
chart = Chart(height=400)
|
|
84
|
+
chart.set_stock_data(df, "603629")
|
|
85
|
+
chart
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Or build step by step:
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
chart = Chart(height=400)
|
|
92
|
+
chart.add_candles(df) # Candlestick
|
|
93
|
+
chart.add_volume(df, pane_name="vol") # Volume (separate pane)
|
|
94
|
+
chart
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**DataFrame requirements:** Must contain `date` (or `time`), `open`, `high`, `low`, `close` columns; volume also requires a `volume` column.
|
|
98
|
+
|
|
99
|
+
### 2. Moving Averages
|
|
100
|
+
|
|
101
|
+
`add_ma()` auto-detects columns matching `prefix + number`:
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
df_ma = df[["date", "close"]].copy()
|
|
105
|
+
df_ma["ma5"] = df_ma["close"].rolling(5).mean()
|
|
106
|
+
df_ma["ma10"] = df_ma["close"].rolling(10).mean()
|
|
107
|
+
df_ma["ma20"] = df_ma["close"].rolling(20).mean()
|
|
108
|
+
|
|
109
|
+
chart.add_ma(df_ma, prefix="ma")
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Custom colors:
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
chart.add_ma(df_ma, prefix="ma", colors=["#2962FF", "#FF6D00", "#7B1FA2"])
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### 3. MACD Indicator
|
|
119
|
+
|
|
120
|
+
`add_macd()` creates MACD line, signal line, and histogram (with 4-color auto styling):
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
ema12 = df["close"].ewm(span=12, adjust=False).mean()
|
|
124
|
+
ema26 = df["close"].ewm(span=26, adjust=False).mean()
|
|
125
|
+
|
|
126
|
+
df_macd = df[["date"]].copy()
|
|
127
|
+
df_macd["macd"] = ema12 - ema26
|
|
128
|
+
df_macd["signal"] = df_macd["macd"].ewm(span=9, adjust=False).mean()
|
|
129
|
+
df_macd["hist"] = df_macd["macd"] - df_macd["signal"]
|
|
130
|
+
|
|
131
|
+
chart.add_macd(df_macd)
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**DataFrame requirements:** Must contain `date` (or `time`), `macd`, `signal`, `hist` columns.
|
|
135
|
+
|
|
136
|
+
### 4. KDJ Indicator
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
chart.add_kdj(df_kdj)
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
**DataFrame requirements:** Must contain `date` (or `time`), `k`, `d`, `j` columns.
|
|
143
|
+
|
|
144
|
+
### 5. Trade Signal Markers
|
|
145
|
+
|
|
146
|
+
```python
|
|
147
|
+
markers = [
|
|
148
|
+
{"time": 1704067200, "position": "belowBar", "shape": "arrowUp",
|
|
149
|
+
"color": "#26a69a", "text": "Buy"},
|
|
150
|
+
{"time": 1704153600, "position": "aboveBar", "shape": "arrowDown",
|
|
151
|
+
"color": "#ef5350", "text": "Sell"},
|
|
152
|
+
]
|
|
153
|
+
|
|
154
|
+
# Get candlestick series and set markers
|
|
155
|
+
candle = chart.series["default_candlestick"]
|
|
156
|
+
candle.set_markers(markers)
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Supported `position`: `aboveBar`, `belowBar`, `inBar`.
|
|
160
|
+
Supported `shape`: `arrowUp`, `arrowDown`, `circle`, `square`, etc.
|
|
161
|
+
|
|
162
|
+
### 6. Multi-Pane Management
|
|
163
|
+
|
|
164
|
+
All series go into the main pane by default. Technical indicators (MACD, KDJ) auto-create new panes. You can also manage panes manually:
|
|
165
|
+
|
|
166
|
+
```python
|
|
167
|
+
chart.add_pane("volume", label="Volume", height=20)
|
|
168
|
+
chart.add_volume(df, pane_name="volume")
|
|
169
|
+
|
|
170
|
+
chart.add_pane("rsi", label="RSI", height=15)
|
|
171
|
+
chart.add_line("rsi", pane_name="rsi", color="#7B1FA2")
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
`height` is a proportional weight (not pixels), controlling the relative height of each pane.
|
|
175
|
+
|
|
176
|
+
### 7. Chart Sizing
|
|
177
|
+
|
|
178
|
+
```python
|
|
179
|
+
# Fixed size
|
|
180
|
+
chart = Chart(width=800, height=500)
|
|
181
|
+
|
|
182
|
+
# Auto-fill container
|
|
183
|
+
chart = Chart(auto_size=True)
|
|
184
|
+
|
|
185
|
+
# Resize dynamically
|
|
186
|
+
chart.set_size(width=1000, height=600)
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### 8. Custom Styling
|
|
190
|
+
|
|
191
|
+
All `add_*` methods accept Lightweight Charts style options. Parameters support both `snake_case` and `camelCase`:
|
|
192
|
+
|
|
193
|
+
```python
|
|
194
|
+
chart.add_line("ma20", color="#FF6D00", line_width=2, line_style=2)
|
|
195
|
+
chart.add_candlestick("kline", up_color="#ef5350", down_color="#26a69a",
|
|
196
|
+
border_visible=True)
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## Data Format
|
|
202
|
+
|
|
203
|
+
All methods accept either a `pandas.DataFrame` or a pre-formatted `list[dict]`.
|
|
204
|
+
|
|
205
|
+
### DataFrame Format
|
|
206
|
+
|
|
207
|
+
| Method | Required Columns |
|
|
208
|
+
|--------|-----------------|
|
|
209
|
+
| `set_stock_data` / `add_candles` | `date` (or `time`), `open`, `high`, `low`, `close` |
|
|
210
|
+
| `add_volume` | `date` (or `time`), `volume`, `close`, `open` |
|
|
211
|
+
| `add_ma` | `date` (or `time`), `ma{N}` columns (e.g. `ma5`, `ma10`) |
|
|
212
|
+
| `add_macd` | `date` (or `time`), `macd`, `signal`, `hist` |
|
|
213
|
+
| `add_kdj` | `date` (or `time`), `k`, `d`, `j` |
|
|
214
|
+
|
|
215
|
+
`date` / `time` columns support `datetime64[ns]`, `datetime64[us]`, `datetime64[ms]` precision and are auto-converted to Unix timestamps (seconds).
|
|
216
|
+
|
|
217
|
+
### list[dict] Format
|
|
218
|
+
|
|
219
|
+
```python
|
|
220
|
+
# Candlestick data
|
|
221
|
+
[{"time": 1704067200, "open": 10.0, "high": 10.5, "low": 9.8, "close": 10.3}]
|
|
222
|
+
|
|
223
|
+
# Line/Area data
|
|
224
|
+
[{"time": 1704067200, "value": 10.3}]
|
|
225
|
+
|
|
226
|
+
# Histogram data (per-bar color supported)
|
|
227
|
+
[{"time": 1704067200, "value": 12345, "color": "#ef535080"}]
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## API Reference
|
|
233
|
+
|
|
234
|
+
### `Chart(width=0, height=300, auto_size=False)`
|
|
235
|
+
|
|
236
|
+
| Method | Description |
|
|
237
|
+
|--------|-------------|
|
|
238
|
+
| `set_stock_data(df, code)` | One-step candlestick + volume, sets pane label |
|
|
239
|
+
| `add_candles(data, pane_name=None)` | Add candlestick series |
|
|
240
|
+
| `add_volume(data, pane_name=None)` | Add volume histogram |
|
|
241
|
+
| `add_ma(df, pane_name=None, prefix='ma', colors=None)` | Add moving averages |
|
|
242
|
+
| `add_macd(data, pane_name='macd')` | Add MACD (line + signal + histogram) |
|
|
243
|
+
| `add_kdj(data, pane_name='kdj')` | Add KDJ (K/D/J lines) |
|
|
244
|
+
| `add_line(name, pane_name=None, color='#2962FF', **kwargs)` | Add line series |
|
|
245
|
+
| `add_area(name, pane_name=None, **kwargs)` | Add area series |
|
|
246
|
+
| `add_bar(name, pane_name=None, **kwargs)` | Add bar series |
|
|
247
|
+
| `add_baseline(name, pane_name=None, **kwargs)` | Add baseline series |
|
|
248
|
+
| `add_histogram(name, pane_name=None, **kwargs)` | Add histogram series |
|
|
249
|
+
| `add_candlestick(name, pane_name=None, **kwargs)` | Add candlestick series (custom name) |
|
|
250
|
+
| `add_pane(name, label=None, height=30)` | Add a new pane |
|
|
251
|
+
| `get_pane(name)` | Get a pane object |
|
|
252
|
+
| `set_size(width=0, height=300)` | Resize the chart |
|
|
253
|
+
|
|
254
|
+
### Series Methods
|
|
255
|
+
|
|
256
|
+
Each `add_*` method returns a Series object with:
|
|
257
|
+
|
|
258
|
+
| Method | Description |
|
|
259
|
+
|--------|-------------|
|
|
260
|
+
| `set_data(data)` | Update series data |
|
|
261
|
+
| `set_markers(markers)` | Set trade markers |
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## Development
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
# Python environment
|
|
269
|
+
uv sync
|
|
270
|
+
|
|
271
|
+
# JS build
|
|
272
|
+
cd js
|
|
273
|
+
pnpm install
|
|
274
|
+
pnpm run build # Build ESM bundle
|
|
275
|
+
pnpm run dev # Watch mode
|
|
276
|
+
|
|
277
|
+
# Formatting
|
|
278
|
+
cd js
|
|
279
|
+
pnpm run format # Prettier formatting
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
After modifying JS code, rebuild with `pnpm run build` and restart the Jupyter kernel to see changes.
|
|
283
|
+
|
|
284
|
+
## License
|
|
285
|
+
|
|
286
|
+
MIT
|