seolpyo-mplchart 1.4.1.2__tar.gz → 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.

Potentially problematic release.


This version of seolpyo-mplchart might be problematic. Click here for more details.

Files changed (23) hide show
  1. seolpyo_mplchart-2.0.0/PKG-INFO +710 -0
  2. seolpyo_mplchart-2.0.0/README.md +683 -0
  3. {seolpyo_mplchart-1.4.1.2 → seolpyo_mplchart-2.0.0}/pyproject.toml +2 -2
  4. seolpyo_mplchart-2.0.0/seolpyo_mplchart/__init__.py +185 -0
  5. seolpyo_mplchart-2.0.0/seolpyo_mplchart/test.py +187 -0
  6. seolpyo_mplchart-2.0.0/seolpyo_mplchart/xl_to_dict.py +47 -0
  7. seolpyo_mplchart-2.0.0/seolpyo_mplchart.egg-info/PKG-INFO +710 -0
  8. {seolpyo_mplchart-1.4.1.2 → seolpyo_mplchart-2.0.0}/seolpyo_mplchart.egg-info/SOURCES.txt +1 -5
  9. seolpyo_mplchart-1.4.1.2/PKG-INFO +0 -57
  10. seolpyo_mplchart-1.4.1.2/README.md +0 -30
  11. seolpyo_mplchart-1.4.1.2/seolpyo_mplchart/__init__.py +0 -349
  12. seolpyo_mplchart-1.4.1.2/seolpyo_mplchart/_base.py +0 -117
  13. seolpyo_mplchart-1.4.1.2/seolpyo_mplchart/_cursor.py +0 -558
  14. seolpyo_mplchart-1.4.1.2/seolpyo_mplchart/_draw.py +0 -634
  15. seolpyo_mplchart-1.4.1.2/seolpyo_mplchart/_slider.py +0 -634
  16. seolpyo_mplchart-1.4.1.2/seolpyo_mplchart/test.py +0 -61
  17. seolpyo_mplchart-1.4.1.2/seolpyo_mplchart/utils.py +0 -56
  18. seolpyo_mplchart-1.4.1.2/seolpyo_mplchart.egg-info/PKG-INFO +0 -57
  19. {seolpyo_mplchart-1.4.1.2 → seolpyo_mplchart-2.0.0}/MANIFEST.in +0 -0
  20. {seolpyo_mplchart-1.4.1.2 → seolpyo_mplchart-2.0.0}/seolpyo_mplchart.egg-info/dependency_links.txt +0 -0
  21. {seolpyo_mplchart-1.4.1.2 → seolpyo_mplchart-2.0.0}/seolpyo_mplchart.egg-info/requires.txt +0 -0
  22. {seolpyo_mplchart-1.4.1.2 → seolpyo_mplchart-2.0.0}/seolpyo_mplchart.egg-info/top_level.txt +0 -0
  23. {seolpyo_mplchart-1.4.1.2 → seolpyo_mplchart-2.0.0}/setup.cfg +0 -0
