seolpyo-mplchart 0.1.3.1__py3-none-any.whl → 2.0.0.3__py3-none-any.whl
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.
- seolpyo_mplchart/__init__.py +164 -99
- seolpyo_mplchart/_base.py +117 -0
- seolpyo_mplchart/_chart/__init__.py +137 -0
- seolpyo_mplchart/_chart/_base.py +217 -0
- seolpyo_mplchart/_chart/_cursor/__init__.py +2 -0
- seolpyo_mplchart/_chart/_cursor/_artist.py +217 -0
- seolpyo_mplchart/_chart/_cursor/_cursor.py +165 -0
- seolpyo_mplchart/_chart/_cursor/_info.py +187 -0
- seolpyo_mplchart/_chart/_draw/__init__.py +2 -0
- seolpyo_mplchart/_chart/_draw/_artist.py +50 -0
- seolpyo_mplchart/_chart/_draw/_data.py +314 -0
- seolpyo_mplchart/_chart/_draw/_draw.py +103 -0
- seolpyo_mplchart/_chart/_draw/_lim.py +265 -0
- seolpyo_mplchart/_chart/_slider/__init__.py +1 -0
- seolpyo_mplchart/_chart/_slider/_base.py +268 -0
- seolpyo_mplchart/_chart/_slider/_data.py +105 -0
- seolpyo_mplchart/_chart/_slider/_mouse.py +176 -0
- seolpyo_mplchart/_chart/_slider/_nav.py +204 -0
- seolpyo_mplchart/_chart/test.py +121 -0
- seolpyo_mplchart/_config/__init__.py +3 -0
- seolpyo_mplchart/_config/ax.py +28 -0
- seolpyo_mplchart/_config/candle.py +30 -0
- seolpyo_mplchart/_config/config.py +21 -0
- seolpyo_mplchart/_config/cursor.py +49 -0
- seolpyo_mplchart/_config/figure.py +41 -0
- seolpyo_mplchart/_config/format.py +51 -0
- seolpyo_mplchart/_config/ma.py +15 -0
- seolpyo_mplchart/_config/slider/__init__.py +2 -0
- seolpyo_mplchart/_config/slider/config.py +24 -0
- seolpyo_mplchart/_config/slider/figure.py +20 -0
- seolpyo_mplchart/_config/slider/nav.py +9 -0
- seolpyo_mplchart/_config/unit.py +19 -0
- seolpyo_mplchart/_config/utils.py +67 -0
- seolpyo_mplchart/_config/volume.py +26 -0
- seolpyo_mplchart/_cursor.py +559 -0
- seolpyo_mplchart/_draw.py +634 -0
- seolpyo_mplchart/_slider.py +634 -0
- seolpyo_mplchart/base.py +70 -67
- seolpyo_mplchart/cursor.py +308 -271
- seolpyo_mplchart/draw.py +449 -237
- seolpyo_mplchart/slider.py +451 -396
- seolpyo_mplchart/test.py +173 -24
- seolpyo_mplchart/utils.py +15 -4
- seolpyo_mplchart/xl_to_dict.py +47 -0
- seolpyo_mplchart-2.0.0.3.dist-info/METADATA +710 -0
- seolpyo_mplchart-2.0.0.3.dist-info/RECORD +50 -0
- {seolpyo_mplchart-0.1.3.1.dist-info → seolpyo_mplchart-2.0.0.3.dist-info}/WHEEL +1 -1
- seolpyo_mplchart-0.1.3.1.dist-info/METADATA +0 -49
- seolpyo_mplchart-0.1.3.1.dist-info/RECORD +0 -13
- {seolpyo_mplchart-0.1.3.1.dist-info → seolpyo_mplchart-2.0.0.3.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
format_candleinfo_ko = """\
|
|
4
|
+
{dt}
|
|
5
|
+
|
|
6
|
+
종가: {close}
|
|
7
|
+
등락률: {rate}
|
|
8
|
+
대비: {compare}
|
|
9
|
+
시가: {open}({rate_open})
|
|
10
|
+
고가: {high}({rate_high})
|
|
11
|
+
저가: {low}({rate_low})
|
|
12
|
+
거래량: {volume}({rate_volume})\
|
|
13
|
+
"""
|
|
14
|
+
format_volumeinfo_ko = """\
|
|
15
|
+
{dt}
|
|
16
|
+
|
|
17
|
+
거래량: {volume}
|
|
18
|
+
거래량증가율: {rate_volume}
|
|
19
|
+
대비: {compare}\
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
class FormatData:
|
|
23
|
+
def __init__(self):
|
|
24
|
+
self.candle = format_candleinfo_ko
|
|
25
|
+
self.volume = format_volumeinfo_ko
|
|
26
|
+
|
|
27
|
+
FORMAT = FormatData()
|
|
28
|
+
|
|
29
|
+
format_candleinfo_en = """\
|
|
30
|
+
{dt}
|
|
31
|
+
|
|
32
|
+
close: {close}
|
|
33
|
+
rate: {rate}
|
|
34
|
+
compare: {compare}
|
|
35
|
+
open: {open}({rate_open})
|
|
36
|
+
high: {high}({rate_high})
|
|
37
|
+
low: {low}({rate_low})
|
|
38
|
+
volume: {volume}({rate_volume})\
|
|
39
|
+
"""
|
|
40
|
+
format_volumeinfo_en = """\
|
|
41
|
+
{dt}
|
|
42
|
+
|
|
43
|
+
volume: {volume}
|
|
44
|
+
volume rate: {rate_volume}
|
|
45
|
+
compare: {compare}\
|
|
46
|
+
"""
|
|
47
|
+
|
|
48
|
+
FORMAT_EN = FormatData()
|
|
49
|
+
FORMAT_EN.candle = format_candleinfo_en
|
|
50
|
+
FORMAT_EN.volume = format_volumeinfo_en
|
|
51
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
class MaData:
|
|
4
|
+
"https://matplotlib.org/stable/gallery/color/named_colors.html"
|
|
5
|
+
def __init__(self):
|
|
6
|
+
self.color_default: str|tuple[float, float, float, float] = 'k'
|
|
7
|
+
self.format = '{}일선'
|
|
8
|
+
self.color_list: list[str|tuple[float, float, float, float]] = ['#8B00FF', '#008000', '#A0522D', '#008B8B', '#FF0080']
|
|
9
|
+
self.ma_list = (5, 20, 60, 120, 240)
|
|
10
|
+
|
|
11
|
+
MA = MaData()
|
|
12
|
+
|
|
13
|
+
MA_EN = MaData()
|
|
14
|
+
MA_EN.format = 'ma{}'
|
|
15
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from .. import config
|
|
2
|
+
from .figure import FIGURE, SliderFigureData
|
|
3
|
+
from .nav import NAVIGATOR
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class SliderData:
|
|
7
|
+
def __init__(self):
|
|
8
|
+
self.NAVIGATOR = NAVIGATOR
|
|
9
|
+
|
|
10
|
+
SLIDER = SliderData()
|
|
11
|
+
|
|
12
|
+
class SliderConfigData(config.ConfigData):
|
|
13
|
+
FIGURE: SliderFigureData
|
|
14
|
+
SLIDER: SliderData
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
SLIDERCONFIG: SliderConfigData = config.DEFAULTCONFIG
|
|
18
|
+
SLIDERCONFIG.FIGURE = FIGURE
|
|
19
|
+
SLIDERCONFIG.SLIDER = SLIDER
|
|
20
|
+
|
|
21
|
+
SLIDERCONFIG_EN: SliderConfigData = config.DEFAULTCONFIG_EN
|
|
22
|
+
SLIDERCONFIG_EN.FIGURE = FIGURE
|
|
23
|
+
SLIDERCONFIG_EN.SLIDER = SLIDER
|
|
24
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from .. import figure
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class RatioData:
|
|
5
|
+
def __init__(self):
|
|
6
|
+
self.legend = 2
|
|
7
|
+
self.price = 18
|
|
8
|
+
self.volume = 5
|
|
9
|
+
self.slider = 3
|
|
10
|
+
self.none = 2
|
|
11
|
+
|
|
12
|
+
RATIO = RatioData()
|
|
13
|
+
|
|
14
|
+
class SliderFigureData(figure.FigureData):
|
|
15
|
+
def __init__(self):
|
|
16
|
+
super().__init__()
|
|
17
|
+
self.RATIO: RatioData = RATIO
|
|
18
|
+
|
|
19
|
+
FIGURE = SliderFigureData()
|
|
20
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from .utils import convert_unit, convert_unit_en
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class UnitData:
|
|
5
|
+
def __init__(self):
|
|
6
|
+
self.price = '원'
|
|
7
|
+
self.volume = '주'
|
|
8
|
+
self.digit = 0
|
|
9
|
+
self.digit_volume = 0
|
|
10
|
+
self.func = convert_unit
|
|
11
|
+
|
|
12
|
+
UNIT = UnitData()
|
|
13
|
+
|
|
14
|
+
UNIT_EN = UnitData()
|
|
15
|
+
UNIT_EN.price = ' $'
|
|
16
|
+
UNIT_EN.volume = ' Vol'
|
|
17
|
+
UNIT_EN.digit = 2
|
|
18
|
+
UNIT_EN.func = convert_unit_en
|
|
19
|
+
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
def convert_num(num):
|
|
4
|
+
if isinstance(num, float) and num % 1:
|
|
5
|
+
return num
|
|
6
|
+
return int(num)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def float_to_str(num: float, *, digit=0, plus=False):
|
|
10
|
+
if 0 < digit:
|
|
11
|
+
num.__round__(digit)
|
|
12
|
+
text = f'{num:+,.{digit}f}' if plus else f'{num:,.{digit}f}'
|
|
13
|
+
else:
|
|
14
|
+
num = round(num, digit).__int__()
|
|
15
|
+
text = f'{num:+,}' if plus else f'{num:,}'
|
|
16
|
+
return text
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
unit_ko = {
|
|
20
|
+
'경': 10_000_000_000_000_000,
|
|
21
|
+
'조': 1_000_000_000_000,
|
|
22
|
+
'억': 100_000_000,
|
|
23
|
+
'만': 10_000,
|
|
24
|
+
}
|
|
25
|
+
def convert_unit(value, *, digit=0, word='원', unit_data: dict[str, int]=None):
|
|
26
|
+
if not unit_data:
|
|
27
|
+
unit_data = unit_ko
|
|
28
|
+
# print('ko')
|
|
29
|
+
# print(f'{value=:,}')
|
|
30
|
+
v = abs(value)
|
|
31
|
+
for unit, n in unit_data.items():
|
|
32
|
+
if n <= v:
|
|
33
|
+
# print(f'{n=:,}')
|
|
34
|
+
# print(f'{unit=}')
|
|
35
|
+
num = value / n
|
|
36
|
+
if word.startswith(' '):
|
|
37
|
+
return f'{float_to_str(num, digit=digit)}{unit}{word}'
|
|
38
|
+
return f'{float_to_str(num, digit=digit)}{unit} {word}'
|
|
39
|
+
|
|
40
|
+
if not value % 1:
|
|
41
|
+
value = int(value)
|
|
42
|
+
text = f'{float_to_str(value, digit=digit)}{word}'
|
|
43
|
+
# print(f'{text=}')
|
|
44
|
+
return text
|
|
45
|
+
|
|
46
|
+
unit_en = {
|
|
47
|
+
'Qd': 1_000_000_000_000_000,
|
|
48
|
+
'T': 1_000_000_000_000,
|
|
49
|
+
'B': 1_000_000_000,
|
|
50
|
+
'M': 1_000_000,
|
|
51
|
+
'K': 1_000,
|
|
52
|
+
}
|
|
53
|
+
def convert_unit_en(value, *, digit=0, word='$', unit_data: dict[str, int]=None):
|
|
54
|
+
if not unit_data:
|
|
55
|
+
unit_data = unit_en
|
|
56
|
+
# print('en')
|
|
57
|
+
# print(f'{value=:,}')
|
|
58
|
+
return convert_unit(value, digit=digit, word=word, unit_data=unit_data)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
if __name__ == '__main__':
|
|
62
|
+
a = 456.123
|
|
63
|
+
print(float_to_str(a))
|
|
64
|
+
print(float_to_str(a, 2))
|
|
65
|
+
print(float_to_str(a, 6))
|
|
66
|
+
|
|
67
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
class VolumeFaceColorData:
|
|
4
|
+
def __init__(self):
|
|
5
|
+
self.rise: str|tuple[float, float, float, float] = '#F27663'
|
|
6
|
+
self.fall: str|tuple[float, float, float, float] = '#70B5F2'
|
|
7
|
+
self.doji: str|tuple[float, float, float, float] = '#BEBEBE'
|
|
8
|
+
|
|
9
|
+
VOLUMEFACECOLOR = VolumeFaceColorData()
|
|
10
|
+
|
|
11
|
+
class VolumeEdgeColorData:
|
|
12
|
+
def __init__(self):
|
|
13
|
+
self.rise: str|tuple[float, float, float, float] = '#F27663'
|
|
14
|
+
self.fall: str|tuple[float, float, float, float] = '#70B5F2'
|
|
15
|
+
self.doji: str|tuple[float, float, float, float] = '#BEBEBE'
|
|
16
|
+
|
|
17
|
+
VOLUMEEDGECOLOR = VolumeEdgeColorData()
|
|
18
|
+
|
|
19
|
+
class VolumeData:
|
|
20
|
+
def __init__(self):
|
|
21
|
+
self.half_width = 0.36
|
|
22
|
+
self.FACECOLOR = VOLUMEFACECOLOR
|
|
23
|
+
self.EDGECOLOR = VOLUMEEDGECOLOR
|
|
24
|
+
|
|
25
|
+
VOLUME = VolumeData()
|
|
26
|
+
|