analyser_hj3415 2.4.0__py2.py3-none-any.whl → 2.5.1__py2.py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
analyser_hj3415/cli.py CHANGED
@@ -3,9 +3,10 @@ from utils_hj3415 import noti
3
3
 
4
4
 
5
5
  def analyser():
6
- from analyser_hj3415.myredis import red_ranking
6
+ from analyser_hj3415.myredis import red_ranking, mil_n_score
7
7
  commands = {
8
- 'ranking': red_ranking
8
+ 'ranking': red_ranking,
9
+ 'mil': mil_n_score,
9
10
  }
10
11
  parser = argparse.ArgumentParser()
11
12
  parser.add_argument('command', help=f"Commands - {commands.keys()}")
@@ -17,7 +18,14 @@ def analyser():
17
18
  if args.command == 'ranking':
18
19
  print(commands['ranking']())
19
20
  if args.noti:
20
- noti.telegram_to('manager', "오늘의 red ranking을 저장했습니다.(유효 12시간)")
21
+ noti.telegram_to('manager', "오늘의 red ranking을 레디스캐시에 저장했습니다.(유효 12시간)")
22
+ elif args.command == 'mil':
23
+ print("**** mil_n_score ****")
24
+ for code, _ in red_ranking().items():
25
+ print("<<<<< ", code, ">>>>>")
26
+ print(commands['mil'](code))
27
+ if args.noti:
28
+ noti.telegram_to('manager', "오늘의 mil and score를 레디스캐시에 저장했습니다.(유효 12시간)")
21
29
  else:
22
30
  print(f"The command should be in {list(commands.keys())}")
23
31
 
@@ -23,10 +23,10 @@ def red_ranking() -> OrderedDict:
23
23
  # redis에 해당하는 값이 없는 경우
24
24
  data = {}
25
25
  for i, code in enumerate(db_myredis.Corps.list_all_codes()):
26
- s = score.red(code)
27
- if s <= 0:
26
+ red_score = score.red(code)
27
+ if red_score <= 0:
28
28
  continue
29
- data[code] = s
29
+ data[code] = red_score
30
30
  # print(i, code, s)
31
31
 
32
32
  # print(data)
@@ -39,14 +39,11 @@ def red_ranking() -> OrderedDict:
39
39
  # ordereddict를 이용해서 딕셔너리의 값을 기준으로 내림차순 정렬함.
40
40
  return OrderedDict(sorted(data.items(), key=lambda item: item[1], reverse=True))
41
41
  else:
42
- print(f"Redis 캐시에서 데이터 가져오기(남은시간:{round(Base.redis_client.ttl(redis_name)/3600,1)}시간) - myredis.red_ranking")
42
+ print(f"Redis 캐시에서 데이터 가져오기(남은시간:{round(Base.redis_client.ttl(redis_name)/3600, 1)}시간) - myredis.red_ranking")
43
43
  # ordereddict를 이용해서 딕셔너리의 값을 기준으로 내림차순 정렬함.
44
44
  return OrderedDict(sorted(json.loads(cached_data).items(), key=lambda item: item[1], reverse=True))
45
45
 
46
46
 
47
-
48
-
49
-
50
47
  def red_n_score(code: str) -> dict:
51
48
  """
52
49
  redis 사용 - 소멸타이머 사용
@@ -71,12 +68,12 @@ def red_n_score(code: str) -> dict:
71
68
  if data:
72
69
  # 데이터를 Redis에 캐싱
73
70
  Base.redis_client.set(redis_name, json.dumps(data))
74
- # 60분후 키가 자동으로 제거됨
75
- Base.redis_client.expire(redis_name, 3600)
71
+ # 12시간 키가 자동으로 제거됨
72
+ Base.redis_client.expire(redis_name, 3600 * 12)
76
73
  print("analysers.eval 데이터 계산하기 - myredis.red")
77
74
  return data
78
75
  else:
79
- print(f"Redis 캐시에서 데이터 가져오기(남은시간:{Base.redis_client.ttl(redis_name)}) - myredis.red")
76
+ print(f"Redis 캐시에서 데이터 가져오기(남은시간:{round(Base.redis_client.ttl(redis_name)/3600, 1)}시간) - myredis.red")
80
77
  return json.loads(cached_data)
81
78
 
82
79
 
@@ -127,12 +124,12 @@ def mil_n_score(code: str) -> dict:
127
124
  if data:
128
125
  # 데이터를 Redis에 캐싱
129
126
  Base.redis_client.set(redis_name, json.dumps(data))
130
- # 60분후 키가 자동으로 제거됨
131
- Base.redis_client.expire(redis_name, 3600)
127
+ # 12시간 키가 자동으로 제거됨
128
+ Base.redis_client.expire(redis_name, 3600 * 12)
132
129
  print("analysers.eval 데이터 계산하기 - myredis.mil")
133
130
  return data
134
131
  else:
135
- print(f"Redis 캐시에서 데이터 가져오기(남은시간:{Base.redis_client.ttl(redis_name)}) - myredis.mil")
132
+ print(f"Redis 캐시에서 데이터 가져오기(남은시간:{round(Base.redis_client.ttl(redis_name)/3600, 1)}시간) - myredis.mil")
136
133
  return json.loads(cached_data)
137
134
 
138
135
 
@@ -179,12 +176,12 @@ def blue_n_score(code: str) -> dict:
179
176
  if data:
180
177
  # 데이터를 Redis에 캐싱
181
178
  Base.redis_client.set(redis_name, json.dumps(data))
182
- # 60분후 키가 자동으로 제거됨
183
- Base.redis_client.expire(redis_name, 3600)
179
+ # 12시간 키가 자동으로 제거됨
180
+ Base.redis_client.expire(redis_name, 3600 * 12)
184
181
  print("analysers.eval 데이터 계산하기 - myredis.blue")
185
182
  return data
186
183
  else:
187
- print(f"Redis 캐시에서 데이터 가져오기(남은시간:{Base.redis_client.ttl(redis_name)}) - myredis.blue")
184
+ print(f"Redis 캐시에서 데이터 가져오기(남은시간:{round(Base.redis_client.ttl(redis_name)/3600, 1)}시간) - myredis.blue")
188
185
  return json.loads(cached_data)
189
186
 
190
187
 
@@ -212,10 +209,10 @@ def growth_n_score(code: str) -> dict:
212
209
  if data:
213
210
  # 데이터를 Redis에 캐싱
214
211
  Base.redis_client.set(redis_name, json.dumps(data))
215
- # 60분후 키가 자동으로 제거됨
216
- Base.redis_client.expire(redis_name, 3600)
212
+ # 12시간 키가 자동으로 제거됨
213
+ Base.redis_client.expire(redis_name, 3600 * 12)
217
214
  print("analysers.eval 데이터 계산하기 - myredis.growth")
218
215
  return data
219
216
  else:
220
- print(f"Redis 캐시에서 데이터 가져오기(남은시간:{Base.redis_client.ttl(redis_name)}) - myredis.growth")
217
+ print(f"Redis 캐시에서 데이터 가져오기(남은시간:{round(Base.redis_client.ttl(redis_name)/3600, 1)}시간) - myredis.growth")
221
218
  return json.loads(cached_data)
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.4.0
3
+ Version: 2.5.1
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
8
  Requires-Dist: utils-hj3415>=2.6.1
9
- Requires-Dist: db-hj3415>=3.4.0
9
+ Requires-Dist: db-hj3415>=3.6.10
10
10
  Project-URL: Home, https://www.hyungjin.kr
11
11
 
12
12
  ### analyser-hj3415
@@ -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=NKE69OV8_G0HcBHnX_cM1Zr3-AmxyR7rX1kPv5cVT3o,1188
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=DIuy0jsF5zP2I26rDeGoeguqw3yvgud-3Pr6argDnYc,13310
8
+ analyser_hj3415/analysers/report.py,sha256=yY-AeDHOqDPrm4lpvZv3NPTJK1Z7lKsjoO5ck8AP6u4,9007
9
+ analyser_hj3415/analysers/score.py,sha256=tyc1NA_0K7b2mjTTMdJVH_OlqBAqAMrcPOvWPYFudfg,15853
10
+ analyser_hj3415-2.5.1.dist-info/entry_points.txt,sha256=vBiMpIhNh39VC3UPwgxQNPb54N8vMlr4g0zRcCOjPyo,57
11
+ analyser_hj3415-2.5.1.dist-info/LICENSE,sha256=QVKTp0dTnB5xG8RLgG17LwSWCKNEzYoVVM6KjoCPKc0,1079
12
+ analyser_hj3415-2.5.1.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
13
+ analyser_hj3415-2.5.1.dist-info/METADATA,sha256=mzmkIj7wOg2PFLxe0CVJWFq2AofzlUONCM-urpdyE7o,6418
14
+ analyser_hj3415-2.5.1.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=fDLGwz5x_5Gy4yCkz1cNbhC3BhkYNZ1IqKglcGRvsu4,750
4
- analyser_hj3415/myredis.py,sha256=i6o61be2qv41boVEM1mQG5QNCELr5zSq9mH1csVfUx8,10628
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.4.0.dist-info/entry_points.txt,sha256=vBiMpIhNh39VC3UPwgxQNPb54N8vMlr4g0zRcCOjPyo,57
11
- analyser_hj3415-2.4.0.dist-info/LICENSE,sha256=QVKTp0dTnB5xG8RLgG17LwSWCKNEzYoVVM6KjoCPKc0,1079
12
- analyser_hj3415-2.4.0.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
13
- analyser_hj3415-2.4.0.dist-info/METADATA,sha256=UiSrI8LK1WK8WWhrIqxcY6tAC0B4_ks-7eg3HI3m498,6417
14
- analyser_hj3415-2.4.0.dist-info/RECORD,,