TradeChart 2.3.1__tar.gz → 2.4.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.
Files changed (38) hide show
  1. {tradechart-2.3.1 → tradechart-2.4.0}/PKG-INFO +2 -2
  2. {tradechart-2.3.1 → tradechart-2.4.0}/README.md +1 -1
  3. {tradechart-2.3.1 → tradechart-2.4.0}/TradeChart.egg-info/PKG-INFO +2 -2
  4. {tradechart-2.3.1 → tradechart-2.4.0}/pyproject.toml +1 -1
  5. {tradechart-2.3.1 → tradechart-2.4.0}/tradechart/__init__.py +1 -1
  6. {tradechart-2.3.1 → tradechart-2.4.0}/tradechart/data/fetcher.py +9 -1
  7. {tradechart-2.3.1 → tradechart-2.4.0}/tradechart/data/provider_base.py +11 -0
  8. {tradechart-2.3.1 → tradechart-2.4.0}/tradechart/providers/stooq_provider.py +2 -3
  9. {tradechart-2.3.1 → tradechart-2.4.0}/tradechart/providers/tradingview_provider.py +2 -3
  10. {tradechart-2.3.1 → tradechart-2.4.0}/tradechart/providers/yfinance_provider.py +2 -3
  11. {tradechart-2.3.1 → tradechart-2.4.0}/LICENSE +0 -0
  12. {tradechart-2.3.1 → tradechart-2.4.0}/TradeChart.egg-info/SOURCES.txt +0 -0
  13. {tradechart-2.3.1 → tradechart-2.4.0}/TradeChart.egg-info/dependency_links.txt +0 -0
  14. {tradechart-2.3.1 → tradechart-2.4.0}/TradeChart.egg-info/requires.txt +0 -0
  15. {tradechart-2.3.1 → tradechart-2.4.0}/TradeChart.egg-info/top_level.txt +0 -0
  16. {tradechart-2.3.1 → tradechart-2.4.0}/setup.cfg +0 -0
  17. {tradechart-2.3.1 → tradechart-2.4.0}/tradechart/charts/__init__.py +0 -0
  18. {tradechart-2.3.1 → tradechart-2.4.0}/tradechart/charts/heatmap.py +0 -0
  19. {tradechart-2.3.1 → tradechart-2.4.0}/tradechart/charts/indicators.py +0 -0
  20. {tradechart-2.3.1 → tradechart-2.4.0}/tradechart/charts/renderer.py +0 -0
  21. {tradechart-2.3.1 → tradechart-2.4.0}/tradechart/charts/themes.py +0 -0
  22. {tradechart-2.3.1 → tradechart-2.4.0}/tradechart/charts/watermark.py +0 -0
  23. {tradechart-2.3.1 → tradechart-2.4.0}/tradechart/config/__init__.py +0 -0
  24. {tradechart-2.3.1 → tradechart-2.4.0}/tradechart/config/logger.py +0 -0
  25. {tradechart-2.3.1 → tradechart-2.4.0}/tradechart/config/settings.py +0 -0
  26. {tradechart-2.3.1 → tradechart-2.4.0}/tradechart/core/__init__.py +0 -0
  27. {tradechart-2.3.1 → tradechart-2.4.0}/tradechart/core/engine.py +0 -0
  28. {tradechart-2.3.1 → tradechart-2.4.0}/tradechart/data/__init__.py +0 -0
  29. {tradechart-2.3.1 → tradechart-2.4.0}/tradechart/data/groups.py +0 -0
  30. {tradechart-2.3.1 → tradechart-2.4.0}/tradechart/data/models.py +0 -0
  31. {tradechart-2.3.1 → tradechart-2.4.0}/tradechart/data/store.py +0 -0
  32. {tradechart-2.3.1 → tradechart-2.4.0}/tradechart/providers/__init__.py +0 -0
  33. {tradechart-2.3.1 → tradechart-2.4.0}/tradechart/utils/__init__.py +0 -0
  34. {tradechart-2.3.1 → tradechart-2.4.0}/tradechart/utils/exceptions.py +0 -0
  35. {tradechart-2.3.1 → tradechart-2.4.0}/tradechart/utils/formatting.py +0 -0
  36. {tradechart-2.3.1 → tradechart-2.4.0}/tradechart/utils/install.py +0 -0
  37. {tradechart-2.3.1 → tradechart-2.4.0}/tradechart/utils/validation.py +0 -0
  38. {tradechart-2.3.1 → tradechart-2.4.0}/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.3.1
3
+ Version: 2.4.0
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.3.1
48
+ # TradeChart — Library Edition v2.4.0
49
49
 
50
50
  **Python → Financial Charts**
51
51
  Generate production-quality candlestick, line, area, OHLC, Heikin-Ashi, and performance heatmap charts from code.
@@ -1,4 +1,4 @@
1
- # TradeChart — Library Edition v2.3.1
1
+ # TradeChart — Library Edition v2.4.0
2
2
 
3
3
  **Python → Financial Charts**
4
4
  Generate production-quality candlestick, line, area, OHLC, Heikin-Ashi, and performance heatmap charts from code.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: TradeChart
3
- Version: 2.3.1
3
+ Version: 2.4.0
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.3.1
48
+ # TradeChart — Library Edition v2.4.0
49
49
 
