analyser_hj3415 2.5.6__tar.gz → 2.6.0__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (22) hide show
  1. {analyser_hj3415-2.5.6 → analyser_hj3415-2.6.0}/PKG-INFO +1 -1
  2. {analyser_hj3415-2.5.6 → analyser_hj3415-2.6.0}/analyser_hj3415/analysers/eval.py +3 -5
  3. {analyser_hj3415-2.5.6 → analyser_hj3415-2.6.0}/analyser_hj3415/analysers/score.py +4 -6
  4. {analyser_hj3415-2.5.6 → analyser_hj3415-2.6.0}/analyser_hj3415/cli.py +7 -9
  5. {analyser_hj3415-2.5.6 → analyser_hj3415-2.6.0}/analyser_hj3415/myredis.py +7 -7
  6. {analyser_hj3415-2.5.6 → analyser_hj3415-2.6.0}/analyser_hj3415/tools.py +1 -0
  7. {analyser_hj3415-2.5.6 → analyser_hj3415-2.6.0}/pyproject.toml +1 -1
  8. {analyser_hj3415-2.5.6 → analyser_hj3415-2.6.0}/.DS_Store +0 -0
  9. {analyser_hj3415-2.5.6 → analyser_hj3415-2.6.0}/.gitattributes +0 -0
  10. {analyser_hj3415-2.5.6 → analyser_hj3415-2.6.0}/.gitignore +0 -0
  11. {analyser_hj3415-2.5.6 → analyser_hj3415-2.6.0}/.idea/.gitignore +0 -0
  12. {analyser_hj3415-2.5.6 → analyser_hj3415-2.6.0}/.idea/analyser-hj3415.iml +0 -0
  13. {analyser_hj3415-2.5.6 → analyser_hj3415-2.6.0}/.idea/inspectionProfiles/profiles_settings.xml +0 -0
  14. {analyser_hj3415-2.5.6 → analyser_hj3415-2.6.0}/.idea/misc.xml +0 -0
  15. {analyser_hj3415-2.5.6 → analyser_hj3415-2.6.0}/.idea/modules.xml +0 -0
  16. {analyser_hj3415-2.5.6 → analyser_hj3415-2.6.0}/.idea/vcs.xml +0 -0
  17. {analyser_hj3415-2.5.6 → analyser_hj3415-2.6.0}/LICENSE +0 -0
  18. {analyser_hj3415-2.5.6 → analyser_hj3415-2.6.0}/README.md +0 -0
  19. {analyser_hj3415-2.5.6 → analyser_hj3415-2.6.0}/analyser_hj3415/.DS_Store +0 -0
  20. {analyser_hj3415-2.5.6 → analyser_hj3415-2.6.0}/analyser_hj3415/__init__.py +0 -0
  21. {analyser_hj3415-2.5.6 → analyser_hj3415-2.6.0}/analyser_hj3415/analysers/report.py +0 -0
  22. {analyser_hj3415-2.5.6 → analyser_hj3415-2.6.0}/analyser_hj3415/trash.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: analyser_hj3415
3
- Version: 2.5.6
3
+ Version: 2.6.0
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
@@ -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,9 +41,7 @@ def red(code: str) -> dict:
41
41
  d6, 투자부동산 = c103q.latest_value_pop2('투자부동산')
42
42
 
43
43
  # 사업가치 계산 - 지배주주지분 당기순이익 / 기대수익률
44
- from analyser_hj3415 import cli
45
- EXPECT_EARN = utils.to_float(cli.AnalyserSettingsManager(cli.SETTINGS_FILE).get_value('EXPECT_EARN'))
46
- 사업가치 = round(utils.nan_to_zero(지배주주당기순이익) / EXPECT_EARN, 2)
44
+ 사업가치 = round(utils.nan_to_zero(지배주주당기순이익) / expect_earn, 2)
47
45
 
48
46
  # 재산가치 계산 - 유동자산 - (유동부채*1.2) + 고정자산중 투자자산
49
47
  재산가치 = round(유동자산 - (유동부채 * 1.2) + utils.nan_to_zero(투자자산) + utils.nan_to_zero(투자부동산), 2)
@@ -71,7 +69,7 @@ def red(code: str) -> dict:
71
69
  '재산가치': 재산가치,
72
70
  '부채평가': 부채평가,
73
71
  '발행주식수': 발행주식수,
74
- 'EXPECT_EARN': EXPECT_EARN,
72
+ 'EXPECT_EARN': expect_earn,
75
73
  'date': tools.set_data(d1, d2, d3, d4, d5, d6), # ''값을 제거하고 리스트로 바꾼다.
76
74
  }
77
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
- from analyser_hj3415 import cli
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
  # 이익지표 평가
@@ -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) -> 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
-
@@ -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에 캐싱
@@ -15,6 +15,7 @@ logger.setLevel(logging.WARNING)
15
15
  def set_data(*args) -> list:
16
16
  """
17
17
  비유효한 내용 제거(None,nan)하고 중복된 항목 제거하고 리스트로 반환한다.
18
+ 여기서 set의 의미는 집합을 뜻함
18
19
  :param args:
19
20
  :return:
20
21
  """
@@ -4,7 +4,7 @@ build-backend = "flit_core.buildapi"
4
4
 
5
5
  [project]
6
6
  name = "analyser_hj3415"
7
- version = "2.5.6"
7
+ version = "2.6.0"
8
8
  authors = [{name = "Hyungjin Kim", email = "hj3415@gmail.com"}]
9
9
  description = "Stock analyser and database processing programs"
10
10
  readme = "README.md"
File without changes