analyser_hj3415 2.5.7__py2.py3-none-any.whl → 2.6.0__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 -6
- analyser_hj3415/analysers/score.py +4 -6
- analyser_hj3415/cli.py +7 -9
- analyser_hj3415/myredis.py +7 -7
- analyser_hj3415/tools.py +1 -0
- {analyser_hj3415-2.5.7.dist-info → analyser_hj3415-2.6.0.dist-info}/METADATA +1 -1
- analyser_hj3415-2.6.0.dist-info/RECORD +14 -0
- analyser_hj3415-2.5.7.dist-info/RECORD +0 -14
- {analyser_hj3415-2.5.7.dist-info → analyser_hj3415-2.6.0.dist-info}/LICENSE +0 -0
- {analyser_hj3415-2.5.7.dist-info → analyser_hj3415-2.6.0.dist-info}/WHEEL +0 -0
- {analyser_hj3415-2.5.7.dist-info → analyser_hj3415-2.6.0.dist-info}/entry_points.txt +0 -0
@@ -16,7 +16,7 @@ logger.addHandler(ch)
|
|
16
16
|
logger.setLevel(logging.WARNING)
|
17
17
|
|
18
18
|
|
19
|
-
def red(code: str) -> dict:
|
19
|
+
def red(code: str, expect_earn: float) -> dict:
|
20
20
|
"""
|
21
21
|
리턴값
|
22
22
|
{
|
@@ -41,10 +41,7 @@ def red(code: str) -> dict:
|
|
41
41
|
d6, 투자부동산 = c103q.latest_value_pop2('투자부동산')
|
42
42
|
|
43
43
|
# 사업가치 계산 - 지배주주지분 당기순이익 / 기대수익률
|
44
|
-
|
45
|
-
EXPECT_EARN = utils.to_float(cli.AnalyserSettingsManager(cli.SETTINGS_FILE).get_value('EXPECT_EARN'))
|
46
|
-
print('EXPECT_EARN', EXPECT_EARN)
|
47
|
-
사업가치 = round(utils.nan_to_zero(지배주주당기순이익) / EXPECT_EARN, 2)
|
44
|
+
사업가치 = round(utils.nan_to_zero(지배주주당기순이익) / expect_earn, 2)
|
48
45
|
|
49
46
|
# 재산가치 계산 - 유동자산 - (유동부채*1.2) + 고정자산중 투자자산
|
50
47
|
재산가치 = round(유동자산 - (유동부채 * 1.2) + utils.nan_to_zero(투자자산) + utils.nan_to_zero(투자부동산), 2)
|
@@ -72,7 +69,7 @@ def red(code: str) -> dict:
|
|
72
69
|
'재산가치': 재산가치,
|
73
70
|
'부채평가': 부채평가,
|
74
71
|
'발행주식수': 발행주식수,
|
75
|
-
'EXPECT_EARN':
|
72
|
+
'EXPECT_EARN': expect_earn,
|
76
73
|
'date': tools.set_data(d1, d2, d3, d4, d5, d6), # ''값을 제거하고 리스트로 바꾼다.
|
77
74
|
}
|
78
75
|
|
@@ -32,7 +32,7 @@ def cal_deviation(v1: float, v2: float) -> float:
|
|
32
32
|
return deviation
|
33
33
|
|
34
34
|
|
35
|
-
def red(code: str) -> int:
|
35
|
+
def red(code: str, expect_earn: float) -> int:
|
36
36
|
"""red price와 최근 주가의 괴리율 파악
|
37
37
|
|
38
38
|
Returns:
|
@@ -44,7 +44,7 @@ def red(code: str) -> int:
|
|
44
44
|
recent_price = float('nan')
|
45
45
|
return 0
|
46
46
|
|
47
|
-
red_price = eval.red(code)['red_price']
|
47
|
+
red_price = eval.red(code, expect_earn)['red_price']
|
48
48
|
deviation = cal_deviation(recent_price, red_price)
|
49
49
|
if red_price < 0 or (recent_price >= red_price):
|
50
50
|
score = 0
|
@@ -56,7 +56,7 @@ def red(code: str) -> int:
|
|
56
56
|
return utils.to_int(score)
|
57
57
|
|
58
58
|
|
59
|
-
def mil(code: str) -> Tuple[int, int, int, int]:
|
59
|
+
def mil(code: str, expect_earn: float) -> Tuple[int, int, int, int]:
|
60
60
|
"""
|
61
61
|
- 재무활동현금흐름이 마이너스라는 것은 배당급 지급했거나, 자사주 매입했거나, 부채를 상환한 상태임.
|
62
62
|
- 반대는 채권자로 자금을 조달했거나 신주를 발행했다는 의미
|
@@ -93,9 +93,7 @@ def mil(code: str) -> Tuple[int, int, int, int]:
|
|
93
93
|
if math.isnan(mil_dict['주주수익률']):
|
94
94
|
score1 = 0
|
95
95
|
else:
|
96
|
-
|
97
|
-
EXPECT_EARN = utils.to_float(cli.AnalyserSettingsManager(cli.SETTINGS_FILE).get_value('EXPECT_EARN'))
|
98
|
-
주주수익률평가 = math.ceil(mil_dict['주주수익률'] - (EXPECT_EARN * 100))
|
96
|
+
주주수익률평가 = math.ceil(mil_dict['주주수익률'] - (expect_earn * 100))
|
99
97
|
score1 = 0 if 0 > 주주수익률평가 else 주주수익률평가
|
100
98
|
|
101
99
|
# 이익지표 평가
|
analyser_hj3415/cli.py
CHANGED
@@ -23,7 +23,7 @@ class AnalyserSettingsManager(SettingsManager):
|
|
23
23
|
self.save_settings()
|
24
24
|
print(f"{title}: {value}가 저장되었습니다")
|
25
25
|
|
26
|
-
def get_value(self, title: str)
|
26
|
+
def get_value(self, title: str):
|
27
27
|
assert title in self.TITLES, f"title 인자는 {self.TITLES} 중에 있어야 합니다."
|
28
28
|
return self.settings_dict.get(title, self.DEFAULT_SETTINGS[title])
|
29
29
|
|
@@ -35,6 +35,7 @@ class AnalyserSettingsManager(SettingsManager):
|
|
35
35
|
|
36
36
|
def analyser_manager():
|
37
37
|
settings_manager = AnalyserSettingsManager(SETTINGS_FILE)
|
38
|
+
expect_earn = settings_manager.get_value('EXPECT_EARN')
|
38
39
|
|
39
40
|
parser = argparse.ArgumentParser(description="Analyser Commands")
|
40
41
|
type_subparsers = parser.add_subparsers(dest='type', help='분석 타입')
|
@@ -79,14 +80,14 @@ def analyser_manager():
|
|
79
80
|
print("**** red_n_score all code ****")
|
80
81
|
for i, code in enumerate(myredis.Corps.list_all_codes()):
|
81
82
|
print(f'{i} / {code}')
|
82
|
-
red_n_score(code)
|
83
|
+
red_n_score(code, expect_earn)
|
83
84
|
else:
|
84
85
|
assert utils.is_6digit(args.code), "code 인자는 6자리 숫자이어야 합니다."
|
85
|
-
print(args.code, red_n_score(args.code))
|
86
|
+
print(args.code, red_n_score(args.code, expect_earn))
|
86
87
|
if args.noti:
|
87
88
|
noti.telegram_to('manager', f"오늘의 red and score({args.code})를 레디스캐시에 저장했습니다.(유효 12시간)")
|
88
89
|
elif args.command == 'ranking':
|
89
|
-
result = red_ranking()
|
90
|
+
result = red_ranking(expect_earn)
|
90
91
|
print(result)
|
91
92
|
if args.noti:
|
92
93
|
noti.telegram_to('manager', "오늘의 red ranking을 레디스캐시에 저장했습니다.(유효 12시간)")
|
@@ -96,10 +97,10 @@ def analyser_manager():
|
|
96
97
|
print("**** mil_n_score all code ****")
|
97
98
|
for i, code in enumerate(myredis.Corps.list_all_codes()):
|
98
99
|
print(f'{i} / {code}')
|
99
|
-
mil_n_score(code)
|
100
|
+
mil_n_score(code, expect_earn)
|
100
101
|
else:
|
101
102
|
assert utils.is_6digit(args.code), "code 인자는 6자리 숫자이어야 합니다."
|
102
|
-
print(args.code, mil_n_score(args.code))
|
103
|
+
print(args.code, mil_n_score(args.code, expect_earn))
|
103
104
|
if args.noti:
|
104
105
|
noti.telegram_to('manager', f"오늘의 mil and score({args.code})를 레디스캐시에 저장했습니다.(유효 12시간)")
|
105
106
|
elif args.type == 'setting':
|
@@ -112,6 +113,3 @@ def analyser_manager():
|
|
112
113
|
print(settings_manager.load_settings())
|
113
114
|
else:
|
114
115
|
parser.print_help()
|
115
|
-
|
116
|
-
|
117
|
-
|
analyser_hj3415/myredis.py
CHANGED
@@ -8,7 +8,7 @@ from db_hj3415 import myredis as db_myredis
|
|
8
8
|
page = '.analyser'
|
9
9
|
|
10
10
|
|
11
|
-
def red_ranking() -> OrderedDict:
|
11
|
+
def red_ranking(expect_earn: float) -> OrderedDict:
|
12
12
|
"""
|
13
13
|
redis를 사용하며 red score를 계산해서 0이상의 값을 가지는 종목을 순서대로 저장하여 반환한다.
|
14
14
|
:return: OrderedDict([('023590', 101),
|
@@ -23,7 +23,7 @@ def red_ranking() -> OrderedDict:
|
|
23
23
|
# redis에 해당하는 값이 없는 경우
|
24
24
|
data = {}
|
25
25
|
for i, code in enumerate(db_myredis.Corps.list_all_codes()):
|
26
|
-
red_score = score.red(code)
|
26
|
+
red_score = score.red(code, expect_earn)
|
27
27
|
if red_score <= 0:
|
28
28
|
continue
|
29
29
|
data[code] = red_score
|
@@ -44,7 +44,7 @@ def red_ranking() -> OrderedDict:
|
|
44
44
|
return OrderedDict(sorted(json.loads(cached_data).items(), key=lambda item: item[1], reverse=True))
|
45
45
|
|
46
46
|
|
47
|
-
def red_n_score(code: str) -> dict:
|
47
|
+
def red_n_score(code: str, expect_earn: float) -> dict:
|
48
48
|
"""
|
49
49
|
redis 사용 - 소멸타이머 사용
|
50
50
|
리턴값
|
@@ -62,8 +62,8 @@ def red_n_score(code: str) -> dict:
|
|
62
62
|
cached_data = Base.redis_client.get(redis_name).decode('utf-8')
|
63
63
|
except AttributeError:
|
64
64
|
# redis에 해당하는 값이 없는 경우
|
65
|
-
data = eval.red(code)
|
66
|
-
data['score'] = score.red(code)
|
65
|
+
data = eval.red(code, expect_earn)
|
66
|
+
data['score'] = score.red(code, expect_earn)
|
67
67
|
# print(data)
|
68
68
|
if data:
|
69
69
|
# 데이터를 Redis에 캐싱
|
@@ -77,7 +77,7 @@ def red_n_score(code: str) -> dict:
|
|
77
77
|
return json.loads(cached_data)
|
78
78
|
|
79
79
|
|
80
|
-
def mil_n_score(code: str) -> dict:
|
80
|
+
def mil_n_score(code: str, expect_earn: float) -> dict:
|
81
81
|
"""
|
82
82
|
redis 사용 - 소멸타이머 사용
|
83
83
|
리턴값
|
@@ -119,7 +119,7 @@ def mil_n_score(code: str) -> dict:
|
|
119
119
|
except AttributeError:
|
120
120
|
# redis에 해당하는 값이 없는 경우
|
121
121
|
data = eval.mil(code)
|
122
|
-
data['score'] = score.mil(code)
|
122
|
+
data['score'] = score.mil(code, expect_earn)
|
123
123
|
# print(data)
|
124
124
|
if data:
|
125
125
|
# 데이터를 Redis에 캐싱
|
analyser_hj3415/tools.py
CHANGED
@@ -0,0 +1,14 @@
|
|
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=xxbkpaKuLeOF5T9zD0MdsbK9lvSWrYFWU0MUOlttTJM,5704
|
4
|
+
analyser_hj3415/myredis.py,sha256=VC4gxZwBZhE1MduuG0XSTQXogQAahdm-JkB0Loh2DC4,10868
|
5
|
+
analyser_hj3415/tools.py,sha256=m0zs-nFfpxuLaDh22EwsYJSgBirfSVmge8a6fvxRq60,13753
|
6
|
+
analyser_hj3415/trash.py,sha256=zF-W0piqkGr66UP6-iybo9EXh2gO0RP6R1FnIpsGkl8,12262
|
7
|
+
analyser_hj3415/analysers/eval.py,sha256=qqGTi8YUF6SYfopGM3VaPVYjyC_hVTLlmKkVA2Zz3kg,13251
|
8
|
+
analyser_hj3415/analysers/report.py,sha256=yY-AeDHOqDPrm4lpvZv3NPTJK1Z7lKsjoO5ck8AP6u4,9007
|
9
|
+
analyser_hj3415/analysers/score.py,sha256=narJQZFnBM4srV32TpmrOdj4VFskpl0ePymixRxp3Sk,15901
|
10
|
+
analyser_hj3415-2.6.0.dist-info/entry_points.txt,sha256=ZfjPnJuH8SzvhE9vftIPMBIofsc65IAWYOhqOC_L5ck,65
|
11
|
+
analyser_hj3415-2.6.0.dist-info/LICENSE,sha256=QVKTp0dTnB5xG8RLgG17LwSWCKNEzYoVVM6KjoCPKc0,1079
|
12
|
+
analyser_hj3415-2.6.0.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
|
13
|
+
analyser_hj3415-2.6.0.dist-info/METADATA,sha256=mWhUbMAhIWCXqAeyvqelCH9tMqB2mstIx9Uu1nFebXk,6417
|
14
|
+
analyser_hj3415-2.6.0.dist-info/RECORD,,
|
@@ -1,14 +0,0 @@
|
|
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=cXXOZGJjjC9xQrT9-NwgnBbgMDwnpm7hSybAoYcZNAs,5591
|
4
|
-
analyser_hj3415/myredis.py,sha256=T5ESGx1QBrO7mTMlSzqIm975Wks-X9WqrPWVWgFRHUE,10758
|
5
|
-
analyser_hj3415/tools.py,sha256=T7QYJekKvWNlJtiqu_FaiX3FGfDc71NY4vrbEDfBEt0,13705
|
6
|
-
analyser_hj3415/trash.py,sha256=zF-W0piqkGr66UP6-iybo9EXh2gO0RP6R1FnIpsGkl8,12262
|
7
|
-
analyser_hj3415/analysers/eval.py,sha256=55JtgTx-ICthJHySQeRclU1PJSvmOjUlz8glN-OV85k,13411
|
8
|
-
analyser_hj3415/analysers/report.py,sha256=yY-AeDHOqDPrm4lpvZv3NPTJK1Z7lKsjoO5ck8AP6u4,9007
|
9
|
-
analyser_hj3415/analysers/score.py,sha256=sH79RYTDrBD06tdKADsAd9lAvgFGN7385lLJsE3qy_Q,15998
|
10
|
-
analyser_hj3415-2.5.7.dist-info/entry_points.txt,sha256=ZfjPnJuH8SzvhE9vftIPMBIofsc65IAWYOhqOC_L5ck,65
|
11
|
-
analyser_hj3415-2.5.7.dist-info/LICENSE,sha256=QVKTp0dTnB5xG8RLgG17LwSWCKNEzYoVVM6KjoCPKc0,1079
|
12
|
-
analyser_hj3415-2.5.7.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
|
13
|
-
analyser_hj3415-2.5.7.dist-info/METADATA,sha256=l_xx2YDzz5xkau7LSHCl7EPWkikulO3f_3VDsh9RaZI,6417
|
14
|
-
analyser_hj3415-2.5.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|