analyser_hj3415 2.9.5__tar.gz → 2.9.7__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: analyser_hj3415
3
- Version: 2.9.5
3
+ Version: 2.9.7
4
4
  Summary: Stock analyser and database processing programs
5
5
  Requires-Python: >=3.6
6
6
  Description-Content-Type: text/markdown
@@ -55,7 +55,13 @@ def analyser_manager():
55
55
  # caching 파서
56
56
  caching_parser = lstm_subparser.add_parser('caching', help='lstm 랭킹 책정 및 레디스 저장')
57
57
  caching_parser.add_argument('-r', '--refresh', action='store_true', help='래디스 캐시를 사용하지 않고 강제로 재계산 할지')
58
+ caching_parser.add_argument('-t', '--top', type=int, help='prophet ranking 몇위까지 작업을 할지')
58
59
  caching_parser.add_argument('-n', '--noti', action='store_true', help='작업 완료 후 메시지 전송 여부')
60
+ # red - get 파서
61
+ lstm_get_parser = lstm_subparser.add_parser('get', help='lstm get 책정 및 레디스 저장')
62
+ lstm_get_parser.add_argument('code', type=str, help='종목코드')
63
+ lstm_get_parser.add_argument('-r', '--refresh', action='store_true', help='래디스 캐시를 사용하지 않고 강제로 재계산 할지')
64
+ lstm_get_parser.add_argument('-n', '--noti', action='store_true', help='작업 완료 후 메시지 전송 여부')
59
65
 
60
66
  # red 명령어 서브파서
61
67
  red_parser = type_subparsers.add_parser('red', help='red 타입')
@@ -219,9 +225,17 @@ def analyser_manager():
219
225
  noti.telegram_to('manager', "오늘의 prophet ranking을 레디스캐시에 저장했습니다.(유효 24시간)")
220
226
  elif args.type == 'lstm':
221
227
  if args.command == 'caching':
222
- result = tsa.MyLSTM('005930').caching_based_on_prophet_ranking(refresh=args.refresh)
228
+ if args.top:
229
+ tsa.MyLSTM.caching_based_on_prophet_ranking(refresh=args.refresh, top=args.top)
230
+ else:
231
+ tsa.MyLSTM.caching_based_on_prophet_ranking(refresh=args.refresh)
232
+ if args.noti:
233
+ noti.telegram_to('manager', f"오늘의 lstm caching(top={args.top if args.top else 20})을 레디스캐시에 저장했습니다.(유효 24시간)")
234
+ elif args.command == 'get':
235
+ assert utils.is_6digit(args.code), "code 인자는 6자리 숫자이어야 합니다."
236
+ result = tsa.MyLSTM(args.code).get_final_predictions(refresh=args.refresh)
223
237
  if args.noti:
224
- noti.telegram_to('manager', "오늘의 lstm caching을 레디스캐시에 저장했습니다.(유효 24시간)")
238
+ noti.telegram_to('manager', f"LSTM 분석을({args.code})를 레디스 캐시에 저장했습니다.(유효 12시간)")
225
239
  elif args.type == 'setting':
226
240
  if args.command == 'set':
227
241
  settings_manager.set_value(args.title, args.value)
@@ -661,14 +661,16 @@ class MyLSTM:
661
661
  plt.title('Stock Price Prediction with LSTM Ensemble')
662
662
  plt.show()"""
663
663
 
664
- def caching_based_on_prophet_ranking(self, refresh: bool, top=20):
664
+ @staticmethod
665
+ def caching_based_on_prophet_ranking(refresh: bool, top=20):
665
666
  ranking_topn = OrderedDict(itertools.islice(MyProphet.ranking().items(), top))
666
667
  tsa_logger.info(ranking_topn)
668
+ mylstm = MyLSTM('005930')
667
669
  print(f"*** LSTM prediction redis cashing top{top} items ***")
668
670
  for i, (code, _) in enumerate(ranking_topn.items()):
669
- print(f"{i+1}. {self.code}/{self.name}")
670
- self.code = code
671
- self.get_final_predictions(refresh=refresh, num=5)
671
+ mylstm.code = code
672
+ print(f"{i+1}. {mylstm.code}/{mylstm.name}")
673
+ mylstm.get_final_predictions(refresh=refresh, num=5)
672
674
 
673
675
 
674
676
 
@@ -5,7 +5,7 @@ build-backend = "flit_core.buildapi"
5
5
 
6
6
  [project]
7
7
  name = "analyser_hj3415"
8
- version = "2.9.5"
8
+ version = "2.9.7"
9
9
  description = "Stock analyser and database processing programs"
10
10
  readme = "README.md"
11
11
  requires-python = ">=3.6"