50
50
  **Python → Financial Charts**
51
51
  Generate production-quality candlestick, line, area, OHLC, Heikin-Ashi, and performance heatmap charts from code.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "TradeChart"
7
- version = "2.3.1"
7
+ version = "2.4.0"
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.3.1"
90
+ __version__ = "2.4.0"
91
91
  __all__ = [
92
92
  "terminal", "theme", "watermark", "config",
93
93
  "chart", "compare", "heatmap", "data", "export", "clear_cache",
@@ -14,6 +14,14 @@ from tradechart.data.provider_base import BaseProvider
14
14
  from tradechart.utils.exceptions import DataFetchError
15
15
 
16
16
 
17
+ def _to_utc(df: pd.DataFrame) -> pd.DataFrame:
18
+ if df.index.tz is None:
19
+ df.index = df.index.tz_localize("UTC")
20
+ else:
21
+ df.index = df.index.tz_convert("UTC")
22
+ return df
23
+
24
+
17
25
  def _merge(stored: pd.DataFrame, fresh: pd.DataFrame) -> pd.DataFrame:
18
26
  """Merge stored history with freshly-fetched rows.
19
27
 
@@ -22,7 +30,7 @@ def _merge(stored: pd.DataFrame, fresh: pd.DataFrame) -> pd.DataFrame:
22
30
  (handles end-of-day corrections / partial bars). Rows that exist only
23
31
  in *fresh* (new bars) are appended. The result is sorted by date.
24
32
  """
25
- combined = pd.concat([stored, fresh])
33
+ combined = pd.concat([_to_utc(stored), _to_utc(fresh)])
26
34
  combined = combined[~combined.index.duplicated(keep="last")]
27
35
  return combined.sort_index()
28
36
 
@@ -4,9 +4,20 @@ from __future__ import annotations
4
4
 
5
5
  from abc import ABC, abstractmethod
6
6
 
7
+ import pandas as pd
8
+
7
9
  from tradechart.data.models import MarketData
8
10
 
9
11
 
12
+ def to_utc_index(df: pd.DataFrame) -> pd.DataFrame:
13
+ """Normalise a DataFrame's DatetimeIndex to UTC-aware in-place and return it."""
14
+ if df.index.tz is None:
15
+ df.index = df.index.tz_localize("UTC")
16
+ else:
17
+ df.index = df.index.tz_convert("UTC")
18
+ return df
19
+
20
+
10
21
  class BaseProvider(ABC):
11
22
  """Every data provider must implement this interface."""
12
23
 
@@ -8,7 +8,7 @@ from io import StringIO
8
8
  import pandas as pd
9
9
 
10
10
  from tradechart.data.models import MarketData
11
- from tradechart.data.provider_base import BaseProvider
11
+ from tradechart.data.provider_base import BaseProvider, to_utc_index
12
12
  from tradechart.config.logger import get_logger
13
13
 
14
14
  _DAYS_MAP: dict[str, int] = {
@@ -56,7 +56,6 @@ class StooqProvider(BaseProvider):
56
56
  keep = ["Open", "High", "Low", "Close", "Volume"]
57
57
  df = df[[c for c in keep if c in df.columns]]
58
58
 
59
- if df.index.tz is not None:
60
- df.index = df.index.tz_localize(None)
59
+ to_utc_index(df)
61
60
 
62
61
  return MarketData(ticker=ticker, duration=duration, provider=self.name, df=df)
@@ -5,7 +5,7 @@ from __future__ import annotations
5
5
  import pandas as pd
6
6
 
7
7
  from tradechart.data.models import MarketData
8
- from tradechart.data.provider_base import BaseProvider
8
+ from tradechart.data.provider_base import BaseProvider, to_utc_index
9
9
  from tradechart.config.logger import get_logger
10
10
 
11
11
  _DURATION_MAP: dict[str, tuple[int, str]] = {
@@ -62,7 +62,6 @@ class TradingViewProvider(BaseProvider):
62
62
  keep = [c for c in ["Open", "High", "Low", "Close", "Volume"] if c in df.columns]
63
63
  df = df[keep]
64
64
 
65
- if df.index.tz is not None:
66
- df.index = df.index.tz_localize(None)
65
+ to_utc_index(df)
67
66
 
68
67
  return MarketData(ticker=ticker, duration=duration, provider=self.name, df=df)
@@ -3,7 +3,7 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  from tradechart.data.models import MarketData, DURATION_RESOLUTION_MAP
6
- from tradechart.data.provider_base import BaseProvider
6
+ from tradechart.data.provider_base import BaseProvider, to_utc_index
7
7
  from tradechart.config.logger import get_logger
8
8
 
9
9
 
@@ -31,7 +31,6 @@ class YFinanceProvider(BaseProvider):
31
31
  col_map = {"Open": "Open", "High": "High", "Low": "Low", "Close": "Close", "Volume": "Volume"}
32
32
  df = df.rename(columns=col_map)[list(col_map.values())]
33
33
 
34
- if df.index.tz is not None:
35
- df.index = df.index.tz_localize(None)
34
+ to_utc_index(df)
36
35
 
37
36
  return MarketData(ticker=ticker, duration=duration, provider=self.name, df=df)
File without changes
File without changes