TradeChart 2.2.1__tar.gz → 2.3.1__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 (38) hide show
  1. {tradechart-2.2.1 → tradechart-2.3.1}/PKG-INFO +5 -5
  2. {tradechart-2.2.1 → tradechart-2.3.1}/README.md +4 -4
  3. {tradechart-2.2.1 → tradechart-2.3.1}/TradeChart.egg-info/PKG-INFO +5 -5
  4. {tradechart-2.2.1 → tradechart-2.3.1}/pyproject.toml +1 -1
  5. {tradechart-2.2.1 → tradechart-2.3.1}/tradechart/__init__.py +1 -1
  6. {tradechart-2.2.1 → tradechart-2.3.1}/tradechart/charts/heatmap.py +9 -2
  7. {tradechart-2.2.1 → tradechart-2.3.1}/tradechart/charts/renderer.py +20 -12
  8. {tradechart-2.2.1 → tradechart-2.3.1}/tradechart/config/settings.py +3 -3
  9. {tradechart-2.2.1 → tradechart-2.3.1}/LICENSE +0 -0
  10. {tradechart-2.2.1 → tradechart-2.3.1}/TradeChart.egg-info/SOURCES.txt +0 -0
  11. {tradechart-2.2.1 → tradechart-2.3.1}/TradeChart.egg-info/dependency_links.txt +0 -0
  12. {tradechart-2.2.1 → tradechart-2.3.1}/TradeChart.egg-info/requires.txt +0 -0
  13. {tradechart-2.2.1 → tradechart-2.3.1}/TradeChart.egg-info/top_level.txt +0 -0
  14. {tradechart-2.2.1 → tradechart-2.3.1}/setup.cfg +0 -0
  15. {tradechart-2.2.1 → tradechart-2.3.1}/tradechart/charts/__init__.py +0 -0
  16. {tradechart-2.2.1 → tradechart-2.3.1}/tradechart/charts/indicators.py +0 -0
  17. {tradechart-2.2.1 → tradechart-2.3.1}/tradechart/charts/themes.py +0 -0
  18. {tradechart-2.2.1 → tradechart-2.3.1}/tradechart/charts/watermark.py +0 -0
  19. {tradechart-2.2.1 → tradechart-2.3.1}/tradechart/config/__init__.py +0 -0
  20. {tradechart-2.2.1 → tradechart-2.3.1}/tradechart/config/logger.py +0 -0
  21. {tradechart-2.2.1 → tradechart-2.3.1}/tradechart/core/__init__.py +0 -0
  22. {tradechart-2.2.1 → tradechart-2.3.1}/tradechart/core/engine.py +0 -0
  23. {tradechart-2.2.1 → tradechart-2.3.1}/tradechart/data/__init__.py +0 -0
  24. {tradechart-2.2.1 → tradechart-2.3.1}/tradechart/data/fetcher.py +0 -0
  25. {tradechart-2.2.1 → tradechart-2.3.1}/tradechart/data/groups.py +0 -0
  26. {tradechart-2.2.1 → tradechart-2.3.1}/tradechart/data/models.py +0 -0
  27. {tradechart-2.2.1 → tradechart-2.3.1}/tradechart/data/provider_base.py +0 -0
  28. {tradechart-2.2.1 → tradechart-2.3.1}/tradechart/data/store.py +0 -0
  29. {tradechart-2.2.1 → tradechart-2.3.1}/tradechart/providers/__init__.py +0 -0
  30. {tradechart-2.2.1 → tradechart-2.3.1}/tradechart/providers/stooq_provider.py +0 -0
  31. {tradechart-2.2.1 → tradechart-2.3.1}/tradechart/providers/tradingview_provider.py +0 -0
  32. {tradechart-2.2.1 → tradechart-2.3.1}/tradechart/providers/yfinance_provider.py +0 -0
  33. {tradechart-2.2.1 → tradechart-2.3.1}/tradechart/utils/__init__.py +0 -0
  34. {tradechart-2.2.1 → tradechart-2.3.1}/tradechart/utils/exceptions.py +0 -0
  35. {tradechart-2.2.1 → tradechart-2.3.1}/tradechart/utils/formatting.py +0 -0
  36. {tradechart-2.2.1 → tradechart-2.3.1}/tradechart/utils/install.py +0 -0
  37. {tradechart-2.2.1 → tradechart-2.3.1}/tradechart/utils/validation.py +0 -0
  38. {tradechart-2.2.1 → tradechart-2.3.1}/tradechart_examples/discord_demo_bot/discord_bot.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: TradeChart
