pycharting 0.2.0__tar.gz → 0.2.3__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.
Files changed (47) hide show
  1. pycharting-0.2.3/PKG-INFO +236 -0
  2. pycharting-0.2.3/README.md +208 -0
  3. {pycharting-0.2.0 → pycharting-0.2.3}/pyproject.toml +19 -13
  4. pycharting-0.2.3/src/api/__init__.py +1 -0
  5. pycharting-0.2.3/src/api/interface.py +258 -0
  6. pycharting-0.2.3/src/api/routes.py +233 -0
  7. pycharting-0.2.3/src/core/__init__.py +1 -0
  8. pycharting-0.2.3/src/core/lifecycle.py +223 -0
  9. pycharting-0.2.3/src/core/server.py +219 -0
  10. pycharting-0.2.3/src/web/__init__.py +1 -0
  11. pycharting-0.2.3/src/web/static/demo.html +353 -0
  12. pycharting-0.2.3/src/web/static/js/chart.js +317 -0
  13. pycharting-0.2.3/src/web/static/js/sync.js +355 -0
  14. pycharting-0.2.3/src/web/static/js/viewport.js +389 -0
  15. pycharting-0.2.3/src/web/static/multi-chart-demo.html +391 -0
  16. pycharting-0.2.3/src/web/static/viewport-demo.html +301 -0
  17. pycharting-0.2.0/PKG-INFO +0 -742
  18. pycharting-0.2.0/README.md +0 -715
  19. pycharting-0.2.0/src/charting/__init__.py +0 -80
  20. pycharting-0.2.0/src/charting/api/__init__.py +0 -1
  21. pycharting-0.2.0/src/charting/api/exceptions.py +0 -41
  22. pycharting-0.2.0/src/charting/api/main.py +0 -134
  23. pycharting-0.2.0/src/charting/api/models.py +0 -156
  24. pycharting-0.2.0/src/charting/api/processor.py +0 -415
  25. pycharting-0.2.0/src/charting/api/routes.py +0 -166
  26. pycharting-0.2.0/src/charting/browser.py +0 -145
  27. pycharting-0.2.0/src/charting/charting.py +0 -420
  28. pycharting-0.2.0/src/charting/detector.py +0 -576
  29. pycharting-0.2.0/src/charting/frontend/app.js +0 -431
  30. pycharting-0.2.0/src/charting/frontend/chart.js +0 -597
  31. pycharting-0.2.0/src/charting/frontend/data-client.js +0 -224
  32. pycharting-0.2.0/src/charting/frontend/divider.css +0 -83
  33. pycharting-0.2.0/src/charting/frontend/divider.js +0 -455
  34. pycharting-0.2.0/src/charting/frontend/index.html +0 -215
  35. pycharting-0.2.0/src/charting/frontend/layout-manager.js +0 -683
  36. pycharting-0.2.0/src/charting/frontend/multi-chart.js +0 -1779
  37. pycharting-0.2.0/src/charting/ingestion/__init__.py +0 -2
  38. pycharting-0.2.0/src/charting/ingestion/loader.py +0 -314
  39. pycharting-0.2.0/src/charting/ingestion/schema.py +0 -67
  40. pycharting-0.2.0/src/charting/launcher.py +0 -212
  41. pycharting-0.2.0/src/charting/mapper.py +0 -316
  42. pycharting-0.2.0/src/charting/processing/__init__.py +0 -2
  43. pycharting-0.2.0/src/charting/processing/indicators.py +0 -248
  44. pycharting-0.2.0/src/charting/processing/pivot.py +0 -224
  45. pycharting-0.2.0/src/charting/processing/resampler.py +0 -425
  46. pycharting-0.2.0/src/charting/server.py +0 -198
  47. pycharting-0.2.0/src/charting/transformer.py +0 -222
