analyser_hj3415 2.5.0__py2.py3-none-any.whl → 2.5.2__py2.py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- analyser_hj3415/.DS_Store +0 -0
- analyser_hj3415/analysers/eval.py +295 -289
- analyser_hj3415/analysers/report.py +182 -182
- analyser_hj3415/analysers/score.py +364 -364
- analyser_hj3415/cli.py +88 -18
- analyser_hj3415/settings.json +1 -0
- analyser_hj3415/tools.py +1 -0
- {analyser_hj3415-2.5.0.dist-info → analyser_hj3415-2.5.2.dist-info}/METADATA +3 -3
- analyser_hj3415-2.5.2.dist-info/RECORD +15 -0
- analyser_hj3415-2.5.2.dist-info/entry_points.txt +3 -0
- analyser_hj3415-2.5.0.dist-info/RECORD +0 -14
- analyser_hj3415-2.5.0.dist-info/entry_points.txt +0 -3
- {analyser_hj3415-2.5.0.dist-info → analyser_hj3415-2.5.2.dist-info}/LICENSE +0 -0
- {analyser_hj3415-2.5.0.dist-info → analyser_hj3415-2.5.2.dist-info}/WHEEL +0 -0
analyser_hj3415/cli.py
CHANGED
@@ -1,32 +1,102 @@
|
|
1
1
|
import argparse
|
2
|
-
|
2
|
+
import os
|
3
3
|
|
4
|
+
from utils_hj3415 import noti, utils
|
5
|
+
from utils_hj3415.utils import SettingsManager
|
6
|
+
from analyser_hj3415.myredis import red_ranking, mil_n_score
|
7
|
+
from db_hj3415 import myredis
|
4
8
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
9
|
+
|
10
|
+
# 파일 경로 상수
|
11
|
+
SETTINGS_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'settings.json')
|
12
|
+
|
13
|
+
|
14
|
+
class AnalyserSettingsManager(SettingsManager):
|
15
|
+
DEFAULT_SETTINGS = {
|
16
|
+
'EXPECT_EARN': 0.06,
|
10
17
|
}
|
11
|
-
|
12
|
-
|
13
|
-
|
18
|
+
TITLES = DEFAULT_SETTINGS.keys()
|
19
|
+
|
20
|
+
def set_value(self, title: str, value: str):
|
21
|
+
assert title in self.TITLES, f"title 인자는 {self.TITLES} 중에 있어야 합니다."
|
22
|
+
self.settings_dict[title] = value
|
23
|
+
self.save_settings()
|
24
|
+
print(f"{title}: {value}가 저장되었습니다")
|
25
|
+
|
26
|
+
def get_value(self, title: str) -> str:
|
27
|
+
assert title in self.TITLES, f"title 인자는 {self.TITLES} 중에 있어야 합니다."
|
28
|
+
return self.settings_dict.get(title, self.DEFAULT_SETTINGS[title])
|
29
|
+
|
30
|
+
def reset_value(self, title: str):
|
31
|
+
assert title in self.TITLES, f"title 인자는 {self.TITLES} 중에 있어야 합니다."
|
32
|
+
self.set_value(title, self.DEFAULT_SETTINGS[title])
|
33
|
+
print(f"{title}이 기본값 ({self.DEFAULT_SETTINGS[title]}) 으로 초기화 되었습니다.")
|
34
|
+
|
35
|
+
|
36
|
+
def analyser_manager():
|
37
|
+
settings_manager = AnalyserSettingsManager(SETTINGS_FILE)
|
38
|
+
|
39
|
+
parser = argparse.ArgumentParser(description="Analyser Commands")
|
40
|
+
type_subparsers = parser.add_subparsers(dest='type', help='분석 타입')
|
41
|
+
|
42
|
+
# red 명령어 서브파서
|
43
|
+
red_parser = type_subparsers.add_parser('red', help='red 타입')
|
44
|
+
red_subparser = red_parser.add_subparsers(dest='command', help='red 관련된 명령')
|
45
|
+
# red - ranking 파서
|
46
|
+
ranking_parser = red_subparser.add_parser('ranking', help='red 랭킹 책정 및 레디스 저장')
|
47
|
+
ranking_parser.add_argument('--noti', action='store_true', help='작업 완료 후 메시지 전송 여부')
|
48
|
+
|
49
|
+
# mil 명령어 서브파서
|
50
|
+
mil_parser = type_subparsers.add_parser('mil', help='millennial 타입')
|
51
|
+
mil_subparser = mil_parser.add_subparsers(dest='command', help='mil 관련된 명령')
|
52
|
+
# mil - score 파서
|
53
|
+
score_parser = mil_subparser.add_parser('score', help='mil score 책정 및 레디스 저장')
|
54
|
+
score_parser.add_argument('code', type=str, help='종목코드 or all')
|
55
|
+
score_parser.add_argument('--noti', action='store_true', help='작업 완료 후 메시지 전송 여부')
|
56
|
+
|
57
|
+
# setting 명령어 서브파서
|
58
|
+
setting_parser = type_subparsers.add_parser('setting', help='Set and Get settings')
|
59
|
+
setting_subparser = setting_parser.add_subparsers(dest='command', help='setting 관련된 명령')
|
60
|
+
# setting - set 파서
|
61
|
+
set_parser = setting_subparser.add_parser('set', help='세팅값 저장')
|
62
|
+
set_parser.add_argument('title', choices=AnalyserSettingsManager.TITLES, help='타이틀')
|
63
|
+
set_parser.add_argument('value', help='세팅값')
|
64
|
+
# setting - get 파서
|
65
|
+
get_parser = setting_subparser.add_parser('get', help='타이틀 세팅값 불러오기')
|
66
|
+
get_parser.add_argument('title', choices=AnalyserSettingsManager.TITLES, help='타이틀')
|
67
|
+
# setting - print 파서
|
68
|
+
setting_subparser.add_parser('print', help='전체 세팅값 출력')
|
14
69
|
|
15
70
|
args = parser.parse_args()
|
16
71
|
|
17
|
-
if args.
|
72
|
+
if args.type == 'red':
|
18
73
|
if args.command == 'ranking':
|
19
|
-
|
74
|
+
result = red_ranking()
|
75
|
+
print(result)
|
20
76
|
if args.noti:
|
21
77
|
noti.telegram_to('manager', "오늘의 red ranking을 레디스캐시에 저장했습니다.(유효 12시간)")
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
print("
|
26
|
-
|
78
|
+
elif args.type == 'mil':
|
79
|
+
if args.command == 'score':
|
80
|
+
if args.code == 'all':
|
81
|
+
print("**** mil_n_score all code ****")
|
82
|
+
for i, code in enumerate(myredis.Corps.list_all_codes()):
|
83
|
+
print(f'{i} / {code}')
|
84
|
+
mil_n_score(code)
|
85
|
+
else:
|
86
|
+
assert utils.is_6digit(args.code), "code 인자는 6자리 숫자이어야 합니다."
|
87
|
+
print(args.code, mil_n_score(args.code))
|
27
88
|
if args.noti:
|
28
|
-
noti.telegram_to('manager', "오늘의 mil and score를 레디스캐시에 저장했습니다.(유효 12시간)")
|
89
|
+
noti.telegram_to('manager', f"오늘의 mil and score({args.code})를 레디스캐시에 저장했습니다.(유효 12시간)")
|
90
|
+
elif args.type == 'setting':
|
91
|
+
if args.command == 'set':
|
92
|
+
settings_manager.set_value(args.title, args.value)
|
93
|
+
elif args.command == 'get':
|
94
|
+
value = settings_manager.get_value(args.title)
|
95
|
+
print(f"{args.title} 값: {value}")
|
96
|
+
elif args.command == 'print':
|
97
|
+
print(settings_manager.load_settings())
|
29
98
|
else:
|
30
|
-
|
99
|
+
parser.print_help()
|
100
|
+
|
31
101
|
|
32
102
|
|
@@ -0,0 +1 @@
|
|
1
|
+
{}
|
analyser_hj3415/tools.py
CHANGED
@@ -31,6 +31,7 @@ def calc당기순이익(code: str) -> Tuple[str, float]:
|
|
31
31
|
logger.debug(f'In the calc당기순이익... code:{code}')
|
32
32
|
c103q = C103(code, 'c103재무상태표q')
|
33
33
|
try:
|
34
|
+
# print("*(지배)당기순이익: ", c103q.latest_value_pop2('*(지배)당기순이익'))
|
34
35
|
return c103q.latest_value_pop2('*(지배)당기순이익')
|
35
36
|
except:
|
36
37
|
logger.warning(f"{code} - (지배)당기순이익이 없는 종목. 수동으로 계산합니다(금융관련업종일 가능성있음).")
|
@@ -1,12 +1,12 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: analyser_hj3415
|
3
|
-
Version: 2.5.
|
3
|
+
Version: 2.5.2
|
4
4
|
Summary: Stock analyser and database processing programs
|
5
5
|
Author-email: Hyungjin Kim <hj3415@gmail.com>
|
6
6
|
Description-Content-Type: text/markdown
|
7
7
|
Classifier: License :: OSI Approved :: MIT License
|
8
|
-
Requires-Dist: utils-hj3415>=2.
|
9
|
-
Requires-Dist: db-hj3415>=3.
|
8
|
+
Requires-Dist: utils-hj3415>=2.7.0
|
9
|
+
Requires-Dist: db-hj3415>=3.7.2
|
10
10
|
Project-URL: Home, https://www.hyungjin.kr
|
11
11
|
|
12
12
|
### analyser-hj3415
|
@@ -0,0 +1,15 @@
|
|
1
|
+
analyser_hj3415/.DS_Store,sha256=qr9-0FPn5CFKe6kEu8_dWCNhzQ0sN7bwQgffKsaJEEo,6148
|
2
|
+
analyser_hj3415/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
|
+
analyser_hj3415/cli.py,sha256=27l5X0L657FIybpZdNUBl94KfmghyFOHF2OlY7AjO58,4635
|
4
|
+
analyser_hj3415/myredis.py,sha256=T5ESGx1QBrO7mTMlSzqIm975Wks-X9WqrPWVWgFRHUE,10758
|
5
|
+
analyser_hj3415/settings.json,sha256=RBNvo1WzZ4oRRq0W9-hknpT7T8If536DEMBg9hyq_4o,2
|
6
|
+
analyser_hj3415/tools.py,sha256=T7QYJekKvWNlJtiqu_FaiX3FGfDc71NY4vrbEDfBEt0,13705
|
7
|
+
analyser_hj3415/trash.py,sha256=zF-W0piqkGr66UP6-iybo9EXh2gO0RP6R1FnIpsGkl8,12262
|
8
|
+
analyser_hj3415/analysers/eval.py,sha256=DIuy0jsF5zP2I26rDeGoeguqw3yvgud-3Pr6argDnYc,13310
|
9
|
+
analyser_hj3415/analysers/report.py,sha256=yY-AeDHOqDPrm4lpvZv3NPTJK1Z7lKsjoO5ck8AP6u4,9007
|
10
|
+
analyser_hj3415/analysers/score.py,sha256=tyc1NA_0K7b2mjTTMdJVH_OlqBAqAMrcPOvWPYFudfg,15853
|
11
|
+
analyser_hj3415-2.5.2.dist-info/entry_points.txt,sha256=ZfjPnJuH8SzvhE9vftIPMBIofsc65IAWYOhqOC_L5ck,65
|
12
|
+
analyser_hj3415-2.5.2.dist-info/LICENSE,sha256=QVKTp0dTnB5xG8RLgG17LwSWCKNEzYoVVM6KjoCPKc0,1079
|
13
|
+
analyser_hj3415-2.5.2.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
|
14
|
+
analyser_hj3415-2.5.2.dist-info/METADATA,sha256=HAr1OI0_4vgeNjVNp7lXayvmrBPoW1CoVQ_BOUTIzVo,6417
|
15
|
+
analyser_hj3415-2.5.2.dist-info/RECORD,,
|
@@ -1,14 +0,0 @@
|
|
1
|
-
analyser_hj3415/.DS_Store,sha256=OQfTSOHL-zjUtnNyBpNRVUJUstR4j6I7jihKDFQQmME,6148
|
2
|
-
analyser_hj3415/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
|
-
analyser_hj3415/cli.py,sha256=NKE69OV8_G0HcBHnX_cM1Zr3-AmxyR7rX1kPv5cVT3o,1188
|
4
|
-
analyser_hj3415/myredis.py,sha256=T5ESGx1QBrO7mTMlSzqIm975Wks-X9WqrPWVWgFRHUE,10758
|
5
|
-
analyser_hj3415/tools.py,sha256=SNsrnL5CKmKAdFkmlwgREMIkWDRi6N9LngCdhhhop3Y,13606
|
6
|
-
analyser_hj3415/trash.py,sha256=zF-W0piqkGr66UP6-iybo9EXh2gO0RP6R1FnIpsGkl8,12262
|
7
|
-
analyser_hj3415/analysers/eval.py,sha256=mlHi6EPc8l8O6vKnWyX4Cz1BaeGhUpWM8gVZRNhm-JU,13299
|
8
|
-
analyser_hj3415/analysers/report.py,sha256=whggmLXl7yF-BjQ6JKgxmhILT2T4uFP-rit_BSes9xM,9189
|
9
|
-
analyser_hj3415/analysers/score.py,sha256=j5bH_r2-Sc53JWgmdBmL7pJk9cc8oQ7iZkYRPPOA-so,16217
|
10
|
-
analyser_hj3415-2.5.0.dist-info/entry_points.txt,sha256=vBiMpIhNh39VC3UPwgxQNPb54N8vMlr4g0zRcCOjPyo,57
|
11
|
-
analyser_hj3415-2.5.0.dist-info/LICENSE,sha256=QVKTp0dTnB5xG8RLgG17LwSWCKNEzYoVVM6KjoCPKc0,1079
|
12
|
-
analyser_hj3415-2.5.0.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
|
13
|
-
analyser_hj3415-2.5.0.dist-info/METADATA,sha256=nJyR2yM5g5C-wqJ9PXgk7Cecnro3hqHMrR6ESGSDdxU,6417
|
14
|
-
analyser_hj3415-2.5.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|