seolpyo-mplchart 0.1.3.4__py3-none-any.whl → 1.0.1__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.
Potentially problematic release.
This version of seolpyo-mplchart might be problematic. Click here for more details.
- seolpyo_mplchart/__init__.py +221 -70
- seolpyo_mplchart/base.py +70 -67
- seolpyo_mplchart/cursor.py +246 -272
- seolpyo_mplchart/draw.py +389 -238
- seolpyo_mplchart/slider.py +414 -405
- seolpyo_mplchart/test.py +5 -32
- seolpyo_mplchart/utils.py +15 -4
- {seolpyo_mplchart-0.1.3.4.dist-info → seolpyo_mplchart-1.0.1.dist-info}/METADATA +5 -9
- seolpyo_mplchart-1.0.1.dist-info/RECORD +13 -0
- seolpyo_mplchart-0.1.3.4.dist-info/RECORD +0 -13
- {seolpyo_mplchart-0.1.3.4.dist-info → seolpyo_mplchart-1.0.1.dist-info}/WHEEL +0 -0
- {seolpyo_mplchart-0.1.3.4.dist-info → seolpyo_mplchart-1.0.1.dist-info}/top_level.txt +0 -0
seolpyo_mplchart/test.py
CHANGED
|
@@ -1,38 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import sys
|
|
2
2
|
from pathlib import Path
|
|
3
|
-
from typing import Literal
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
sys.path.insert(0, Path(__file__).parent.parent.__str__())
|
|
5
|
+
# print(f'{sys.path=}')
|
|
7
6
|
|
|
7
|
+
from seolpyo_mplchart import sample
|
|
8
8
|
|
|
9
|
-
from seolpyo_mplchart import Chart
|
|
10
9
|
|
|
10
|
+
sample()
|
|
11
11
|
|
|
12
|
-
_name = {'samsung', 'apple'}
|
|
13
|
-
def sample(name: Literal['samsung', 'apple']='samsung'):
|
|
14
|
-
if name not in _name:
|
|
15
|
-
print('name should be either samsung or apple.')
|
|
16
|
-
return
|
|
17
|
-
file = Path(__file__).parent / f'data/{name}.txt'
|
|
18
|
-
with open(file, 'r', encoding='utf-8') as txt:
|
|
19
|
-
data = json.load(txt)
|
|
20
|
-
data = data
|
|
21
|
-
df = pd.DataFrame(data)
|
|
22
|
-
|
|
23
|
-
c = Chart()
|
|
24
|
-
if name == 'apple':
|
|
25
|
-
c.unit_price = '$'
|
|
26
|
-
c.unit_volume = 'vol'
|
|
27
|
-
c.digit_price = 3
|
|
28
|
-
c.label_ma = 'ma{}'
|
|
29
|
-
c.candleformat = '{}\n\nclose: {}\nrate: {}\ncompare: {}\nopen: {}({})\nhigh: {}({})\nlow: {}({})\nvolume: {}({})'
|
|
30
|
-
c.volumeformat = '{}\n\nvolume: {}\nvolume rate: {}'
|
|
31
|
-
c.set_data(df)
|
|
32
|
-
plt.show()
|
|
33
|
-
|
|
34
|
-
return
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if __name__ == '__main__':
|
|
38
|
-
sample('apple')
|
seolpyo_mplchart/utils.py
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
from re import search
|
|
2
2
|
|
|
3
|
+
|
|
3
4
|
def convert_num(num):
|
|
4
5
|
if isinstance(num, float) and num % 1: return num
|
|
5
6
|
return int(num)
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
def float_to_str(num: float, digit=0, plus=False):
|
|
9
|
-
|
|
10
|
-
|
|
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:,}'
|
|
11
16
|
return text
|
|
12
17
|
|
|
13
18
|
|
|
@@ -16,7 +21,6 @@ dict_unit = {
|
|
|
16
21
|
'조': 1_000_000_000_000,
|
|
17
22
|
'억': 100_000_000,
|
|
18
23
|
'만': 10_000,
|
|
19
|
-
'천': 1_000,
|
|
20
24
|
}
|
|
21
25
|
dict_unit_en = {
|
|
22
26
|
'Qd': 1_000_000_000_000_000,
|
|
@@ -26,15 +30,20 @@ dict_unit_en = {
|
|
|
26
30
|
'K': 1_000,
|
|
27
31
|
}
|
|
28
32
|
|
|
33
|
+
|
|
29
34
|
def convert_unit(value, digit=0, word='원'):
|
|
35
|
+
# print(f'{value=:,}')
|
|
30
36
|
v = abs(value)
|
|
31
37
|
du = dict_unit if search('[가-힣]', word) else dict_unit_en
|
|
32
38
|
for unit, n in du.items():
|
|
33
39
|
if n <= v:
|
|
40
|
+
# print(f'{n=:,}')
|
|
41
|
+
# print(f'{unit=}')
|
|
34
42
|
num = value / n
|
|
35
43
|
return f'{float_to_str(num, digit)}{unit} {word}'
|
|
36
44
|
if not value % 1: value = int(value)
|
|
37
45
|
text = f'{float_to_str(value, digit)}{word}'
|
|
46
|
+
# print(f'{text=}')
|
|
38
47
|
return text
|
|
39
48
|
|
|
40
49
|
|
|
@@ -42,4 +51,6 @@ if __name__ == '__main__':
|
|
|
42
51
|
a = 456.123
|
|
43
52
|
print(float_to_str(a))
|
|
44
53
|
print(float_to_str(a, 2))
|
|
45
|
-
print(float_to_str(a, 6))
|
|
54
|
+
print(float_to_str(a, 6))
|
|
55
|
+
|
|
56
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: seolpyo-mplchart
|
|
3
|
-
Version: 0.1
|
|
3
|
+
Version: 1.0.1
|
|
4
4
|
Summary: Fast candlestick chart using Python. Includes navigator, slider, navigation, and text information display functions
|
|
5
5
|
Author-email: white-seolpyo <white-seolpyo@naver.com>
|
|
6
6
|
License: MIT License
|
|
@@ -38,16 +38,12 @@ Ethereum: 0x1c5fb8a5e0b1153cd4116c91736bd16fabf83520
|
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
# Sample
|
|
41
|
-

|
|
42
41
|

|
|
43
42
|
|
|
44
|
-

|
|
43
|
+

|
|
46
44
|
|
|
47
|
-
|
|
45
|
+

|
|
48
46
|
|
|
49
|
-

|
|
50
48
|
|
|
51
|
-

|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
seolpyo_mplchart/__init__.py,sha256=4UKWKBXMeax9YwejtLgbCHjjFQ0HEEhNBdQx9v4Ez0w,14476
|
|
2
|
+
seolpyo_mplchart/base.py,sha256=ofMDjWMLjPV-G_uJDiiUSR4X5eMPbrZDUg70R2YiPHE,3778
|
|
3
|
+
seolpyo_mplchart/cursor.py,sha256=Wm1SDBunQleZgphArJR2bVNPZ3vDAcxNlC5HaQwKMRk,17908
|
|
4
|
+
seolpyo_mplchart/draw.py,sha256=3bRIg6sz9XwzKNnYWbaO0W8KlC-Wnpl0dJnY6lgHZ8c,18860
|
|
5
|
+
seolpyo_mplchart/slider.py,sha256=0sVzwxiZHZv-f2UhRJUTSz2aJ32BsVyPvrcOpw2hn-U,20635
|
|
6
|
+
seolpyo_mplchart/test.py,sha256=TFnIXphJsl-B7iIhBh7-PZKUz2Gjh7mwNwrk8aUS4SA,180
|
|
7
|
+
seolpyo_mplchart/utils.py,sha256=a3XycRBTndrsjBw_1VKTxbSvOGpVYXHRK87v7azgRe8,1433
|
|
8
|
+
seolpyo_mplchart/data/apple.txt,sha256=0izAfweu1lLsC0IwVthdVlo9reG8KGbKGTSX5knI5Zc,1380864
|
|
9
|
+
seolpyo_mplchart/data/samsung.txt,sha256=UejaSkbzr4E5K3lkelCT0yJiWUPfmViBEaTyoXyphIs,2476424
|
|
10
|
+
seolpyo_mplchart-1.0.1.dist-info/METADATA,sha256=2ocUZovo4l5B1gtaKSt-9lVUOupVaR6VFttxjIMXEiE,2352
|
|
11
|
+
seolpyo_mplchart-1.0.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
12
|
+
seolpyo_mplchart-1.0.1.dist-info/top_level.txt,sha256=KgqFn7rKWize7OjMaTCHxKm9ie6vqnyb5c8fN7y_tSo,17
|
|
13
|
+
seolpyo_mplchart-1.0.1.dist-info/RECORD,,
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
seolpyo_mplchart/__init__.py,sha256=FiuciCaX9lU12gwuDBYUNw0yLD06p4o7o19kR5jGips,5248
|
|
2
|
-
seolpyo_mplchart/base.py,sha256=vQ4OOBm3nGwjJ4wjDLaD_3LGxYzlP6AWpI6SZrZiwnQ,3600
|
|
3
|
-
seolpyo_mplchart/cursor.py,sha256=rXGWf0p3oElnsVfEPObGVnD8dBMfvTgx2o6RermkMbE,18405
|
|
4
|
-
seolpyo_mplchart/draw.py,sha256=NJH1dnmfepafMlc7K2ccwZbv0FDS3ItSiirCq4gMlOI,13145
|
|
5
|
-
seolpyo_mplchart/slider.py,sha256=R29vyNAdJkLEXgpP4hxe9O0WoLgoOnPOUHuKFNpdcnw,19601
|
|
6
|
-
seolpyo_mplchart/test.py,sha256=cW2hoaVbRtoSXlpmA4i1BKHBjI3-FAqYq__kryxkrC8,1007
|
|
7
|
-
seolpyo_mplchart/utils.py,sha256=-8cq4-WwiqKQxtwu3NPxOVTDDvoWH28tu4OTWr4hPTg,1208
|
|
8
|
-
seolpyo_mplchart/data/apple.txt,sha256=0izAfweu1lLsC0IwVthdVlo9reG8KGbKGTSX5knI5Zc,1380864
|
|
9
|
-
seolpyo_mplchart/data/samsung.txt,sha256=UejaSkbzr4E5K3lkelCT0yJiWUPfmViBEaTyoXyphIs,2476424
|
|
10
|
-
seolpyo_mplchart-0.1.3.4.dist-info/METADATA,sha256=G5VzB5GO92_eTnJ7KRR608Q7_n4-2pqJIvGFk9IYT2Y,2661
|
|
11
|
-
seolpyo_mplchart-0.1.3.4.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
12
|
-
seolpyo_mplchart-0.1.3.4.dist-info/top_level.txt,sha256=KgqFn7rKWize7OjMaTCHxKm9ie6vqnyb5c8fN7y_tSo,17
|
|
13
|
-
seolpyo_mplchart-0.1.3.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|