@@ -0,0 +1,236 @@
1
+ Metadata-Version: 2.1
2
+ Name: pycharting
3
+ Version: 0.2.3
4
+ Summary: High-performance financial charting library for OHLC data visualization with technical indicators
5
+ Home-page: https://github.com/alihaskar/pycharting
6
+ License: MIT
7
+ Keywords: charting,finance,ohlc,technical-indicators,trading,visualization
8
+ Author: ali askar
9
+ Author-email: 26202651+alihaskar@users.noreply.github.com
10
+ Requires-Python: >=3.12,<4.0
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Financial and Insurance Industry
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Office/Business :: Financial
18
+ Classifier: Topic :: Scientific/Engineering :: Visualization
19
+ Requires-Dist: fastapi (>=0.115.0,<1.0.0)
20
+ Requires-Dist: numpy (>=1.26.0,<3.0.0)
21
+ Requires-Dist: pandas (>=2.2.0,<3.0.0)
22
+ Requires-Dist: pydantic (>=2.7.0,<3.0.0)
23
+ Requires-Dist: pytz (>=2024.1,<2026.0)
24
+ Requires-Dist: uvicorn[standard] (>=0.24.0,<1.0.0)
25
+ Project-URL: Repository, https://github.com/alihaskar/pycharting
26
+ Description-Content-Type: text/markdown
27
+
28
+ # PyCharting
29
+
30
+ High‑performance financial charting library for OHLC data visualization with technical indicators.
31
+
32
+ ## Overview
33
+
34
+ PyCharting lets you render large OHLC time series (hundreds of thousands to millions of candles) in the browser with a single Python call.
35
+ It runs a lightweight FastAPI server locally, streams your data to a uPlot-based frontend, and gives you an interactive viewport with overlays and indicator subplots.
36
+
37
+ ![PyCharting demo](demo.png)
38
+
39
+ ## Features
40
+
41
+ - **Million‑point OHLC charts**: optimized for large numeric indices and dense intraday data.
42
+ - **Overlays on price**: moving averages, EMAs, or any arbitrary overlay series.
43
+ - **Indicator subplots**: RSI-style and stochastic-style oscillators rendered as separate panels.
44
+ - **Viewport management**: server‑side slicing and caching for smooth pan/zoom on huge arrays.
45
+ - **FastAPI + uPlot stack**: Python on the backend, ultra‑light JS on the frontend.
46
+ - **Simple Python API**: one main entry point, `plot(...)`, plus helpers to manage the server.
47
+
48
+ ## Installation
49
+
50
+ ### From PyPI
51
+
52
+ Install the latest released version from PyPI:
53
+
54
+ ```bash
55
+ pip install pycharting
56
+ ```
57
+
58
+ This will install the `pycharting` package along with its runtime dependencies (`numpy`, `pandas`, `fastapi`, `uvicorn`, and friends).
59
+
60
+ ### From source
61
+
62
+ If you want to develop or run against `main`:
63
+
64
+ ```bash
65
+ git clone https://github.com/alihaskar/pycharting.git
66
+ cd pycharting
67
+ pip install -e .
68
+ ```
69
+
70
+ If you use Poetry instead of pip:
71
+
72
+ ```bash
73
+ git clone https://github.com/alihaskar/pycharting.git
74
+ cd pycharting
75
+ poetry install
76
+ ```
77
+
78
+ ## Quick start
79
+
80
+ The primary API is a single `plot` function that takes OHLC arrays (plus optional overlays and subplots), starts a local server, and opens your default browser on the interactive chart.
81
+
82
+ When you run this script, PyCharting will:
83
+
84
+ - spin up a local FastAPI server on an available port,
85
+ - register your OHLC series and overlays in a session,
86
+ - open your default browser to a minimal full‑page chart UI showing price and overlays.
87
+
88
+ ## Overlays vs subplots
89
+
90
+ Once you have your OHLC series, you pass additional series to `plot` in two different ways:
91
+
92
+ ```python
93
+ overlays = {
94
+ "SMA_50": sma(close, 50), # rendered on top of price
95
+ "EMA_200": ema(close, 200),
96
+ }
97
+
98
+ subplots = {
99
+ "RSI_like": rsi_like_series, # rendered in its own panel below price
100
+ "Stoch_like": stoch_series,
101
+ }
102
+
103
+ plot(
104
+ index,
105
+ open_,
106
+ high,
107
+ low,
108
+ close,
109
+ overlays=overlays,
110
+ subplots=subplots,
111
+ )
112
+ ```
113
+
114
+ - **Overlays** share the same y‑axis as price and are drawn directly on the candlestick chart (moving averages, bands, signals on price).
115
+ - **Subplots** are stacked independent charts below the main panel with their own y‑scales (oscillators, volume, breadth measures).
116
+
117
+ See `demo.py` for a full example that generates synthetic data and wires up both overlays and indicator-style subplots.
118
+
119
+ Run the demo from the project root:
120
+
121
+ ```bash
122
+ python demo.py
123
+ ```
124
+
125
+ You should see something similar to the screenshot above: a price panel with overlays, plus RSI-like and stochastic-like subplots underneath.
126
+
127
+ ## Python API
128
+
129
+ The public API is intentionally small and focused. All functions are available from the top-level `pycharting` package.
130
+
131
+ ### `plot`
132
+
133
+ ```python
134
+ from typing import Dict, Any, Optional, Union
135
+
136
+ import numpy as np
137
+ import pandas as pd
138
+ from pycharting import plot
139
+
140
+ ArrayLike = Union[np.ndarray, pd.Series, list]
141
+
142
+ result: Dict[str, Any] = plot(
143
+ index: ArrayLike,
144
+ open: ArrayLike,
145
+ high: ArrayLike,
146
+ low: ArrayLike,
147
+ close: ArrayLike,
148
+ overlays: Optional[Dict[str, ArrayLike]] = None,
149
+ subplots: Optional[Dict[str, ArrayLike]] = None,
150
+ session_id: str = "default",
151
+ port: Optional[int] = None,
152
+ open_browser: bool = True,
153
+ server_timeout: float = 2.0,
154
+ )
155
+ ```
156
+
157
+ - **index**: numeric or datetime-like x-axis values (internally treated as numeric indices).
158
+ - **open/high/low/close**: price series of identical length.
159
+ - **overlays**: mapping of overlay name to series (same length as `close`), rendered on the main price chart.
160
+ - **subplots**: mapping of subplot name to series, rendered as additional charts stacked vertically.
161
+ - **session_id**: identifier for the data session; can be used to host multiple concurrent charts.
162
+ - **port**: optional port override; if `None`, PyCharting picks an available port.
163
+ - **open_browser**: if `False`, you get the URL back in `result["url"]` but the browser is not opened automatically.
164
+
165
+ The returned dict includes:
166
+
167
+ - `status`: `"success"` or `"error"`,
168
+ - `url`: full chart URL (including session query),
169
+ - `server_url`: base FastAPI server URL,
170
+ - `session_id`: the session identifier you passed in,
171
+ - `data_points`: number of OHLC rows,
172
+ - `server_running`: boolean.
173
+
174
+ ### `stop_server`
175
+
176
+ ```python
177
+ from pycharting import stop_server
178
+
179
+ stop_server()
180
+ ```
181
+
182
+ Stops the active chart server if it is running. This is useful in long‑running processes and demos to clean up after you are done exploring charts.
183
+
184
+ ### `get_server_status`
185
+
186
+ ```python
187
+ from pycharting import get_server_status
188
+
189
+ status = get_server_status()
190
+ print(status)
191
+ ```
192
+
193
+ Returns a small dict with:
194
+
195
+ - `running`: whether the server is alive,
196
+ - `server_info`: host/port and other metadata if running,
197
+ - `active_sessions`: number of registered data sessions.
198
+
199
+ ## Project structure
200
+
201
+ The library follows a modern `src/` layout:
202
+
203
+ ```
204
+ pycharting/
205
+ ├── src/
206
+ │ ├── core/ # Chart server lifecycle and internals
207
+ │ ├── data/ # Data ingestion, validation, and slicing
208
+ │ ├── api/ # FastAPI routes and Python API surface
209
+ │ └── web/ # Static frontend (HTML + JS for charts)
210
+ ├── tests/ # Test suite
211
+ ├── data/ # Sample CSVs and fixtures
212
+ └── pyproject.toml # Project configuration
213
+ ```
214
+
215
+ ## Contributing
216
+
217
+ Contributions, bug reports, and feature suggestions are welcome. Please open an issue or pull request on GitHub.
218
+
219
+ Basic workflow:
220
+
221
+ 1. Fork the repository.
222
+ 2. Create a feature branch: `git checkout -b feature/my-feature`.
223
+ 3. Make changes and add tests.
224
+ 4. Run the test suite.
225
+ 5. Open a pull request against `main`.
226
+
227
+ ## License
228
+
229
+ PyCharting is licensed under the MIT License.
230
+
231
+ ## Links
232
+
233
+ - **PyPI**: `https://pypi.org/project/pycharting/`
234
+ - **Source**: `https://github.com/alihaskar/pycharting`
235
+ - **Issues**: `https://github.com/alihaskar/pycharting/issues`
236
+
@@ -0,0 +1,208 @@
1
+ # PyCharting
2
+
3
+ High‑performance financial charting library for OHLC data visualization with technical indicators.
4
+
5
+ ## Overview
6
+
7
+ PyCharting lets you render large OHLC time series (hundreds of thousands to millions of candles) in the browser with a single Python call.
8
+ It runs a lightweight FastAPI server locally, streams your data to a uPlot-based frontend, and gives you an interactive viewport with overlays and indicator subplots.
9
+
10
+ ![PyCharting demo](demo.png)
11
+
12
+ ## Features
13
+
14
+ - **Million‑point OHLC charts**: optimized for large numeric indices and dense intraday data.
15
+ - **Overlays on price**: moving averages, EMAs, or any arbitrary overlay series.
16
+ - **Indicator subplots**: RSI-style and stochastic-style oscillators rendered as separate panels.
17
+ - **Viewport management**: server‑side slicing and caching for smooth pan/zoom on huge arrays.
18
+ - **FastAPI + uPlot stack**: Python on the backend, ultra‑light JS on the frontend.
19
+ - **Simple Python API**: one main entry point, `plot(...)`, plus helpers to manage the server.
20
+
21
+ ## Installation
22
+
23
+ ### From PyPI
24
+
25
+ Install the latest released version from PyPI:
26
+
27
+ ```bash
28
+ pip install pycharting
29
+ ```
30
+
31
+ This will install the `pycharting` package along with its runtime dependencies (`numpy`, `pandas`, `fastapi`, `uvicorn`, and friends).
32
+
33
+ ### From source
34
+
35
+ If you want to develop or run against `main`:
36
+
37
+ ```bash
38
+ git clone https://github.com/alihaskar/pycharting.git
39
+ cd pycharting
40
+ pip install -e .
41
+ ```
42
+
43
+ If you use Poetry instead of pip:
44
+
45
+ ```bash
46
+ git clone https://github.com/alihaskar/pycharting.git
47
+ cd pycharting
48
+ poetry install
49
+ ```
50
+
51
+ ## Quick start
52
+
53
+ The primary API is a single `plot` function that takes OHLC arrays (plus optional overlays and subplots), starts a local server, and opens your default browser on the interactive chart.
54
+
55
+ When you run this script, PyCharting will:
56
+
57
+ - spin up a local FastAPI server on an available port,
58
+ - register your OHLC series and overlays in a session,
59
+ - open your default browser to a minimal full‑page chart UI showing price and overlays.
60
+
61
+ ## Overlays vs subplots
62
+
63
+ Once you have your OHLC series, you pass additional series to `plot` in two different ways:
64
+
65
+ ```python
66
+ overlays = {
67
+ "SMA_50": sma(close, 50), # rendered on top of price
68
+ "EMA_200": ema(close, 200),
69
+ }
70
+
71
+ subplots = {
72
+ "RSI_like": rsi_like_series, # rendered in its own panel below price
73
+ "Stoch_like": stoch_series,
74
+ }
75
+
76
+ plot(
77
+ index,
78
+ open_,
79
+ high,
80
+ low,
81
+ close,
82
+ overlays=overlays,
83
+ subplots=subplots,
84
+ )
85
+ ```
86
+
87
+ - **Overlays** share the same y‑axis as price and are drawn directly on the candlestick chart (moving averages, bands, signals on price).
88
+ - **Subplots** are stacked independent charts below the main panel with their own y‑scales (oscillators, volume, breadth measures).
89
+
90
+ See `demo.py` for a full example that generates synthetic data and wires up both overlays and indicator-style subplots.
91
+
92
+ Run the demo from the project root:
93
+
94
+ ```bash
95
+ python demo.py
96
+ ```
97
+
98
+ You should see something similar to the screenshot above: a price panel with overlays, plus RSI-like and stochastic-like subplots underneath.
99
+
100
+ ## Python API
101
+
102
+ The public API is intentionally small and focused. All functions are available from the top-level `pycharting` package.
103
+
104
+ ### `plot`
105
+
106
+ ```python
107
+ from typing import Dict, Any, Optional, Union
108
+
109
+ import numpy as np
110
+ import pandas as pd
111
+ from pycharting import plot
112
+
113
+ ArrayLike = Union[np.ndarray, pd.Series, list]
114
+
115
+ result: Dict[str, Any] = plot(
116
+ index: ArrayLike,
117
+ open: ArrayLike,
118
+ high: ArrayLike,
119
+ low: ArrayLike,
120
+ close: ArrayLike,
121
+ overlays: Optional[Dict[str, ArrayLike]] = None,
122
+ subplots: Optional[Dict[str, ArrayLike]] = None,
123
+ session_id: str = "default",
124
+ port: Optional[int] = None,
125
+ open_browser: bool = True,
126
+ server_timeout: float = 2.0,
127
+ )
128
+ ```
129
+
130
+ - **index**: numeric or datetime-like x-axis values (internally treated as numeric indices).
131
+ - **open/high/low/close**: price series of identical length.
132
+ - **overlays**: mapping of overlay name to series (same length as `close`), rendered on the main price chart.
133
+ - **subplots**: mapping of subplot name to series, rendered as additional charts stacked vertically.
134
+ - **session_id**: identifier for the data session; can be used to host multiple concurrent charts.
135
+ - **port**: optional port override; if `None`, PyCharting picks an available port.
136
+ - **open_browser**: if `False`, you get the URL back in `result["url"]` but the browser is not opened automatically.
137
+
138
+ The returned dict includes:
139
+
140
+ - `status`: `"success"` or `"error"`,
141
+ - `url`: full chart URL (including session query),
142
+ - `server_url`: base FastAPI server URL,
143
+ - `session_id`: the session identifier you passed in,
144
+ - `data_points`: number of OHLC rows,
145
+ - `server_running`: boolean.
146
+
147
+ ### `stop_server`
148
+
149
+ ```python
150
+ from pycharting import stop_server
151
+
152
+ stop_server()
153
+ ```
154
+
155
+ Stops the active chart server if it is running. This is useful in long‑running processes and demos to clean up after you are done exploring charts.
156
+
157
+ ### `get_server_status`
158
+
159
+ ```python
160
+ from pycharting import get_server_status
161
+
162
+ status = get_server_status()
163
+ print(status)
164
+ ```
165
+
166
+ Returns a small dict with:
167
+
168
+ - `running`: whether the server is alive,
169
+ - `server_info`: host/port and other metadata if running,
170
+ - `active_sessions`: number of registered data sessions.
171
+
172
+ ## Project structure
173
+
174
+ The library follows a modern `src/` layout:
175
+
176
+ ```
177
+ pycharting/
178
+ ├── src/
179
+ │ ├── core/ # Chart server lifecycle and internals
180
+ │ ├── data/ # Data ingestion, validation, and slicing
181
+ │ ├── api/ # FastAPI routes and Python API surface
182
+ │ └── web/ # Static frontend (HTML + JS for charts)
183
+ ├── tests/ # Test suite
184
+ ├── data/ # Sample CSVs and fixtures
185
+ └── pyproject.toml # Project configuration
186
+ ```
187
+
188
+ ## Contributing
189
+
190
+ Contributions, bug reports, and feature suggestions are welcome. Please open an issue or pull request on GitHub.
191
+
192
+ Basic workflow:
193
+
194
+ 1. Fork the repository.
195
+ 2. Create a feature branch: `git checkout -b feature/my-feature`.
196
+ 3. Make changes and add tests.
197
+ 4. Run the test suite.
198
+ 5. Open a pull request against `main`.
199
+
200
+ ## License
201
+
202
+ PyCharting is licensed under the MIT License.
203
+
204
+ ## Links
205
+
206
+ - **PyPI**: `https://pypi.org/project/pycharting/`
207
+ - **Source**: `https://github.com/alihaskar/pycharting`
208
+ - **Issues**: `https://github.com/alihaskar/pycharting/issues`
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "pycharting"
3
- version = "0.2.0"
3
+ version = "0.2.3"
4
4
  description = "High-performance financial charting library for OHLC data visualization with technical indicators"
