analyser_hj3415 2.9.7__tar.gz → 2.9.8__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: analyser_hj3415
3
- Version: 2.9.7
3
+ Version: 2.9.8
4
4
  Summary: Stock analyser and database processing programs
5
5
  Requires-Python: >=3.6
6
6
  Description-Content-Type: text/markdown
@@ -219,23 +219,27 @@ def analyser_manager():
219
219
  noti.telegram_to('manager', f"오늘의 Growth({args.code})를 레디스 캐시에 저장했습니다.(유효 12시간)")
220
220
  elif args.type == 'prophet':
221
221
  if args.command == 'ranking':
222
- result = tsa.MyProphet.ranking(refresh=args.refresh)
222
+ myprophet = tsa.MyProphet
223
+ myprophet.expire_time_h = 72
224
+ result = myprophet.ranking(refresh=args.refresh)
223
225
  print(result)
224
226
  if args.noti:
225
- noti.telegram_to('manager', "오늘의 prophet ranking을 레디스캐시에 저장했습니다.(유효 24시간)")
227
+ noti.telegram_to('manager', f"오늘의 prophet ranking을 레디스캐시에 저장했습니다.(유효 {myprophet.expire_time_h}시간)")
226
228
  elif args.type == 'lstm':
229
+ mylstm = tsa.MyLSTM
230
+ mylstm.expire_time_h = 72
227
231
  if args.command == 'caching':
228
232
  if args.top:
229
- tsa.MyLSTM.caching_based_on_prophet_ranking(refresh=args.refresh, top=args.top)
233
+ mylstm.caching_based_on_prophet_ranking(refresh=args.refresh, top=args.top)
230
234
  else:
231
- tsa.MyLSTM.caching_based_on_prophet_ranking(refresh=args.refresh)
235
+ mylstm.caching_based_on_prophet_ranking(refresh=args.refresh)
232
236
  if args.noti:
233
- noti.telegram_to('manager', f"오늘의 lstm caching(top={args.top if args.top else 20})을 레디스캐시에 저장했습니다.(유효 24시간)")
237
+ noti.telegram_to('manager', f"오늘의 lstm caching(top={args.top if args.top else 20})을 레디스캐시에 저장했습니다.(유효 {mylstm.expire_time_h}시간)")
234
238
  elif args.command == 'get':
235
239
  assert utils.is_6digit(args.code), "code 인자는 6자리 숫자이어야 합니다."
236
- result = tsa.MyLSTM(args.code).get_final_predictions(refresh=args.refresh)
240
+ result = mylstm(args.code).get_final_predictions(refresh=args.refresh)
237
241
  if args.noti:
238
- noti.telegram_to('manager', f"LSTM 분석을({args.code})를 레디스 캐시에 저장했습니다.(유효 12시간)")
242
+ noti.telegram_to('manager', f"LSTM 분석을({args.code})를 레디스 캐시에 저장했습니다.(유효 {mylstm.expire_time_h}시간)")
239
243
  elif args.type == 'setting':
240
244
  if args.command == 'set':
241
245
  settings_manager.set_value(args.title, args.value)
@@ -33,6 +33,7 @@ tsa_logger = helpers.setup_logger('tsa_logger', logging.WARNING)
33
33
  expire_time = 3600 * 24
34
34
 
35
35
  class MyProphet:
36
+ expire_time_h = 24
36
37
  def __init__(self, code: str):
37
38
  assert utils.is_6digit(code), f'Invalid value : {code}'
38
39
  self.scaler = StandardScaler()
@@ -204,7 +205,7 @@ class MyProphet:
204
205
  redis_name = 'myprophet_ranking'
205
206
 
206
207
  print(
207
- f"redisname: '{redis_name}' / refresh : {refresh} / expire_time : {expire_time / 3600}h")
208
+ f"redisname: '{redis_name}' / refresh : {refresh} / expire_time : {MyProphet.expire_time_h}h")
208
209
 
209
210
  def fetch_ranking() -> dict:
210
211
  data = {}
@@ -223,7 +224,7 @@ class MyProphet:
223
224
  print(f"{i}.{p.code}/{p.name} date: {recent_date} 가격:{recent_price} 기대하한값:{yhat_lower} 편차:{deviation}")
224
225
  return data
225
226
 
226
- data_dict = myredis.Base.fetch_and_cache_data(redis_name, refresh, fetch_ranking, timer=expire_time)
227
+ data_dict = myredis.Base.fetch_and_cache_data(redis_name, refresh, fetch_ranking, timer=MyProphet.expire_time_h * 3600)
227
228
 
228
229
  return OrderedDict(sorted(data_dict.items(), key=lambda item: item[1], reverse=True))
229
230
 
@@ -264,6 +265,7 @@ class MyLSTM:
264
265
  """
265
266
  # 미래 몇일을 예측할 것인가?
266
267
  future_days = 30
268
+ expire_time_h = 24
267
269
 
268
270
  def __init__(self, code: str):
269
271
  assert utils.is_6digit(code), f'Invalid value : {code}'
@@ -498,7 +500,7 @@ class MyLSTM:
498
500
  redis_name = f'{self.code}_mylstm_predictions'
499
501
 
500
502
  print(
501
- f"redisname: '{redis_name}' / refresh : {refresh} / expire_time : {expire_time / 3600}h")
503
+ f"redisname: '{redis_name}' / refresh : {refresh} / expire_time : {MyLSTM.expire_time_h}h")
502
504
 
503
505
  def fetch_final_predictions(num_in) -> tuple:
504
506
  """
@@ -529,7 +531,7 @@ class MyLSTM:
529
531
 
530
532
  return future_dates_str, final_future_predictions.tolist()
531
533
 
532
- future_dates_str, final_future_predictions = myredis.Base.fetch_and_cache_data(redis_name, refresh, fetch_final_predictions, num, timer=expire_time)
534
+ future_dates_str, final_future_predictions = myredis.Base.fetch_and_cache_data(redis_name, refresh, fetch_final_predictions, num, timer=MyLSTM.expire_time_h * 3600)
533
535
 
534
536
  # 문자열을 날짜 형식으로 변환
535
537
  future_dates = [datetime.strptime(date, '%Y-%m-%d') for date in future_dates_str]
@@ -5,7 +5,7 @@ build-backend = "flit_core.buildapi"
5
5
 
6
6
  [project]
7
7
  name = "analyser_hj3415"
8
- version = "2.9.7"
8
+ version = "2.9.8"
9
9
  description = "Stock analyser and database processing programs"
10
10
  readme = "README.md"
11
11
  requires-python = ">=3.6"