analyser_hj3415 2.5.1__py2.py3-none-any.whl → 2.5.3__py2.py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- analyser_hj3415/analysers/eval.py +3 -2
- analyser_hj3415/cli.py +88 -18
- {analyser_hj3415-2.5.1.dist-info → analyser_hj3415-2.5.3.dist-info}/METADATA +3 -3
- {analyser_hj3415-2.5.1.dist-info → analyser_hj3415-2.5.3.dist-info}/RECORD +7 -7
- analyser_hj3415-2.5.3.dist-info/entry_points.txt +3 -0
- analyser_hj3415-2.5.1.dist-info/entry_points.txt +0 -3
- {analyser_hj3415-2.5.1.dist-info → analyser_hj3415-2.5.3.dist-info}/LICENSE +0 -0
- {analyser_hj3415-2.5.1.dist-info → analyser_hj3415-2.5.3.dist-info}/WHEEL +0 -0
@@ -2,7 +2,7 @@
|
|
2
2
|
"""
|
3
3
|
import math
|
4
4
|
|
5
|
-
from analyser_hj3415 import tools
|
5
|
+
from analyser_hj3415 import tools, cli
|
6
6
|
from utils_hj3415 import utils
|
7
7
|
from db_hj3415 import myredis
|
8
8
|
|
@@ -17,7 +17,8 @@ logger.setLevel(logging.WARNING)
|
|
17
17
|
|
18
18
|
|
19
19
|
# 주식을 통한 기대수익률 - 금리가 3%일 경우 두배인 6% 정도로 잡는다.
|
20
|
-
EXPECT_EARN =
|
20
|
+
EXPECT_EARN = cli.AnalyserSettingsManager(cli.SETTINGS_FILE).get_value('EXPECT_EARN')
|
21
|
+
print("EXPECT_EARN: ", EXPECT_EARN)
|
21
22
|
|
22
23
|
|
23
24
|
def red(code: str) -> dict:
|
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
|
|
@@ -1,12 +1,12 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: analyser_hj3415
|
3
|
-
Version: 2.5.
|
3
|
+
Version: 2.5.3
|
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
|
@@ -1,14 +1,14 @@
|
|
1
1
|
analyser_hj3415/.DS_Store,sha256=qr9-0FPn5CFKe6kEu8_dWCNhzQ0sN7bwQgffKsaJEEo,6148
|
2
2
|
analyser_hj3415/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
|
-
analyser_hj3415/cli.py,sha256=
|
3
|
+
analyser_hj3415/cli.py,sha256=27l5X0L657FIybpZdNUBl94KfmghyFOHF2OlY7AjO58,4635
|
4
4
|
analyser_hj3415/myredis.py,sha256=T5ESGx1QBrO7mTMlSzqIm975Wks-X9WqrPWVWgFRHUE,10758
|
5
5
|
analyser_hj3415/tools.py,sha256=T7QYJekKvWNlJtiqu_FaiX3FGfDc71NY4vrbEDfBEt0,13705
|
6
6
|
analyser_hj3415/trash.py,sha256=zF-W0piqkGr66UP6-iybo9EXh2gO0RP6R1FnIpsGkl8,12262
|
7
|
-
analyser_hj3415/analysers/eval.py,sha256=
|
7
|
+
analyser_hj3415/analysers/eval.py,sha256=Kfk3LwQEZHad6gMqb3qPoqX2qJ4Y1miY-zjcBfGShpA,13418
|
8
8
|
analyser_hj3415/analysers/report.py,sha256=yY-AeDHOqDPrm4lpvZv3NPTJK1Z7lKsjoO5ck8AP6u4,9007
|
9
9
|
analyser_hj3415/analysers/score.py,sha256=tyc1NA_0K7b2mjTTMdJVH_OlqBAqAMrcPOvWPYFudfg,15853
|
10
|
-
analyser_hj3415-2.5.
|
11
|
-
analyser_hj3415-2.5.
|
12
|
-
analyser_hj3415-2.5.
|
13
|
-
analyser_hj3415-2.5.
|
14
|
-
analyser_hj3415-2.5.
|
10
|
+
analyser_hj3415-2.5.3.dist-info/entry_points.txt,sha256=ZfjPnJuH8SzvhE9vftIPMBIofsc65IAWYOhqOC_L5ck,65
|
11
|
+
analyser_hj3415-2.5.3.dist-info/LICENSE,sha256=QVKTp0dTnB5xG8RLgG17LwSWCKNEzYoVVM6KjoCPKc0,1079
|
12
|
+
analyser_hj3415-2.5.3.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
|
13
|
+
analyser_hj3415-2.5.3.dist-info/METADATA,sha256=1s6PMEoNYkr77mTT1Lt_GQg3ZVTe1qHe1Ef6Qoe5gls,6417
|
14
|
+
analyser_hj3415-2.5.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|