5
5
  authors = ["ali askar <26202651+alihaskar@users.noreply.github.com>"]
6
6
  readme = "README.md"
@@ -18,22 +18,28 @@ classifiers = [
18
18
  "Topic :: Office/Business :: Financial",
19
19
  "Topic :: Scientific/Engineering :: Visualization",
20
20
  ]
21
- packages = [{include = "charting", from = "src"}]
21
+
22
+ # match your actual src layout: src/api, src/core, src/data, src/web
23
+ packages = [
24
+ { include = "api", from = "src" },
25
+ { include = "core", from = "src" },
26
+ { include = "data", from = "src" },
27
+ { include = "web", from = "src" },
28
+ ]
22
29
 
23
30
  [tool.poetry.dependencies]
24
31
  python = "^3.12"
25
- fastapi = "^0.123.4"
26
- pandas = "^2.3.3"
27
- numpy = "^2.3.5"
28
- pydantic = "^2.12.5"
29
- uvicorn = "^0.38.0"
30
- pytz = "^2025.2"
31
-
32
+ fastapi = ">=0.115.0,<1.0.0"
33
+ pandas = ">=2.2.0,<3.0.0"
34
+ numpy = ">=1.26.0,<3.0.0"
35
+ pydantic = ">=2.7.0,<3.0.0"
36
+ uvicorn = { version = ">=0.24.0,<1.0.0", extras = ["standard"] }
37
+ pytz = ">=2024.1,<2026.0"
32
38
 
33
39
  [tool.poetry.group.dev.dependencies]
34
- pytest = "^9.0.1"
35
- httpx = "^0.28.1"
40
+ pytest = ">=8.3.0,<9.0.0"
41
+ httpx = ">=0.27.0,<0.29.0"
36
42
 
37
43
  [build-system]
38
- requires = ["poetry-core"]
39
- build-backend = "poetry.core.masonry.api"
44
+ requires = ["poetry-core>=1.9.0"]
45
+ build-backend = "poetry.core.masonry.api"
@@ -0,0 +1 @@
1
+ """API endpoints for PyCharting."""