TradeChart 2.2.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.
- {tradechart-2.2.1 → tradechart-2.4.0}/PKG-INFO +5 -5
- {tradechart-2.2.1 → tradechart-2.4.0}/README.md +4 -4
- {tradechart-2.2.1 → tradechart-2.4.0}/TradeChart.egg-info/PKG-INFO +5 -5
- {tradechart-2.2.1 → tradechart-2.4.0}/pyproject.toml +1 -1
- {tradechart-2.2.1 → tradechart-2.4.0}/tradechart/__init__.py +1 -1
- {tradechart-2.2.1 → tradechart-2.4.0}/tradechart/charts/heatmap.py +9 -2
- {tradechart-2.2.1 → tradechart-2.4.0}/tradechart/charts/renderer.py +20 -12
- {tradechart-2.2.1 → tradechart-2.4.0}/tradechart/config/settings.py +3 -3
- {tradechart-2.2.1 → tradechart-2.4.0}/tradechart/data/fetcher.py +9 -1
- {tradechart-2.2.1 → tradechart-2.4.0}/tradechart/data/provider_base.py +11 -0
- {tradechart-2.2.1 → tradechart-2.4.0}/tradechart/providers/stooq_provider.py +2 -3
- {tradechart-2.2.1 → tradechart-2.4.0}/tradechart/providers/tradingview_provider.py +2 -3
- {tradechart-2.2.1 → tradechart-2.4.0}/tradechart/providers/yfinance_provider.py +2 -3
- {tradechart-2.2.1 → tradechart-2.4.0}/LICENSE +0 -0
- {tradechart-2.2.1 → tradechart-2.4.0}/TradeChart.egg-info/SOURCES.txt +0 -0
- {tradechart-2.2.1 → tradechart-2.4.0}/TradeChart.egg-info/dependency_links.txt +0 -0
- {tradechart-2.2.1 → tradechart-2.4.0}/TradeChart.egg-info/requires.txt +0 -0
- {tradechart-2.2.1 → tradechart-2.4.0}/TradeChart.egg-info/top_level.txt +0 -0
- {tradechart-2.2.1 → tradechart-2.4.0}/setup.cfg +0 -0
- {tradechart-2.2.1 → tradechart-2.4.0}/tradechart/charts/__init__.py +0 -0
- {tradechart-2.2.1 → tradechart-2.4.0}/tradechart/charts/indicators.py +0 -0
- {tradechart-2.2.1 → tradechart-2.4.0}/tradechart/charts/themes.py +0 -0
- {tradechart-2.2.1 → tradechart-2.4.0}/tradechart/charts/watermark.py +0 -0
- {tradechart-2.2.1 → tradechart-2.4.0}/tradechart/config/__init__.py +0 -0
- {tradechart-2.2.1 → tradechart-2.4.0}/tradechart/config/logger.py +0 -0
- {tradechart-2.2.1 → tradechart-2.4.0}/tradechart/core/__init__.py +0 -0
- {tradechart-2.2.1 → tradechart-2.4.0}/tradechart/core/engine.py +0 -0
- {tradechart-2.2.1 → tradechart-2.4.0}/tradechart/data/__init__.py +0 -0
- {tradechart-2.2.1 → tradechart-2.4.0}/tradechart/data/groups.py +0 -0
- {tradechart-2.2.1 → tradechart-2.4.0}/tradechart/data/models.py +0 -0
- {tradechart-2.2.1 → tradechart-2.4.0}/tradechart/data/store.py +0 -0
- {tradechart-2.2.1 → tradechart-2.4.0}/tradechart/providers/__init__.py +0 -0
- {tradechart-2.2.1 → tradechart-2.4.0}/tradechart/utils/__init__.py +0 -0
- {tradechart-2.2.1 → tradechart-2.4.0}/tradechart/utils/exceptions.py +0 -0
- {tradechart-2.2.1 → tradechart-2.4.0}/tradechart/utils/formatting.py +0 -0
- {tradechart-2.2.1 → tradechart-2.4.0}/tradechart/utils/install.py +0 -0
- {tradechart-2.2.1 → tradechart-2.4.0}/tradechart/utils/validation.py +0 -0
- {tradechart-2.2.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
|
+
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.
|
|
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.
|
|
@@ -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` | `
|
|
454
|
-
| `fig_size` | `tuple[int, int]` | `(
|
|
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
|
|
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.
|
|
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.
|
|
@@ -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` | `
|
|
407
|
-
| `fig_size` | `tuple[int, int]` | `(
|
|
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
|
|
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.
|
|
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.
|
|
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.
|
|
@@ -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` | `
|
|
454
|
-
| `fig_size` | `tuple[int, int]` | `(
|
|
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
|
|
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.
|
|
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.
|
|
90
|
+
__version__ = "2.4.0"
|
|
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
|
-
|
|
349
|
-
|
|
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.
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 =
|
|
36
|
-
inst._fig_width: int =
|
|
37
|
-
inst._fig_height: int =
|
|
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
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|