@@ -0,0 +1,710 @@
1
+ Metadata-Version: 2.4
2
+ Name: seolpyo-mplchart
3
+ Version: 2.0.0
4
+ Summary: Fast candlestick chart using Python. Includes navigator, slider, navigation, and text information display functions
5
+ Author-email: white-seolpyo <white-seolpyo@naver.com>
6
+ License: MIT License
7
+ Project-URL: Homepage, https://white.seolpyo.com/
8
+ Project-URL: Documentation(English), https://white.seolpyo.com/entry/148/
9
+ Project-URL: Documentation(한글), https://white.seolpyo.com/entry/147/
10
+ Project-URL: repository, https://github.com/white-seolpyo/seolpyo-mplchart
11
+ Project-URL: Issues, https://github.com/white-seolpyo/seolpyo-mplchart/issues
12
+ Keywords: chart,차트,stock,주식,invest,투자,finance,파이낸스,candle,캔들,candlestick,캔들스틱,matplotlib,mplfinance,pyqtgraph,finplot,virtual currency,가상화폐,coin,코인,bitcoin,비트코인,ethereum,이더리움
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Development Status :: 5 - Production/Stable
15
+ Classifier: Framework :: Matplotlib
16
+ Classifier: Operating System :: Microsoft :: Windows
17
+ Classifier: Intended Audience :: Developers
18
+ Classifier: Programming Language :: Python
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3 :: Only
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Requires-Python: >=3.8
24
+ Description-Content-Type: text/markdown
25
+ Requires-Dist: matplotlib>=3.7.0
26
+ Requires-Dist: pandas>=2.0.0
27
+
28
+ # Donation
29
+ Bitcoin: 1MKCHW8smDZv5DFMiVkA5G3DeXcMn871ZX
30
+
31
+ Ethereum: 0x1c5fb8a5e0b1153cd4116c91736bd16fabf83520
32
+
33
+
34
+ # Document
35
+ [English Document](https://github.com/white-seolpyo/seolpyo-mplchart/blob/main/README.md)
36
+
37
+ [한글 설명서](https://white.seolpyo.com/entry/147/?from=pypi)
38
+
39
+
40
+ # This document was originally written in Korean and translated using a machine translation tool.
41
+
42
+
43
+ reference version
44
+ ----
45
+
46
+ 2.0.0
47
+
48
+ Package Introduction
49
+ ------
50
+
51
+ ![](https://github.com/white-seolpyo/seolpyo-mplchart/blob/main/images/candle.png?raw=true)![](https://github.com/white-seolpyo/seolpyo-mplchart/blob/main/images/40000.gif?raw=true)
52
+
53
+ Sample Charts with Over 40,000 Stock Price Data Points
54
+
55
+ seolpyo-mplchart is a Python package built on top of matplotlib.
56
+
57
+ While libraries like finplot and plotly are commonly used to draw candlestick charts in Python, I created this package because none of the existing tools fully met my needs.
58
+
59
+
60
+
61
+ **Key Features**
62
+
63
+ * Provides three types of Chart classes for flexible charting.
64
+ * Includes an overview slider (SliderChart) that highlights the visible range, allowing users to select or move the viewing window interactively.
65
+ * Integrates smoothly with various GUI frameworks, including tkinter, ensuring responsive performance.
66
+ * Displays stock price information as text (CursorChart, SliderChart). Simply hover your mouse over a candlestick or volume bar to view the corresponding data.
67
+ - Built-in support for toggling moving average lines on and off.
68
+
69
+ ![](https://github.com/white-seolpyo/seolpyo-mplchart/blob/main/images/ma%20on%20off.gif?raw=true)
70
+
71
+ You can check out a sample of drawing candlestick charts integrated with tkinter at the following link:
72
+
73
+ [View tkinter sample code](https://white.seolpyo.com//entry/214/)
74
+
75
+ ![](https://github.com/white-seolpyo/seolpyo-mplchart/blob/main/images/with%20tkinter.gif?raw=true)
76
+
77
+ ✅ Verified to work with 32-bit Python 3.11, pandas 2.0.0, and matplotlib 3.7.0.
78
+
79
+ Installation
80
+ -----
81
+
82
+ > pip install seolpyo-mplchart
83
+
84
+ Quick Start
85
+ -----
86
+
87
+ ### OnlyChart
88
+
89
+ It is a chart that simply renders without any interaction.
90
+
91
+ import seolpyo_mplchart as mc
92
+
93
+ chart = mc.OnlyChart()
94
+ df: pandas.DataFrame = {stock price data frame}
95
+ chart.set_data(df)
96
+ mc.show()
97
+
98
+
99
+ ![](https://github.com/white-seolpyo/seolpyo-mplchart/blob/main/images/chart%20only.png?raw=true)
100
+
101
+ ### CursorChart
102
+
103
+ This chart is an enhanced version of OnlyChart with mouse interaction capabilities.
104
+ It displays the date information corresponding to the mouse cursor position at the bottom of the chart, and price or volume data on the right side.
105
+ When the mouse cursor hovers over a candlestick or volume bar, the relevant information is shown as text.
106
+
107
+
108
+ import seolpyo_mplchart as mc
109
+
110
+ chart = mc.CursorChart()
111
+ df: pandas.DataFrame = {stock price data frame}
112
+ chart.set_data(df)
113
+ mc.show()
114
+
115
+
116
+ ![](https://github.com/white-seolpyo/seolpyo-mplchart/blob/main/images/chart%20cursor.png?raw=true)
117
+
118
+ ### SliderChart
119
+
120
+ This chart is an extended version of CursorChart with an added overview slider.
121
+ The slider allows users to select or move the viewing range, and users can also click and drag within the chart area to shift the visible region.
122
+
123
+
124
+ import seolpyo_mplchart as mc
125
+
126
+ chart = mc.SliderChart()
127
+ df: pandas.DataFrame = {stock price data frame}
128
+ chart.set_data(df)
129
+ mc.show()
130
+
131
+
132
+ ![](https://github.com/white-seolpyo/seolpyo-mplchart/blob/main/images/sample.gif?raw=true)
133
+
134
+ Chart Description
135
+ --------
136
+
137
+ ### Chart Class Variables
138
+
139
+ #### CONFIG
140
+
141
+ Chart Configuration File
142
+ If not provided, the predefined CONFIG\* settings will be used.
143
+
144
+ \* CONFIG: mc.DEFAULTCONFIG(OnlyChart, CursorChart) 또는 mc.SLIDERCONFIG(SliderChart)
145
+
146
+
147
+ #### wartermark
148
+
149
+ Watermark text displayed at the center of the chart.
150
+ If if not self.wartermark evaluates to true, the watermark will not be rendered.
151
+
152
+
153
+ #### candle\_on\_ma
154
+
155
+ If true, candlesticks are drawn above the moving average line.
156
+ If false, candlesticks are drawn below the moving average line, as shown in the following image.
157
+
158
+
159
+ ![](https://github.com/white-seolpyo/seolpyo-mplchart/blob/main/images/ma%20above%20candle.png?raw=true)
160
+
161
+ #### limit\_candle
162
+
163
+ If the number of candlesticks to be drawn on the screen is less than or equal to this value, full candlesticks are rendered.
164
+ If it exceeds the value, only wicks are drawn.
165
+
166
+
167
+ ![](https://github.com/white-seolpyo/seolpyo-mplchart/blob/main/images/wick.png?raw=true)
168
+
169
+ #### limit\_wick
170
+
171
+ If the number of candlesticks to be drawn on the screen is less than or equal to this value, only wicks are rendered.
172
+ If it exceeds the value, a line chart is drawn instead.
173
+
174
+
175
+ ![](https://github.com/white-seolpyo/seolpyo-mplchart/blob/main/images/line.png?raw=true)
176
+
177
+ #### limit\_volume
178
+
179
+ If the number of candlesticks drawn on the screen is less than or equal to self.limit_wick, the entire volume data is rendered.
180
+ If it exceeds that value, only a subset of volume data is drawn — specifically, the top limit_volume entries sorted in descending order of volume.
181
+ If you experience buffering when moving across a wide range, lowering this value may help improve performance.
182
+ This only applies while the chart is being moved in the Slider chart.
183
+
184
+ #### limit\_ma
185
+
186
+ If the number of candlesticks drawn on the screen is less than or equal to this value, the moving average line is rendered.
187
+ If you experience buffering when navigating across a wide range, lowering this value may help improve performance.
188
+ This only applies while the chart is being moved in the Slider chart.
189
+
190
+ #### key\_date, key\_open, key\_high, key\_low, key\_close, key\_volume
191
+
192
+ Keys for each column used in the provided data
193
+ If if not self.key_volume evaluates to true at the time of executing Chart.set_data(df), the volume chart will not be rendered.
194
+
195
+
196
+ import seolpyo_mplchart as mc
197
+
198
+ df: pandas.DataFrame = {stock price data frame}
199
+
200
+ c = mc.SliderChart()
201
+ c.key_date= '시간'
202
+ c.key_open = '시가'
203
+ c.key_high = '고가'
204
+ c.key_low = '저가'
205
+ c.key_close = '종가'
206
+ # c.key_volume = '거래량'
207
+ c.key_volume = None
208
+ c.set_data(df)
209
+
210
+ mc.show() # same as matplotlib.pyplot.show()
211
+
212
+
213
+ ### OR ###
214
+
215
+
216
+ import json
217
+
218
+ import seolpyo_mplchart as mc
219
+ import pandas as pd
220
+
221
+ file = {stock price data path}
222
+ with open(file, 'r', encoding='utf-8') as txt:
223
+ data = json.load(txt)
224
+ df = pd.DataFrame(data)
225
+
226
+ class Chart(mc.SliderChart):
227
+ key_date = '시간'
228
+ key_open, key_high, key_low, key_close = ('시가', '고가', '저가', '종가')
229
+ # key_volume = '거래량'
230
+ key_volume = None
231
+
232
+ c = Chart()'
233
+ c.set_data(df)
234
+
235
+ mc.show() # same as matplotlib.pyplot.show()
236
+
237
+
238
+
239
+ ![](https://github.com/white-seolpyo/seolpyo-mplchart/blob/main/images/en%20no%20vol%20(2).png?raw=true)
240
+
241
+ #### fraction
242
+
243
+ If true, decimal values are displayed as fractions.
244
+
245
+ ![](https://github.com/white-seolpyo/seolpyo-mplchart/blob/main/images/fraction.png?raw=true)
246
+
247
+ #### slider\_top
248
+
249
+ If true, the slider is positioned above the chart.
250
+
251
+ ![](https://github.com/white-seolpyo/seolpyo-mplchart/blob/main/images/slider%20bottom.png?raw=true)
252
+
253
+ #### min\_distance
254
+
255
+ Minimum number of candlesticks required when selecting a slider range
256
+ If the selected range contains fewer candlesticks than this value, the previous range will be retained.
257
+
258
+
259
+ ![](https://github.com/white-seolpyo/seolpyo-mplchart/blob/main/images/min%20distance.gif?raw=true)
260
+
261
+ #### in\_chart
262
+
263
+ Determines whether the mouse cursor is located within the price chart or volume chart area.
264
+
265
+
266
+ #### in\_slider
267
+
268
+ Determines whether the mouse cursor is located within the slider area.
269
+
270
+
271
+ #### in\_price\_chart
272
+
273
+ Determines whether the mouse cursor is located within the price chart area.
274
+
275
+
276
+ #### in\_volume\_chart
277
+
278
+ Determines whether the mouse cursor is located within the volume chart area.
279
+
280
+
281
+ ### Chart class method
282
+ #### Chart.\_\_init\_\_(config=DEFAULTCONFIG or SLIDERCONFIG)
283
+
284
+ Creates a chart object.
285
+
286
+ #### Chart.set\_data(df)
287
+
288
+ Passes stock price data to the chart object.
289
+ The chart object generates chart data based on the received input.
290
+ When retrieving data from a DataFrame, the predefined keys — Chart.key\_date, Chart.key\_open, Chart.key\_high, Chart.key\_low, Chart.key\_close, and Chart.key\_volume — are used.
291
+ Therefore, these keys should be properly set before calling set\_data.
292
+
293
+
294
+ #### Chart.refresh()
295
+
296
+ Refreshes the chart.
297
+ During the refresh, any changes made to self.CONFIG are applied.
298
+
299
+
300
+ #### Chart.add\_artists()
301
+
302
+ Function that adds the Artists used in the chart. Called during initialization (init).
303
+
304
+
305
+ #### Chart.draw\_artists()
306
+
307
+ Function that renders the Artists on the chart.
308
+ Called when the on_draw event is triggered.
309
+
310
+
311
+ #### Chart.set\_artists()
312
+
313
+ Function that applies the settings of chart Artists.
314
+ Called during refresh.
315
+
316
+
317
+ #### Chart.set\_collections()
318
+
319
+ Function that applies the settings of candlestick and volume chart Artists.
320
+ Called during refresh or when the display area changes.
321
+
322
+
323
+ #### Chart.add\_candle\_color\_column(), Chart.add\_volume\_color\_column()
324
+
325
+ This method determines the colors of candlesticks and volume bars drawn on the chart.
326
+ It adds the following columns to self.df:
327
+ - ['facecolor', 'edgecolor'] for candlesticks
328
+ - ['facecolor_volume', 'edgecolor_volume'] for volume bars
329
+ By modifying the values in these columns, you can customize the colors as desired.
330
+
331
+
332
+ ##### Candlestick Colors
333
+ - Open < Close, Previous Close < Close
334
+ → self.CONFIG.CANDLE.FACECOLOR.bull_rise, self.CONFIG.CANDLE.EDGECOLOR.bull_rise
335
+ - Open < Close, Previous Close > Close
336
+ → self.CONFIG.CANDLE.FACECOLOR.bull_fall, self.CONFIG.CANDLE.EDGECOLOR.bull_fall
337
+ - Close < Open, Close < Previous Close
338
+ → self.CONFIG.CANDLE.FACECOLOR.bear_fall, self.CONFIG.CANDLE.EDGECOLOR.bear_fall
339
+ - Close < Open, Close > Previous Close
340
+ → self.CONFIG.CANDLE.FACECOLOR.bear_rise, self.CONFIG.CANDLE.EDGECOLOR.bear_rise
341
+ - Open == Close
342
+ → self.CONFIG.CANDLE.EDGECOLOR.doji
343
+
344
+
345
+
346
+
347
+ ##### Volume Bar Colors
348
+ - Previous Close < Current Close
349
+ → self.CONFIG.VOLUME.FACECOLOR.rise, self.CONFIG.VOLUME.EDGECOLOR.rise
350
+ - Previous Close > Current Close
351
+ → self.CONFIG.VOLUME.FACECOLOR.fall, self.CONFIG.VOLUME.EDGECOLOR.fall
352
+ - Previous Close == Current Close
353
+ → self.CONFIG.VOLUME.FACECOLOR.doji, self.CONFIG.VOLUME.EDGECOLOR.doji
354
+
355
+
356
+
357
+
358
+ #### Chart.get\_cnadle\_segment(x, left, right, top, bottom, is\_up, high, low)
359
+
360
+ This method is provided to modify the appearance of candlesticks drawn on the chart.
361
+
362
+
363
+ import pandas as pd
364
+ import seolpyo_mplchart as mc
365
+
366
+ class Chart(mc.SliderChart):
367
+ def __init__(self, *args, **kwargs):
368
+ super().__init__(*args, **kwargs)
369
+ self.collection_candle.set_linewidth(1.5)
370
+ return
371
+
372
+ def get_candle_segment(self, *, x, left, right, top, bottom, is_up, high, low):
373
+ if is_up:
374
+ return (
375
+ (x, high),
376
+ (x, top), (right, top), (x, top),
377
+ (x, bottom), (left, bottom),
378
+ (x, bottom), (x, low), (x, high)
379
+ )
380
+ else:
381
+ return (
382
+ (x, high),
383
+ (x, bottom), (right, bottom), (x, bottom),
384
+ (x, top), (left, top), (x, top),
385
+ (x, low), (x, high)
386
+ )
387
+
388
+
389
+ C = Chart()
390
+
391
+ data = {stock price data}
392
+ df = pd.DataFrame(data)
393
+
394
+ C.set_data(df)
395
+
396
+ mc.show()
397
+
398
+ ![](https://github.com/white-seolpyo/seolpyo-mplchart/blob/main/images/en%20bar%20chart.png?raw=true)
399
+
400
+ ### Chart.get\_info\_kwargs(is\_price, \*\*kwargs)
401
+
402
+ You can modify or add the data displayed in the text box using the get_info_kwargs method.
403
+ The **kwargs parameter receives predefined keyword arguments.
404
+
405
+ If you'd like, I can help format this as a docstring or comment for your code. For example:
406
+ Allows customization of the data shown in the text box.
407
+ Predefined keyword arguments are passed via **kwargs.
408
+
409
+
410
+ import pandas as pd
411
+ import seolpyo_mplchart as mc
412
+
413
+
414
+ class Chart(mc.SliderChart):
415
+ format_candleinfo = mc.format_candleinfo_ko + '\nCustom info: {ci}'
416
+
417
+ def get_info_kwargs(self, is_price, **kwargs):
418
+ if is_price:
419
+ kwargs['ci'] = 'You can add Custom text Info or Change text info.'
420
+ kwargs['close'] = 'You can Change close price info.'
421
+ return kwargs
422
+
423
+ C = Chart()
424
+ data = {stock price data}
425
+ df = pd.DataFrame(data)
426
+
427
+ C.set_data(df)
428
+
429
+ mc.show()
430
+
431
+ #### Chart.on\_draw(e)
432
+
433
+ Method called when the draw event is triggered.
434
+ Only invoked in CursorChart and SliderChart.
435
+
436
+
437
+ #### Chart.on\_resize(e)
438
+
439
+ Method called when the resize event is triggered.
440
+ Only invoked in SliderChart.
441
+
442
+
443
+ #### Chart.on\_pick(e)
444
+
445
+ Method called when the pick event is triggered.
446
+
447
+
448
+ #### Chart.on\_move(e)
449
+
450
+ Method called when a mouse movement event occurs.
451
+ Only invoked in CursorChart and SliderChart.
452
+
453
+
454
+ #### Chart.on\_click(e)
455
+
456
+ Method called when a mouse click event occurs.
457
+
458
+ Only invoked in SliderChart.
459
+
460
+ #### Chart.on\_release(e)
461
+
462
+ Method called when a mouse release event occurs.
463
+
464
+ Only invoked in SliderChart.
465
+
466
+ ### CONFIG
467
+
468
+ A configuration that includes setting class objects such as FIGURE, AX, FORMAT, UNIT, CURSOR, CANDLE, VOLUME, MA, and SLIDER.
469
+
470
+
471
+ ### DEFAULTCONFIG
472
+
473
+ CONFIG applied to OnlyChart and CursorChart.
474
+
475
+
476
+ ### DEFAULTCONFIG\_EN
477
+
478
+ CONFIG applied to OnlyChart and CursorChart, with the price unit set to $, the volume unit set to Vol, and the formatting based on English conventions.
479
+
480
+
481
+ ### SLIDERCONFIG
482
+
483
+ CONFIG applied to SliderChart.
484
+
485
+
486
+ ### SLIDERCONFIG\_EN
487
+
488
+ CONFIG applied to SliderChart, with the price unit set to $, the volume unit set to Vol, and the formatting based on English conventions.
489
+
490
+
491
+ # seolpyo_mplchart/_config/slider/config.py
492
+
493
+ from .. import config
494
+ from .figure import FIGURE, SliderFigureData
495
+ from .nav import NAVIGATOR
496
+
497
+
498
+ class SliderData:
499
+ def __init__(self):
500
+ self.NAVIGATOR = NAVIGATOR
501
+
502
+ SLIDER = SliderData()
503
+
504
+ class SliderConfigData(config.ConfigData):
505
+ FIGURE: SliderFigureData
506
+ SLIDER: SliderData
507
+
508
+
509
+ SLIDERCONFIG: SliderConfigData = config.DEFAULTCONFIG
510
+ SLIDERCONFIG.FIGURE = FIGURE
511
+ SLIDERCONFIG.SLIDER = SLIDER
512
+
513
+ SLIDERCONFIG_EN: SliderConfigData = config.DEFAULTCONFIG_EN
514
+ SLIDERCONFIG_EN.FIGURE = FIGURE
515
+ SLIDERCONFIG_EN.SLIDER = SLIDER
516
+
517
+
518
+
519
+ # seolpyo_mplchart/_config/config.py
520
+
521
+ from . import figure, ax, candle, volume, ma, unit, cursor, format
522
+
523
+
524
+ class ConfigData:
525
+ def __init__(self):
526
+ self.FIGURE = figure.FIGURE
527
+ self.UNIT = unit.UNIT
528
+ self.AX = ax.AX
529
+ self.CANDLE = candle.CANDLE
530
+ self.VOLUME = volume.VOLUME
531
+ self.MA = ma.MA
532
+ self.CURSOR = cursor.CURSOR
533
+ self.FORMAT = format.FORMAT
534
+
535
+ DEFAULTCONFIG = ConfigData()
536
+
537
+ DEFAULTCONFIG_EN = ConfigData()
538
+ DEFAULTCONFIG_EN.UNIT = unit.UNIT_EN
539
+ DEFAULTCONFIG_EN.MA = ma.MA_EN
540
+ DEFAULTCONFIG_EN.FORMAT = format.FORMAT_EN
541
+
542
+
543
+
544
+ # Others
545
+
546
+ ---
547
+
548
+ # Required data
549
+ -------
550
+
551
+ A chart object must be provided with a DataFrame that contains the following columns:
552
+ [timestamp, open, high, low, close, volume]
553
+
554
+
555
+ ## How to Change Language and Text Format
556
+ The default language is Korean.
557
+ If needed, you can change the units for price and volume, and customize the text format to match your preferred style.
558
+
559
+
560
+ ### How to Change Display Units
561
+
562
+ ![](https://github.com/white-seolpyo/seolpyo-mplchart/blob/main/images/en%20no%20vol%20(2).png?raw=true)
563
+
564
+ The price and volume units, as well as the number of decimal places for price and volume, are managed in CONFIG.UNIT.
565
+
566
+ from .utils import convert_unit, convert_unit_en
567
+ # seolpyo_mplchart._config.unit.py
568
+
569
+ class UnitData:
570
+ def __init__(self):
571
+ self.price = '원'
572
+ self.volume = '주'
573
+ self.digit = 0
574
+ self.digit_volume = 0
575
+ self.func = convert_unit
576
+
577
+ UNIT = UnitData()
578
+
579
+ UNIT_EN = UnitData()
580
+ UNIT_EN.price = ' $'
581
+ UNIT_EN.volume = ' Vol'
582
+ UNIT_EN.digit = 2
583
+ UNIT_EN.func = convert_unit_en
584
+
585
+
586
+
587
+ ### How to Change the Information Text Format
588
+
589
+ ![](https://github.com/white-seolpyo/seolpyo-mplchart/blob/main/images/en%20no%20vol%20(2).png?raw=true)![](https://github.com/white-seolpyo/seolpyo-mplchart/blob/main/images/kor%20vol.png?raw=true)
590
+
591
+ You can customize the name of the price moving average line and the text displayed in the information box.
592
+ Text formatting is managed through CONFIG.FORMAT.
593
+ Additional kwargs for customizing the text can be passed via the chart’s get_info_kwargs method.
594
+
595
+
596
+ # seolpyo_mplchart/_config/format.py
597
+
598
+ format_candleinfo_ko = """\
599
+ {dt}
600
+
601
+ 종가:  {close}
602
+ 등락률: {rate}
603
+ 대비:  {compare}
604
+ 시가:  {open}({rate_open})
605
+ 고가:  {high}({rate_high})
606
+ 저가:  {low}({rate_low})
607
+ 거래량: {volume}({rate_volume})\
608
+ """
609
+ format_volumeinfo_ko = """\
610
+ {dt}
611
+
612
+ 거래량:    {volume}
613
+ 거래량증가율: {rate_volume}
614
+ 대비:     {compare}\
615
+ """
616
+
617
+ class FormatData:
618
+ def __init__(self):
619
+ self.candle = format_candleinfo_ko
620
+ self.volume = format_volumeinfo_ko
621
+
622
+ FORMAT = FormatData()
623
+
624
+ format_candleinfo_en = """\
625
+ {dt}
626
+
627
+ close: {close}
628
+ rate: {rate}
629
+ compare: {compare}
630
+ open: {open}({rate_open})
631
+ high: {high}({rate_high})
632
+ low: {low}({rate_low})
633
+ volume: {volume}({rate_volume})\
634
+ """
635
+ format_volumeinfo_en = """\
636
+ {dt}
637
+
638
+ volume: {volume}
639
+ volume rate: {rate_volume}
640
+ compare: {compare}\
641
+ """
642
+
643
+ FORMAT_EN = FormatData()
644
+ FORMAT_EN.candle = format_candleinfo_en
645
+ FORMAT_EN.volume = format_volumeinfo_en
646
+
647
+
648
+
649
+ How to Change Chart Style
650
+ -----------
651
+
652
+ ![](https://github.com/white-seolpyo/seolpyo-mplchart/blob/main/images/theme%20light.png?raw=true)![](https://github.com/white-seolpyo/seolpyo-mplchart/blob/main/images/theme%20dark.png?raw=true)
653
+
654
+ Since I prefer a white background, the default chart style is set to light mode.
655
+ If you want to change the chart style, simply modify the color values defined in CONFIG.
656
+ A function named set_theme has been created to switch between light and dark themes.
657
+ You can either use this function directly, or check which values it modifies and adjust them to suit your preferences.
658
+
659
+
660
+ import json
661
+
662
+ import seolpyo_mplchart as mc
663
+ import pandas as pd
664
+
665
+
666
+ class Chart(mc.SliderChart):
667
+ def __init__(self, config, *args, **kwargs):
668
+ config = mc.set_theme(config, theme='dark')
669
+
670
+
671
+ file = {stock price data path}
672
+ with open(file, 'r', encoding='utf-8') as txt:
673
+ data = json.load(txt)
674
+ df = pd.DataFrame(data)
675
+
676
+ c = Chart()
677
+ c.set_data(df)
678
+
679
+ mc.show()
680
+
681
+
682
+ How to Change Chart Aspect Ratio
683
+ --------
684
+
685
+ ![](https://github.com/white-seolpyo/seolpyo-mplchart/blob/main/images/ratio.png?raw=true)
686
+
687
+ You can adjust the proportions of each chart area using the values of
688
+ ratio_ax_slider, ratio_ax_legend, ratio_ax_price, ratio_ax_volume, and ratio_ax_none.
689
+ Note: ratio_ax_none is only used when the value of slider_top is set to False.
690
+
691
+
692
+ # seolpyo_mplchart/_config/slider/figure.py
693
+
694
+
695
+ class RatioData:
696
+ def __init__(self):
697
+ self.legend = 2
698
+ self.price = 18
699
+ self.volume = 5
700
+ self.slider = 3
701
+ self.none = 2
702
+
703
+ RATIO = RatioData()
704
+
705
+ class SliderFigureData(figure.FigureData):
706
+ def __init__(self):
707
+ super().__init__()
708
+ self.RATIO: RatioData = RATIO
709
+
710
+ FIGURE = SliderFigureData()