3
- Version: 2.2.1
3
+ Version: 2.3.1
4
4
  Summary: Production-quality financial chart generator — candlestick, line, area, OHLC, Heikin-Ashi, performance heatmaps, and sector group charts.
5
5
  Author-email: "TRADELY.DEV" <dev@tradely.dev>
6
6
  License: Apache-2.0
@@ -45,7 +45,7 @@ Requires-Dist: build>=1.0; extra == "dev"
45
45
  Requires-Dist: twine>=5.0; extra == "dev"
46
46
  Dynamic: license-file
47
47
 
48
- # TradeChart — Library Edition v2.2.1
48
+ # TradeChart — Library Edition v2.3.1
49
49
 
50
50
  **Python → Financial Charts**
51
51
  Generate production-quality candlestick, line, area, OHLC, Heikin-Ashi, and performance heatmap charts from code.
@@ -450,8 +450,8 @@ tc.config(
450
450
  | `theme` | `str` | `"dark"` | `"dark"`, `"light"`, `"classic"` | Chart colour theme. See [Themes](#themes). |
451
451
  | `watermark` | `bool` | `True` | `True`, `False` | Show or hide the TRADELY logo in the bottom-left corner of charts. |
452
452
  | `overwrite` | `bool` | `False` | `True`, `False` | `False` — append `_1`, `_2`, … to the filename if it already exists. `True` — overwrite the existing file silently. |
453
- | `dpi` | `int` | `150` | `50`–`600` | Output resolution in dots per inch. Higher values produce larger, sharper files. |
454
- | `fig_size` | `tuple[int, int]` | `(14, 7)` | Any valid `(width, height)` in inches | Matplotlib figure size. Increase for wide monitors or presentations. |
453
+ | `dpi` | `int` | `100` | `50`–`600` | Output resolution in dots per inch. Higher values produce larger, sharper files. |
454
+ | `fig_size` | `tuple[int, int]` | `(12, 6)` | Any valid `(width, height)` in inches | Matplotlib figure size. Increase for wide monitors or presentations. |
455
455
  | `cache_ttl` | `int` | `300` | Any positive integer (seconds) | How long fetched data is kept in memory. `0` effectively disables caching. |
456
456
 
457
457
  ---
@@ -602,7 +602,7 @@ The `"heikin_ashi"` chart type converts standard OHLC data to Heikin-Ashi candle
602
602
  When `mplfinance` is installed (`pip install TradeChart[mplfinance]`), candlestick and Heikin-Ashi charts use it for higher-quality rendering. Otherwise a pure-matplotlib fallback is used automatically — no configuration required.
603
603
 
604
604
  **Output resolution**
605
- Default DPI is 150, producing a ~2100 × 1050 px image at the default figure size. Increase with `tc.config(dpi=300)` for print-quality output.
605
+ Default DPI is 100, producing a ~1200 × 600 px image at the default figure size — well under 300 KB for all supported formats. Increase with `tc.config(dpi=200)` for sharper output, or `tc.config(dpi=300)` for print quality.
606
606
 
607
607
  ---
608
608
 
@@ -1,4 +1,4 @@
1
- # TradeChart — Library Edition v2.2.1
1
+ # TradeChart — Library Edition v2.3.1
2
2
 
3
3
  **Python → Financial Charts**
4
4
  Generate production-quality candlestick, line, area, OHLC, Heikin-Ashi, and performance heatmap charts from code.
@@ -403,8 +403,8 @@ tc.config(
403
403
  | `theme` | `str` | `"dark"` | `"dark"`, `"light"`, `"classic"` | Chart colour theme. See [Themes](#themes). |
404
404
  | `watermark` | `bool` | `True` | `True`, `False` | Show or hide the TRADELY logo in the bottom-left corner of charts. |
405
405
  | `overwrite` | `bool` | `False` | `True`, `False` | `False` — append `_1`, `_2`, … to the filename if it already exists. `True` — overwrite the existing file silently. |
406
- | `dpi` | `int` | `150` | `50`–`600` | Output resolution in dots per inch. Higher values produce larger, sharper files. |
407
- | `fig_size` | `tuple[int, int]` | `(14, 7)` | Any valid `(width, height)` in inches | Matplotlib figure size. Increase for wide monitors or presentations. |
406
+ | `dpi` | `int` | `100` | `50`–`600` | Output resolution in dots per inch. Higher values produce larger, sharper files. |
407
+ | `fig_size` | `tuple[int, int]` | `(12, 6)` | Any valid `(width, height)` in inches | Matplotlib figure size. Increase for wide monitors or presentations. |
408
408
  | `cache_ttl` | `int` | `300` | Any positive integer (seconds) | How long fetched data is kept in memory. `0` effectively disables caching. |
409
409
 
410
410
  ---
@@ -555,7 +555,7 @@ The `"heikin_ashi"` chart type converts standard OHLC data to Heikin-Ashi candle
555
555
  When `mplfinance` is installed (`pip install TradeChart[mplfinance]`), candlestick and Heikin-Ashi charts use it for higher-quality rendering. Otherwise a pure-matplotlib fallback is used automatically — no configuration required.
556
556
 
557
557
  **Output resolution**
558
- Default DPI is 150, producing a ~2100 × 1050 px image at the default figure size. Increase with `tc.config(dpi=300)` for print-quality output.
558
+ Default DPI is 100, producing a ~1200 × 600 px image at the default figure size — well under 300 KB for all supported formats. Increase with `tc.config(dpi=200)` for sharper output, or `tc.config(dpi=300)` for print quality.
559
559
 
560
560
  ---
561
561
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: TradeChart
3
- Version: 2.2.1
3
+ Version: 2.3.1
4
4
  Summary: Production-quality financial chart generator — candlestick, line, area, OHLC, Heikin-Ashi, performance heatmaps, and sector group charts.
5
5
  Author-email: "TRADELY.DEV" <dev@tradely.dev>
6
6
  License: Apache-2.0
@@ -45,7 +45,7 @@ Requires-Dist: build>=1.0; extra == "dev"
45
45
  Requires-Dist: twine>=5.0; extra == "dev"
46
46
  Dynamic: license-file
47
47
 
48
- # TradeChart — Library Edition v2.2.1
48
+ # TradeChart — Library Edition v2.3.1
49
49
 
50
50
  **Python → Financial Charts**
51
51
  Generate production-quality candlestick, line, area, OHLC, Heikin-Ashi, and performance heatmap charts from code.
@@ -450,8 +450,8 @@ tc.config(
450
450
  | `theme` | `str` | `"dark"` | `"dark"`, `"light"`, `"classic"` | Chart colour theme. See [Themes](#themes). |
451
451
  | `watermark` | `bool` | `True` | `True`, `False` | Show or hide the TRADELY logo in the bottom-left corner of charts. |
452
452
  | `overwrite` | `bool` | `False` | `True`, `False` | `False` — append `_1`, `_2`, … to the filename if it already exists. `True` — overwrite the existing file silently. |
453
- | `dpi` | `int` | `150` | `50`–`600` | Output resolution in dots per inch. Higher values produce larger, sharper files. |
454
- | `fig_size` | `tuple[int, int]` | `(14, 7)` | Any valid `(width, height)` in inches | Matplotlib figure size. Increase for wide monitors or presentations. |
453
+ | `dpi` | `int` | `100` | `50`–`600` | Output resolution in dots per inch. Higher values produce larger, sharper files. |
454
+ | `fig_size` | `tuple[int, int]` | `(12, 6)` | Any valid `(width, height)` in inches | Matplotlib figure size. Increase for wide monitors or presentations. |
455
455
  | `cache_ttl` | `int` | `300` | Any positive integer (seconds) | How long fetched data is kept in memory. `0` effectively disables caching. |
456
456
 
457
457
  ---
@@ -602,7 +602,7 @@ The `"heikin_ashi"` chart type converts standard OHLC data to Heikin-Ashi candle
602
602
  When `mplfinance` is installed (`pip install TradeChart[mplfinance]`), candlestick and Heikin-Ashi charts use it for higher-quality rendering. Otherwise a pure-matplotlib fallback is used automatically — no configuration required.
603
603
 
604
604
  **Output resolution**
605
- Default DPI is 150, producing a ~2100 × 1050 px image at the default figure size. Increase with `tc.config(dpi=300)` for print-quality output.
605
+ Default DPI is 100, producing a ~1200 × 600 px image at the default figure size — well under 300 KB for all supported formats. Increase with `tc.config(dpi=200)` for sharper output, or `tc.config(dpi=300)` for print quality.
606
606
 
607
607
  ---
608
608
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "TradeChart"
7
- version = "2.2.1"
7
+ version = "2.3.1"
8
8
  description = "Production-quality financial chart generator — candlestick, line, area, OHLC, Heikin-Ashi, performance heatmaps, and sector group charts."
9
9
  readme = "README.md"
10
10
  license = {text = "Apache-2.0"}
@@ -87,7 +87,7 @@ from tradechart.utils.exceptions import (
87
87
  )
88
88
  from tradechart.utils.validation import VALID_DURATIONS
89
89
 
90
- __version__ = "2.2.1"
90
+ __version__ = "2.3.1"
91
91
  __all__ = [
92
92
  "terminal", "theme", "watermark", "config",
93
93
  "chart", "compare", "heatmap", "data", "export", "clear_cache",
@@ -345,8 +345,15 @@ class HeatmapRenderer:
345
345
  stamp_logo(fig, provider=provider)
346
346
 
347
347
  out_file = output_path.with_suffix(f".{fmt}")
348
- fig.savefig(out_file, dpi=settings.dpi,
349
- facecolor=fig.get_facecolor(), bbox_inches="tight")
348
+ pil_kwargs: dict = {}
349
+ if fmt == "png":
350
+ pil_kwargs = {"compress_level": 6, "optimize": True}
351
+ elif fmt in ("jpg", "jpeg", "webp"):
352
+ pil_kwargs = {"quality": 82, "optimize": True}
353
+ save_kwargs: dict = {"dpi": settings.dpi, "facecolor": fig.get_facecolor(), "bbox_inches": "tight"}
354
+ if pil_kwargs:
355
+ save_kwargs["pil_kwargs"] = pil_kwargs
356
+ fig.savefig(out_file, **save_kwargs)
350
357
  plt.close(fig)
351
358
  log.detail("Saved heatmap → %s", out_file)
352
359
  return out_file
@@ -131,9 +131,9 @@ class ChartRenderer:
131
131
 
132
132
  # Wicks — two batch vlines calls instead of N individual plot() calls
133
133
  ax_price.vlines(x_arr[up_mask], lows[up_mask], highs[up_mask],
134
- colors=theme.up_color, linewidth=0.6)
134
+ colors=theme.up_color, linewidth=0.5)
135
135
  ax_price.vlines(x_arr[~up_mask], lows[~up_mask], highs[~up_mask],
136
- colors=theme.down_color, linewidth=0.6)
136
+ colors=theme.down_color, linewidth=0.5)
137
137
 
138
138
  # Bodies — two batch bar calls instead of N individual bar() calls
139
139
  body_w = max(0.4, min(0.8, 60 / max(len(df), 1)))
@@ -186,8 +186,7 @@ class ChartRenderer:
186
186
  stamp_logo(fig, provider=meta.provider)
187
187
 
188
188
  out_file = out.with_suffix(f".{fmt}")
189
- fig.savefig(out_file, dpi=get_settings().dpi,
190
- facecolor=fig.get_facecolor(), bbox_inches="tight")
189
+ self._savefig(fig, out_file, fmt, get_settings().dpi)
191
190
  plt.close(fig)
192
191
  log.detail("Saved candlestick chart → %s", out_file)
193
192
  return out_file
@@ -255,8 +254,7 @@ class ChartRenderer:
255
254
  stamp_logo(fig, provider=meta.provider)
256
255
 
257
256
  out_file = out.with_suffix(f".{fmt}")
258
- fig.savefig(str(out_file), dpi=settings.dpi,
259
- bbox_inches="tight", facecolor=fig.get_facecolor())
257
+ self._savefig(fig, out_file, fmt, settings.dpi)
260
258
  plt.close(fig)
261
259
  get_logger().detail("Saved mplfinance chart → %s", out_file)
262
260
  return out_file
@@ -321,8 +319,7 @@ class ChartRenderer:
321
319
  stamp_logo(fig, provider=meta.provider)
322
320
 
323
321
  out_file = out.with_suffix(f".{fmt}")
324
- fig.savefig(out_file, dpi=settings.dpi,
325
- facecolor=fig.get_facecolor(), bbox_inches="tight")
322
+ self._savefig(fig, out_file, fmt, settings.dpi)
326
323
  plt.close(fig)
327
324
  get_logger().detail("Saved OHLC chart → %s", out_file)
328
325
  return out_file
@@ -352,8 +349,7 @@ class ChartRenderer:
352
349
  stamp_logo(fig, provider=meta.provider)
353
350
 
354
351
  out_file = out.with_suffix(f".{fmt}")
355
- fig.savefig(out_file, dpi=settings.dpi,
356
- facecolor=fig.get_facecolor(), bbox_inches="tight")
352
+ self._savefig(fig, out_file, fmt, settings.dpi)
357
353
  plt.close(fig)
358
354
  get_logger().detail("Saved line chart → %s", out_file)
359
355
  return out_file
@@ -384,8 +380,7 @@ class ChartRenderer:
384
380
  stamp_logo(fig, provider=meta.provider)
385
381
 
386
382
  out_file = out.with_suffix(f".{fmt}")
387
- fig.savefig(out_file, dpi=settings.dpi,
388
- facecolor=fig.get_facecolor(), bbox_inches="tight")
383
+ self._savefig(fig, out_file, fmt, settings.dpi)
389
384
  plt.close(fig)
390
385
  get_logger().detail("Saved area chart → %s", out_file)
391
386
  return out_file
@@ -439,6 +434,19 @@ class ChartRenderer:
439
434
  for spine in ax.spines.values():
440
435
  spine.set_visible(False)
441
436
 
437
+ @staticmethod
438
+ def _savefig(fig: plt.Figure, out_file: Path, fmt: str, dpi: int) -> None:
439
+ """Save *fig* with format-specific compression to keep file sizes small."""
440
+ pil_kwargs: dict = {}
441
+ if fmt == "png":
442
+ pil_kwargs = {"compress_level": 6, "optimize": True}
443
+ elif fmt in ("jpg", "jpeg", "webp"):
444
+ pil_kwargs = {"quality": 82, "optimize": True}
445
+ kwargs: dict = {"dpi": dpi, "facecolor": fig.get_facecolor(), "bbox_inches": "tight"}
446
+ if pil_kwargs:
447
+ kwargs["pil_kwargs"] = pil_kwargs
448
+ fig.savefig(out_file, **kwargs)
449
+
442
450
  @staticmethod
443
451
  def _set_date_labels(ax: plt.Axes, df: pd.DataFrame, theme: Theme) -> None:
444
452
  n = len(df)
@@ -32,9 +32,9 @@ class Settings:
32
32
  inst._theme: ThemeName = "dark"
33
33
  inst._watermark_enabled: bool = True
34
34
  inst._overwrite: bool = False
35
- inst._dpi: int = 150
36
- inst._fig_width: int = 14
37
- inst._fig_height: int = 7
35
+ inst._dpi: int = 100
36
+ inst._fig_width: int = 12
37
+ inst._fig_height: int = 6
38
38
  inst._cache_ttl: int = 300
39
39
  inst._disk_store: DiskStore | None = None
40
40
  cls._instance = inst
File without changes
File without changes