analyser_hj3415 4.0.2__py3-none-any.whl → 4.0.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -170,7 +170,7 @@ class MyProphet:
170
170
  mylogger.debug(forecast)
171
171
  return forecast
172
172
 
173
- mylogger.debug("Initializing data for MyProphet")
173
+ mylogger.info("Initializing data for MyProphet")
174
174
 
175
175
  self.scaler = StandardScaler()
176
176
  self.model = Prophet()
@@ -279,7 +279,8 @@ class MyProphet:
279
279
  f"redisname: '{redis_name}' / refresh : {refresh} / expire_time : {expire_time / 3600}h")
280
280
 
281
281
  def fetch_generate_prophet_chart_data() -> ProphetChartData:
282
- if self.initialized:
282
+ mylogger.debug(f'initialized: {self.initialized}')
283
+ if not self.initialized:
283
284
  self.initializing()
284
285
 
285
286
  # 날짜를 기준으로 합치기 (outer join)
@@ -294,7 +295,7 @@ class MyProphet:
294
295
  yhats=[{"x": ds, "y": yhat} for ds, yhat in zip(merged_df["ds"], merged_df["yhat"])], # type: ignore
295
296
  yhat_uppers=[{"x": ds, "y": yhat_upper} for ds, yhat_upper in zip(merged_df["ds"], merged_df["yhat_upper"])], # type: ignore
296
297
  yhat_lowers=[{"x": ds, "y": yhat_lower} for ds, yhat_lower in zip(merged_df["ds"], merged_df["yhat_lower"])], # type: ignore
297
- is_prophet_up=self.is_prophet_up(refresh=refresh),
298
+ is_prophet_up=tsa.common.is_up_by_OLS(self.df_forecast.set_index('ds')['yhat'].to_dict()),
298
299
  )
299
300
  return data
300
301
 
@@ -302,28 +303,6 @@ class MyProphet:
302
303
  timer=expire_time)
303
304
  return prophet_chart_data
304
305
 
305
- def is_prophet_up(self, refresh: bool) -> bool:
306
- """
307
- Prophet 예측이 상승 추세인지 여부를 확인합니다.
308
-
309
- 매개변수:
310
- refresh (bool): 데이터를 새로 생성할지 여부.
311
-
312
- 반환값:
313
- bool: 상승 추세 여부.
314
- """
315
- mylogger.debug("**** Caching is_prophet_up ... ****")
316
- redis_name = f'{self.ticker}_is_prophet_up'
317
- mylogger.info(f"redisname: '{redis_name}' / expire_time : {expire_time / 3600}h")
318
-
319
- def fetch_is_prophet_up():
320
- if self.initialized:
321
- self.initializing()
322
- yhat_dict = self.df_forecast.set_index('ds')['yhat'].to_dict()
323
- return tsa.common.is_up_by_OLS(yhat_dict)
324
-
325
- return myredis.Base.fetch_and_cache_data(redis_name, refresh, fetch_is_prophet_up, timer=expire_time)
326
-
327
306
  @staticmethod
328
307
  def is_valid_date(date_string):
329
308
  """
@@ -344,7 +323,7 @@ class MyProphet:
344
323
  return False
345
324
 
346
325
  @staticmethod
347
- def bulk_generate_latest_data(tickers: List[str], refresh: bool) -> Dict[str, ProphetLatestData]:
326
+ def bulk_get_latest_data(tickers: List[str], refresh: bool) -> Dict[str, ProphetLatestData]:
348
327
  # --- (1) 파이프라인 GET ---
349
328
  pipe = myredis.Base.redis_client.pipeline()
350
329
  redis_keys = [f"{ticker}_{MyProphet.REDIS_LATEST_DATA_SUFFIX}" for ticker in tickers]
@@ -428,7 +407,7 @@ class CorpProphet(MyProphet):
428
407
  mylogger.info("**** Start prophet ranking ... ****")
429
408
 
430
409
  data = {}
431
- for ticker, latest_data in MyProphet.bulk_generate_latest_data(
410
+ for ticker, latest_data in MyProphet.bulk_get_latest_data(
432
411
  [CorpProphet.code_to_ticker(code) for code in myredis.Corps.list_all_codes()], refresh=refresh).items():
433
412
  code = CorpProphet.ticker_to_code(ticker)
434
413
  score = latest_data.score
@@ -446,8 +425,8 @@ class CorpProphet(MyProphet):
446
425
  raise ValueError("top 인자는 'all' 이나 int형 이어야 합니다.")
447
426
 
448
427
  @staticmethod
449
- def bulk_generate_latest_data(codes: List[str], refresh: bool) -> Dict[str, ProphetLatestData]:
450
- return MyProphet.bulk_generate_latest_data([CorpProphet.code_to_ticker(code) for code in codes], refresh=refresh)
428
+ def bulk_get_latest_data(codes: List[str], refresh: bool) -> Dict[str, ProphetLatestData]:
429
+ return MyProphet.bulk_get_latest_data([CorpProphet.code_to_ticker(code) for code in codes], refresh=refresh)
451
430
 
452
431
 
453
432
  class MIProphet(MyProphet):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: analyser_hj3415
3
- Version: 4.0.2
3
+ Version: 4.0.4
4
4
  Summary: Stock analyser and database processing programs
5
5
  Requires-Python: >=3.6
6
6
  Description-Content-Type: text/markdown
@@ -10,8 +10,8 @@ analyser_hj3415/analyser/eval/red.py,sha256=b-Odud8pxQIO2NjI7m3HbK4FOND5WhaoYV94
10
10
  analyser_hj3415/analyser/tsa/__init__.py,sha256=pg20ZQRABedTdaIoOr5t043RNKtJ7ji_WmnZrD1IhPg,147
11
11
  analyser_hj3415/analyser/tsa/common.py,sha256=OnsZ_cFYmNzmk0tV5qSqVW-5jJyrwMWHguWdS2Z6fvY,979
12
12
  analyser_hj3415/analyser/tsa/lstm.py,sha256=55MV62jSPqdOw1zAk1zB7LacNDesPsrmcUwHqaCz6Gs,27974
13
- analyser_hj3415/analyser/tsa/prophet.py,sha256=dQ0g1pEv-ELugsg586w2yH0WJQQqr1zV_Wo7UXG_3WE,18337
14
- analyser_hj3415-4.0.2.dist-info/entry_points.txt,sha256=ZfjPnJuH8SzvhE9vftIPMBIofsc65IAWYOhqOC_L5ck,65
15
- analyser_hj3415-4.0.2.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82
16
- analyser_hj3415-4.0.2.dist-info/METADATA,sha256=Fk1VW_PXcF-9FA5YFahSiHC0164i0o0ExB5zrF19des,6777
17
- analyser_hj3415-4.0.2.dist-info/RECORD,,
13
+ analyser_hj3415/analyser/tsa/prophet.py,sha256=5ykwT6jaX_yzV3l_aHyby-QwLfxOMJaQjAfBpEEK46A,17572
14
+ analyser_hj3415-4.0.4.dist-info/entry_points.txt,sha256=ZfjPnJuH8SzvhE9vftIPMBIofsc65IAWYOhqOC_L5ck,65
15
+ analyser_hj3415-4.0.4.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82
16
+ analyser_hj3415-4.0.4.dist-info/METADATA,sha256=BHVuHK-W4aalJCs9uVE_ozlr-0y01SoilK9BIxMMUqE,6777
17
+ analyser_hj3415-4.0.4.dist-info/RECORD,,