TradeChart 2.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.
- tradechart-2.0.0/LICENSE +21 -0
- tradechart-2.0.0/PKG-INFO +269 -0
- tradechart-2.0.0/README.md +220 -0
- tradechart-2.0.0/TradeChart.egg-info/PKG-INFO +269 -0
- tradechart-2.0.0/TradeChart.egg-info/SOURCES.txt +32 -0
- tradechart-2.0.0/TradeChart.egg-info/dependency_links.txt +1 -0
- tradechart-2.0.0/TradeChart.egg-info/requires.txt +25 -0
- tradechart-2.0.0/TradeChart.egg-info/top_level.txt +1 -0
- tradechart-2.0.0/pyproject.toml +75 -0
- tradechart-2.0.0/setup.cfg +4 -0
- tradechart-2.0.0/tests/test_tradechart.py +122 -0
- tradechart-2.0.0/tradechart/__init__.py +262 -0
- tradechart-2.0.0/tradechart/charts/__init__.py +8 -0
- tradechart-2.0.0/tradechart/charts/indicators.py +74 -0
- tradechart-2.0.0/tradechart/charts/renderer.py +441 -0
- tradechart-2.0.0/tradechart/charts/themes.py +75 -0
- tradechart-2.0.0/tradechart/charts/watermark.py +116 -0
- tradechart-2.0.0/tradechart/config/__init__.py +6 -0
- tradechart-2.0.0/tradechart/config/logger.py +79 -0
- tradechart-2.0.0/tradechart/config/settings.py +141 -0
- tradechart-2.0.0/tradechart/core/__init__.py +5 -0
- tradechart-2.0.0/tradechart/core/engine.py +227 -0
- tradechart-2.0.0/tradechart/data/__init__.py +6 -0
- tradechart-2.0.0/tradechart/data/fetcher.py +88 -0
- tradechart-2.0.0/tradechart/data/models.py +71 -0
- tradechart-2.0.0/tradechart/data/provider_base.py +20 -0
- tradechart-2.0.0/tradechart/providers/__init__.py +7 -0
- tradechart-2.0.0/tradechart/providers/stooq_provider.py +62 -0
- tradechart-2.0.0/tradechart/providers/tradingview_provider.py +69 -0
- tradechart-2.0.0/tradechart/providers/yfinance_provider.py +38 -0
- tradechart-2.0.0/tradechart/utils/__init__.py +21 -0
- tradechart-2.0.0/tradechart/utils/exceptions.py +27 -0
- tradechart-2.0.0/tradechart/utils/formatting.py +20 -0
- tradechart-2.0.0/tradechart/utils/validation.py +99 -0
tradechart-2.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 TRADELY.DEV
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: TradeChart
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: Production-quality financial chart generator — candlestick, line, area, OHLC, Heikin-Ashi with technical indicators.
|
|
5
|
+
Author-email: "TRADELY.DEV" <dev@tradely.dev>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/techareaone/TradeChart
|
|
8
|
+
Project-URL: Documentation, https://doc.tradely.dev
|
|
9
|
+
Project-URL: Repository, https://github.com/techareaone/TradeChart
|
|
10
|
+
Project-URL: Issues, https://github.com/techareaone/TradeChart/issues
|
|
11
|
+
Project-URL: Changelog, https://github.com/techareaone/TradeChart/blob/main/CHANGELOG.md
|
|
12
|
+
Keywords: finance,chart,candlestick,stock,trading,ohlc,technical-analysis,matplotlib,yfinance
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Topic :: Office/Business :: Financial :: Investment
|
|
24
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
25
|
+
Requires-Python: >=3.10
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: matplotlib>=3.7
|
|
29
|
+
Requires-Dist: pandas>=2.0
|
|
30
|
+
Requires-Dist: yfinance>=0.2.18
|
|
31
|
+
Requires-Dist: numpy>=1.24
|
|
32
|
+
Provides-Extra: tradingview
|
|
33
|
+
Requires-Dist: tvDatafeed>=2.1; extra == "tradingview"
|
|
34
|
+
Provides-Extra: mplfinance
|
|
35
|
+
Requires-Dist: mplfinance>=0.12; extra == "mplfinance"
|
|
36
|
+
Provides-Extra: xlsx
|
|
37
|
+
Requires-Dist: openpyxl>=3.1; extra == "xlsx"
|
|
38
|
+
Provides-Extra: all
|
|
39
|
+
Requires-Dist: tvDatafeed>=2.1; extra == "all"
|
|
40
|
+
Requires-Dist: mplfinance>=0.12; extra == "all"
|
|
41
|
+
Requires-Dist: openpyxl>=3.1; extra == "all"
|
|
42
|
+
Provides-Extra: dev
|
|
43
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
44
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
45
|
+
Requires-Dist: ruff>=0.4; extra == "dev"
|
|
46
|
+
Requires-Dist: build>=1.0; extra == "dev"
|
|
47
|
+
Requires-Dist: twine>=5.0; extra == "dev"
|
|
48
|
+
Dynamic: license-file
|
|
49
|
+
|
|
50
|
+
# TradeChart — Library Edition v2.0.0
|
|
51
|
+
|
|
52
|
+
**Python → Financial Charts**
|
|
53
|
+
Generate production-quality candlestick, line, area, and OHLC charts from code.
|
|
54
|
+
|
|
55
|
+
## Quick Start
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
import tradechart as tc
|
|
59
|
+
|
|
60
|
+
tc.terminal("full")
|
|
61
|
+
tc.chart("AAPL", "1mo", "candle", indicators=["sma", "bollinger"])
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## API Reference
|
|
65
|
+
|
|
66
|
+
| Command | Required | Default | Description |
|
|
67
|
+
|---|---|---|---|
|
|
68
|
+
| `tc.terminal(mode)` | No | `"on_done"` | Set logging verbosity |
|
|
69
|
+
| `tc.theme(name)` | No | `"dark"` | Set chart colour theme |
|
|
70
|
+
| `tc.watermark(enabled)` | No | `True` | Toggle the TRADELY logo watermark |
|
|
71
|
+
| `tc.config(**kwargs)` | No | — | Batch-set global options (see below) |
|
|
72
|
+
| `tc.chart(...)` | — | — | Fetch data and render a chart image |
|
|
73
|
+
| `tc.compare(...)` | — | — | Overlay multiple tickers on one chart |
|
|
74
|
+
| `tc.data(...)` | — | — | Fetch raw OHLCV data as a DataFrame |
|
|
75
|
+
| `tc.export(...)` | — | — | Export market data to CSV / JSON / XLSX |
|
|
76
|
+
| `tc.clear_cache()` | No | — | Flush the in-memory data cache |
|
|
77
|
+
|
|
78
|
+
## `tc.chart()` — Render a Chart
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
path = tc.chart(
|
|
82
|
+
"AAPL",
|
|
83
|
+
duration="3mo",
|
|
84
|
+
chart_type="candle",
|
|
85
|
+
indicators=["sma", "rsi", "macd"],
|
|
86
|
+
show_volume=True,
|
|
87
|
+
fmt="png",
|
|
88
|
+
output_location="./charts",
|
|
89
|
+
output_name="apple_q1.png",
|
|
90
|
+
)
|
|
91
|
+
print(f"Saved → {path}")
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
| Parameter | Required | Default | Description |
|
|
95
|
+
|---|---|---|---|
|
|
96
|
+
| `ticker` | Yes | — | Instrument symbol — `"AAPL"`, `"BTC-USD"`, `"EURUSD=X"` |
|
|
97
|
+
| `duration` | No | `"1mo"` | Time span (see Durations below) |
|
|
98
|
+
| `chart_type` | No | `"candle"` | `"candle"` `"line"` `"ohlc"` `"area"` `"heikin_ashi"` |
|
|
99
|
+
| `output_location` | No | cwd | Directory for the output file |
|
|
100
|
+
| `output_name` | No | auto | Filename — defaults to `{TICKER}_{duration}_{type}.{fmt}` |
|
|
101
|
+
| `fmt` | No | `"png"` | `"png"` `"jpg"` `"svg"` `"pdf"` `"webp"` |
|
|
102
|
+
| `indicators` | No | None | List of indicator names (see Indicators below) |
|
|
103
|
+
| `show_volume` | No | `True` | Show volume sub-panel |
|
|
104
|
+
|
|
105
|
+
## `tc.compare()` — Multi-Ticker Overlay
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
path = tc.compare(
|
|
109
|
+
["AAPL", "MSFT", "GOOG"],
|
|
110
|
+
duration="6mo",
|
|
111
|
+
normalise=True,
|
|
112
|
+
fmt="png",
|
|
113
|
+
)
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
| Parameter | Required | Default | Description |
|
|
117
|
+
|---|---|---|---|
|
|
118
|
+
| `tickers` | Yes | — | 2–8 ticker symbols to compare |
|
|
119
|
+
| `duration` | No | `"1mo"` | Shared time span |
|
|
120
|
+
| `normalise` | No | `True` | Show percentage change from period start |
|
|
121
|
+
| `output_location` | No | cwd | Output directory |
|
|
122
|
+
| `output_name` | No | auto | Output filename |
|
|
123
|
+
| `fmt` | No | `"png"` | Output format |
|
|
124
|
+
|
|
125
|
+
## `tc.data()` — Raw Data
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
df = tc.data("TSLA", "3mo")
|
|
129
|
+
print(df.head())
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Returns a `pandas.DataFrame` with columns `Open`, `High`, `Low`, `Close`, `Volume` and a `DatetimeIndex`.
|
|
133
|
+
|
|
134
|
+
## `tc.export()` — Export Data
|
|
135
|
+
|
|
136
|
+
```python
|
|
137
|
+
path = tc.export("AAPL", "1y", fmt="csv", output_location="./exports")
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
| Parameter | Required | Default | Description |
|
|
141
|
+
|---|---|---|---|
|
|
142
|
+
| `ticker` | Yes | — | Instrument symbol |
|
|
143
|
+
| `duration` | No | `"1mo"` | Time span |
|
|
144
|
+
| `fmt` | No | `"csv"` | `"csv"` `"json"` `"xlsx"` |
|
|
145
|
+
| `output_location` | No | cwd | Output directory |
|
|
146
|
+
| `output_name` | No | auto | Output filename |
|
|
147
|
+
|
|
148
|
+
## Durations
|
|
149
|
+
|
|
150
|
+
| Value | Period |
|
|
151
|
+
|---|---|
|
|
152
|
+
| `"1d"` | 1 day (5-min bars) |
|
|
153
|
+
| `"5d"` | 5 days (15-min bars) |
|
|
154
|
+
| `"1mo"` | 1 month (daily) |
|
|
155
|
+
| `"3mo"` | 3 months (daily) |
|
|
156
|
+
| `"6mo"` | 6 months (daily) |
|
|
157
|
+
| `"1y"` | 1 year (weekly) |
|
|
158
|
+
| `"2y"` | 2 years (weekly) |
|
|
159
|
+
| `"5y"` | 5 years (weekly) |
|
|
160
|
+
| `"10y"` | 10 years (monthly) |
|
|
161
|
+
| `"max"` | All available (monthly) |
|
|
162
|
+
|
|
163
|
+
## Indicators
|
|
164
|
+
|
|
165
|
+
| Name | Panel | Description |
|
|
166
|
+
|---|---|---|
|
|
167
|
+
| `"sma"` | Price overlay | Simple Moving Average (20) |
|
|
168
|
+
| `"ema"` | Price overlay | Exponential Moving Average (20) |
|
|
169
|
+
| `"bollinger"` | Price overlay | Bollinger Bands (20, 2σ) |
|
|
170
|
+
| `"vwap"` | Price overlay | Volume-Weighted Average Price |
|
|
171
|
+
| `"rsi"` | Sub-panel | Relative Strength Index (14) |
|
|
172
|
+
| `"macd"` | Sub-panel | MACD (12/26/9) |
|
|
173
|
+
| `"volume"` | Sub-panel | Volume bars |
|
|
174
|
+
|
|
175
|
+
## Themes
|
|
176
|
+
|
|
177
|
+
| Name | Background | Style |
|
|
178
|
+
|---|---|---|
|
|
179
|
+
| `"dark"` | `#1e1e2f` | Dark mode — green/red candles |
|
|
180
|
+
| `"light"` | `#ffffff` | Light mode — green/red candles |
|
|
181
|
+
| `"classic"` | `#f5f5dc` | Parchment — dark green/dark red candles, visible spines |
|
|
182
|
+
|
|
183
|
+
```python
|
|
184
|
+
tc.theme("light")
|
|
185
|
+
tc.chart("MSFT", "6mo", "candle")
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Terminal Modes
|
|
189
|
+
|
|
190
|
+
Control how much console output TradeChart produces.
|
|
191
|
+
|
|
192
|
+
| Mode | What prints | Best for |
|
|
193
|
+
|---|---|---|
|
|
194
|
+
| `"full"` | Every step, every log line, full detail | Debugging |
|
|
195
|
+
| `"on_done"` | Summary after completion | Normal use |
|
|
196
|
+
| `"none"` | Nothing at all — complete silence | Production / scripting |
|
|
197
|
+
|
|
198
|
+
## `tc.config()` — Batch Settings
|
|
199
|
+
|
|
200
|
+
```python
|
|
201
|
+
tc.config(
|
|
202
|
+
theme="light",
|
|
203
|
+
dpi=200,
|
|
204
|
+
overwrite=True,
|
|
205
|
+
fig_size=(16, 9),
|
|
206
|
+
cache_ttl=600,
|
|
207
|
+
)
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
| Key | Type | Default | Description |
|
|
211
|
+
|---|---|---|---|
|
|
212
|
+
| `terminal` | str | `"on_done"` | Logging mode |
|
|
213
|
+
| `theme` | str | `"dark"` | Colour theme |
|
|
214
|
+
| `watermark` | bool | `True` | TRADELY logo on/off |
|
|
215
|
+
| `overwrite` | bool | `False` | Allow overwriting existing files |
|
|
216
|
+
| `dpi` | int | `150` | Output resolution (50–600) |
|
|
217
|
+
| `fig_size` | tuple | `(14, 7)` | Figure dimensions in inches |
|
|
218
|
+
| `cache_ttl` | int | `300` | Data cache time-to-live in seconds |
|
|
219
|
+
|
|
220
|
+
## Data Providers
|
|
221
|
+
|
|
222
|
+
TradeChart tries providers in order and falls back automatically:
|
|
223
|
+
|
|
224
|
+
| Priority | Provider | Requires |
|
|
225
|
+
|---|---|---|
|
|
226
|
+
| 1 | yfinance | `pip install yfinance` (included) |
|
|
227
|
+
| 2 | TradingView | `pip install tvDatafeed` (optional) |
|
|
228
|
+
| 3 | Stooq | Nothing (free CSV endpoint) |
|
|
229
|
+
|
|
230
|
+
If yfinance returns data, TradingView and Stooq are never called. If yfinance fails, the next provider is tried, and so on.
|
|
231
|
+
|
|
232
|
+
## Installation
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
pip install TradeChart
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
With optional extras:
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
pip install TradeChart[all] # TradingView + mplfinance + xlsx export
|
|
242
|
+
pip install TradeChart[tradingview] # TradingView fallback provider
|
|
243
|
+
pip install TradeChart[mplfinance] # Enhanced candlestick rendering
|
|
244
|
+
pip install TradeChart[xlsx] # Excel export support
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## Notes
|
|
250
|
+
|
|
251
|
+
- **Caching**: Fetched data is cached in-memory for `cache_ttl` seconds (default 300). Call `tc.clear_cache()` to force a re-fetch.
|
|
252
|
+
|
|
253
|
+
- **File collisions**: By default, TradeChart appends `_1`, `_2`, etc. if the output file already exists. Set `tc.config(overwrite=True)` to overwrite instead.
|
|
254
|
+
|
|
255
|
+
- **Watermark**: The TRADELY logo is stamped in the bottom-left corner by default. Disable with `tc.watermark(False)` or `tc.config(watermark=False)`.
|
|
256
|
+
|
|
257
|
+
- **Thread safety**: The global settings singleton and engine initialisation are thread-safe. You can call `tc.chart()` from multiple threads.
|
|
258
|
+
|
|
259
|
+
- **Heikin-Ashi**: The `"heikin_ashi"` chart type converts standard OHLC data to Heikin-Ashi candles before rendering — the original data is not modified.
|
|
260
|
+
|
|
261
|
+
- **mplfinance**: If `mplfinance` is installed, candlestick charts use it for higher-quality rendering. Otherwise, a pure-matplotlib fallback is used automatically.
|
|
262
|
+
|
|
263
|
+
## Further Details
|
|
264
|
+
|
|
265
|
+
Check out [TradeChart by TRADELY](https://doc.tradely.dev)
|
|
266
|
+
|
|
267
|
+
PyPI Library available at: [PyPI TradeChart](https://pypi.org/project/TradeChart/)
|
|
268
|
+
|
|
269
|
+
Use the README there to set up the library.
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
# TradeChart — Library Edition v2.0.0
|
|
2
|
+
|
|
3
|
+
**Python → Financial Charts**
|
|
4
|
+
Generate production-quality candlestick, line, area, and OHLC charts from code.
|
|
5
|
+
|
|
6
|
+
## Quick Start
|
|
7
|
+
|
|
8
|
+
```python
|
|
9
|
+
import tradechart as tc
|
|
10
|
+
|
|
11
|
+
tc.terminal("full")
|
|
12
|
+
tc.chart("AAPL", "1mo", "candle", indicators=["sma", "bollinger"])
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## API Reference
|
|
16
|
+
|
|
17
|
+
| Command | Required | Default | Description |
|
|
18
|
+
|---|---|---|---|
|
|
19
|
+
| `tc.terminal(mode)` | No | `"on_done"` | Set logging verbosity |
|
|
20
|
+
| `tc.theme(name)` | No | `"dark"` | Set chart colour theme |
|
|
21
|
+
| `tc.watermark(enabled)` | No | `True` | Toggle the TRADELY logo watermark |
|
|
22
|
+
| `tc.config(**kwargs)` | No | — | Batch-set global options (see below) |
|
|
23
|
+
| `tc.chart(...)` | — | — | Fetch data and render a chart image |
|
|
24
|
+
| `tc.compare(...)` | — | — | Overlay multiple tickers on one chart |
|
|
25
|
+
| `tc.data(...)` | — | — | Fetch raw OHLCV data as a DataFrame |
|
|
26
|
+
| `tc.export(...)` | — | — | Export market data to CSV / JSON / XLSX |
|
|
27
|
+
| `tc.clear_cache()` | No | — | Flush the in-memory data cache |
|
|
28
|
+
|
|
29
|
+
## `tc.chart()` — Render a Chart
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
path = tc.chart(
|
|
33
|
+
"AAPL",
|
|
34
|
+
duration="3mo",
|
|
35
|
+
chart_type="candle",
|
|
36
|
+
indicators=["sma", "rsi", "macd"],
|
|
37
|
+
show_volume=True,
|
|
38
|
+
fmt="png",
|
|
39
|
+
output_location="./charts",
|
|
40
|
+
output_name="apple_q1.png",
|
|
41
|
+
)
|
|
42
|
+
print(f"Saved → {path}")
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
| Parameter | Required | Default | Description |
|
|
46
|
+
|---|---|---|---|
|
|
47
|
+
| `ticker` | Yes | — | Instrument symbol — `"AAPL"`, `"BTC-USD"`, `"EURUSD=X"` |
|
|
48
|
+
| `duration` | No | `"1mo"` | Time span (see Durations below) |
|
|
49
|
+
| `chart_type` | No | `"candle"` | `"candle"` `"line"` `"ohlc"` `"area"` `"heikin_ashi"` |
|
|
50
|
+
| `output_location` | No | cwd | Directory for the output file |
|
|
51
|
+
| `output_name` | No | auto | Filename — defaults to `{TICKER}_{duration}_{type}.{fmt}` |
|
|
52
|
+
| `fmt` | No | `"png"` | `"png"` `"jpg"` `"svg"` `"pdf"` `"webp"` |
|
|
53
|
+
| `indicators` | No | None | List of indicator names (see Indicators below) |
|
|
54
|
+
| `show_volume` | No | `True` | Show volume sub-panel |
|
|
55
|
+
|
|
56
|
+
## `tc.compare()` — Multi-Ticker Overlay
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
path = tc.compare(
|
|
60
|
+
["AAPL", "MSFT", "GOOG"],
|
|
61
|
+
duration="6mo",
|
|
62
|
+
normalise=True,
|
|
63
|
+
fmt="png",
|
|
64
|
+
)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
| Parameter | Required | Default | Description |
|
|
68
|
+
|---|---|---|---|
|
|
69
|
+
| `tickers` | Yes | — | 2–8 ticker symbols to compare |
|
|
70
|
+
| `duration` | No | `"1mo"` | Shared time span |
|
|
71
|
+
| `normalise` | No | `True` | Show percentage change from period start |
|
|
72
|
+
| `output_location` | No | cwd | Output directory |
|
|
73
|
+
| `output_name` | No | auto | Output filename |
|
|
74
|
+
| `fmt` | No | `"png"` | Output format |
|
|
75
|
+
|
|
76
|
+
## `tc.data()` — Raw Data
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
df = tc.data("TSLA", "3mo")
|
|
80
|
+
print(df.head())
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Returns a `pandas.DataFrame` with columns `Open`, `High`, `Low`, `Close`, `Volume` and a `DatetimeIndex`.
|
|
84
|
+
|
|
85
|
+
## `tc.export()` — Export Data
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
path = tc.export("AAPL", "1y", fmt="csv", output_location="./exports")
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
| Parameter | Required | Default | Description |
|
|
92
|
+
|---|---|---|---|
|
|
93
|
+
| `ticker` | Yes | — | Instrument symbol |
|
|
94
|
+
| `duration` | No | `"1mo"` | Time span |
|
|
95
|
+
| `fmt` | No | `"csv"` | `"csv"` `"json"` `"xlsx"` |
|
|
96
|
+
| `output_location` | No | cwd | Output directory |
|
|
97
|
+
| `output_name` | No | auto | Output filename |
|
|
98
|
+
|
|
99
|
+
## Durations
|
|
100
|
+
|
|
101
|
+
| Value | Period |
|
|
102
|
+
|---|---|
|
|
103
|
+
| `"1d"` | 1 day (5-min bars) |
|
|
104
|
+
| `"5d"` | 5 days (15-min bars) |
|
|
105
|
+
| `"1mo"` | 1 month (daily) |
|
|
106
|
+
| `"3mo"` | 3 months (daily) |
|
|
107
|
+
| `"6mo"` | 6 months (daily) |
|
|
108
|
+
| `"1y"` | 1 year (weekly) |
|
|
109
|
+
| `"2y"` | 2 years (weekly) |
|
|
110
|
+
| `"5y"` | 5 years (weekly) |
|
|
111
|
+
| `"10y"` | 10 years (monthly) |
|
|
112
|
+
| `"max"` | All available (monthly) |
|
|
113
|
+
|
|
114
|
+
## Indicators
|
|
115
|
+
|
|
116
|
+
| Name | Panel | Description |
|
|
117
|
+
|---|---|---|
|
|
118
|
+
| `"sma"` | Price overlay | Simple Moving Average (20) |
|
|
119
|
+
| `"ema"` | Price overlay | Exponential Moving Average (20) |
|
|
120
|
+
| `"bollinger"` | Price overlay | Bollinger Bands (20, 2σ) |
|
|
121
|
+
| `"vwap"` | Price overlay | Volume-Weighted Average Price |
|
|
122
|
+
| `"rsi"` | Sub-panel | Relative Strength Index (14) |
|
|
123
|
+
| `"macd"` | Sub-panel | MACD (12/26/9) |
|
|
124
|
+
| `"volume"` | Sub-panel | Volume bars |
|
|
125
|
+
|
|
126
|
+
## Themes
|
|
127
|
+
|
|
128
|
+
| Name | Background | Style |
|
|
129
|
+
|---|---|---|
|
|
130
|
+
| `"dark"` | `#1e1e2f` | Dark mode — green/red candles |
|
|
131
|
+
| `"light"` | `#ffffff` | Light mode — green/red candles |
|
|
132
|
+
| `"classic"` | `#f5f5dc` | Parchment — dark green/dark red candles, visible spines |
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
tc.theme("light")
|
|
136
|
+
tc.chart("MSFT", "6mo", "candle")
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Terminal Modes
|
|
140
|
+
|
|
141
|
+
Control how much console output TradeChart produces.
|
|
142
|
+
|
|
143
|
+
| Mode | What prints | Best for |
|
|
144
|
+
|---|---|---|
|
|
145
|
+
| `"full"` | Every step, every log line, full detail | Debugging |
|
|
146
|
+
| `"on_done"` | Summary after completion | Normal use |
|
|
147
|
+
| `"none"` | Nothing at all — complete silence | Production / scripting |
|
|
148
|
+
|
|
149
|
+
## `tc.config()` — Batch Settings
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
tc.config(
|
|
153
|
+
theme="light",
|
|
154
|
+
dpi=200,
|
|
155
|
+
overwrite=True,
|
|
156
|
+
fig_size=(16, 9),
|
|
157
|
+
cache_ttl=600,
|
|
158
|
+
)
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
| Key | Type | Default | Description |
|
|
162
|
+
|---|---|---|---|
|
|
163
|
+
| `terminal` | str | `"on_done"` | Logging mode |
|
|
164
|
+
| `theme` | str | `"dark"` | Colour theme |
|
|
165
|
+
| `watermark` | bool | `True` | TRADELY logo on/off |
|
|
166
|
+
| `overwrite` | bool | `False` | Allow overwriting existing files |
|
|
167
|
+
| `dpi` | int | `150` | Output resolution (50–600) |
|
|
168
|
+
| `fig_size` | tuple | `(14, 7)` | Figure dimensions in inches |
|
|
169
|
+
| `cache_ttl` | int | `300` | Data cache time-to-live in seconds |
|
|
170
|
+
|
|
171
|
+
## Data Providers
|
|
172
|
+
|
|
173
|
+
TradeChart tries providers in order and falls back automatically:
|
|
174
|
+
|
|
175
|
+
| Priority | Provider | Requires |
|
|
176
|
+
|---|---|---|
|
|
177
|
+
| 1 | yfinance | `pip install yfinance` (included) |
|
|
178
|
+
| 2 | TradingView | `pip install tvDatafeed` (optional) |
|
|
179
|
+
| 3 | Stooq | Nothing (free CSV endpoint) |
|
|
180
|
+
|
|
181
|
+
If yfinance returns data, TradingView and Stooq are never called. If yfinance fails, the next provider is tried, and so on.
|
|
182
|
+
|
|
183
|
+
## Installation
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
pip install TradeChart
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
With optional extras:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
pip install TradeChart[all] # TradingView + mplfinance + xlsx export
|
|
193
|
+
pip install TradeChart[tradingview] # TradingView fallback provider
|
|
194
|
+
pip install TradeChart[mplfinance] # Enhanced candlestick rendering
|
|
195
|
+
pip install TradeChart[xlsx] # Excel export support
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Notes
|
|
201
|
+
|
|
202
|
+
- **Caching**: Fetched data is cached in-memory for `cache_ttl` seconds (default 300). Call `tc.clear_cache()` to force a re-fetch.
|
|
203
|
+
|
|
204
|
+
- **File collisions**: By default, TradeChart appends `_1`, `_2`, etc. if the output file already exists. Set `tc.config(overwrite=True)` to overwrite instead.
|
|
205
|
+
|
|
206
|
+
- **Watermark**: The TRADELY logo is stamped in the bottom-left corner by default. Disable with `tc.watermark(False)` or `tc.config(watermark=False)`.
|
|
207
|
+
|
|
208
|
+
- **Thread safety**: The global settings singleton and engine initialisation are thread-safe. You can call `tc.chart()` from multiple threads.
|
|
209
|
+
|
|
210
|
+
- **Heikin-Ashi**: The `"heikin_ashi"` chart type converts standard OHLC data to Heikin-Ashi candles before rendering — the original data is not modified.
|
|
211
|
+
|
|
212
|
+
- **mplfinance**: If `mplfinance` is installed, candlestick charts use it for higher-quality rendering. Otherwise, a pure-matplotlib fallback is used automatically.
|
|
213
|
+
|
|
214
|
+
## Further Details
|
|
215
|
+
|
|
216
|
+
Check out [TradeChart by TRADELY](https://doc.tradely.dev)
|
|
217
|
+
|
|
218
|
+
PyPI Library available at: [PyPI TradeChart](https://pypi.org/project/TradeChart/)
|
|
219
|
+
|
|
220
|
+
Use the README there to set up the library.
|