analyser_hj3415 3.3.0__py3-none-any.whl → 3.3.1__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.
@@ -11,9 +11,20 @@ from analyser_hj3415.analyser import tsa, eval, MIs
11
11
  mylogger = setup_logger(__name__,'WARNING')
12
12
  expire_time = tools.to_int(os.getenv('DEFAULT_EXPIRE_TIME_H', 48)) * 3600
13
13
 
14
-
15
14
  @dataclass
16
15
  class MICompileData:
16
+ """
17
+ MI(Market Index) 데이터를 컴파일하여 저장하는 데이터 클래스.
18
+
19
+ 속성:
20
+ mi_type (str): 시장 지수 유형.
21
+ prophet_data (tsa.ProphetData): Prophet 예측 데이터.
22
+ lstm_grade (tsa.LSTMGrade): LSTM 등급 데이터.
23
+ is_lstm_up (bool): LSTM 상승 여부.
24
+ is_prophet_up (bool): Prophet 상승 여부.
25
+ lstm_html (str): LSTM 시각화 HTML.
26
+ prophet_html (str): Prophet 시각화 HTML.
27
+ """
17
28
  mi_type: str
18
29
 
19
30
  prophet_data: tsa.ProphetData
@@ -27,20 +38,57 @@ class MICompileData:
27
38
 
28
39
 
29
40
  class MICompile:
41
+ """
42
+ MI(Market Index) 데이터를 컴파일하는 클래스.
43
+
44
+ 메서드:
45
+ get(refresh=False) -> MICompileData:
46
+ MI 데이터를 컴파일하거나 캐시에서 가져옵니다.
47
+
48
+ analyser_lstm_all_mi(refresh: bool):
49
+ 모든 MI에 대해 LSTM 예측 및 초기화 수행.
50
+ """
30
51
  def __init__(self, mi_type: str):
52
+ """
53
+ MICompile 객체를 초기화합니다.
54
+
55
+ 매개변수:
56
+ mi_type (str): 시장 지수 유형.
57
+ """
31
58
  assert mi_type in MIs._fields, f"Invalid MI type ({MIs._fields})"
32
59
  self._mi_type = mi_type
33
60
 
34
61
  @property
35
62
  def mi_type(self) -> str:
63
+ """
64
+ MI 유형을 반환합니다.
65
+
66
+ 반환값:
67
+ str: MI 유형.
68
+ """
36
69
  return self._mi_type
37
70
 
38
71
  @mi_type.setter
39
72
  def mi_type(self, mi_type: str):
73
+ """
74
+ MI 유형을 변경합니다.
75
+
76
+ 매개변수:
77
+ mi_type (str): 새로 설정할 MI 유형.
78
+ """
40
79
  assert mi_type in MIs._fields, f"Invalid MI type ({MIs._fields})"
41
80
  self._mi_type = mi_type
42
81
 
43
82
  def get(self, refresh=False) -> MICompileData:
83
+ """
84
+ MI 데이터를 컴파일하거나 캐시에서 가져옵니다.
85
+
86
+ 매개변수:
87
+ refresh (bool): 데이터를 새로 가져올지 여부.
88
+
89
+ 반환값:
90
+ MICompileData: 컴파일된 MI 데이터.
91
+ """
44
92
  print(f"{self.mi_type}의 compiling을 시작합니다.")
45
93
  redis_name = self.mi_type + '_mi_compile'
46
94
  print(
@@ -66,6 +114,12 @@ class MICompile:
66
114
 
67
115
  @staticmethod
68
116
  def analyser_lstm_all_mi(refresh: bool):
117
+ """
118
+ 모든 MI(Market Index)에 대해 LSTM 예측과 초기화를 수행합니다.
119
+
120
+ 매개변수:
121
+ refresh (bool): 데이터를 새로 가져올지 여부.
122
+ """
69
123
  mi_lstm = tsa.MILSTM('WTI')
70
124
  print(f"*** LSTM prediction redis cashing Market Index items ***")
71
125
  for mi_type in MIs._fields:
@@ -74,9 +128,23 @@ class MICompile:
74
128
  mi_lstm.initializing()
75
129
  mi_lstm.get_final_predictions(refresh=refresh, num=5)
76
130
 
77
-
78
131
  @dataclass
79
132
  class CorpCompileData:
133
+ """
134
+ 기업 데이터를 컴파일하여 저장하는 데이터 클래스.
135
+
136
+ 속성:
137
+ code (str): 기업 코드.
138
+ name (str): 기업 이름.
139
+ red_data (eval.RedData): RED 분석 데이터.
140
+ mil_data (eval.MilData): MIL 분석 데이터.
141
+ prophet_data (tsa.ProphetData): Prophet 예측 데이터.
142
+ lstm_grade (tsa.LSTMGrade): LSTM 등급 데이터.
143
+ is_lstm_up (bool): LSTM 상승 여부.
144
+ is_prophet_up (bool): Prophet 상승 여부.
145
+ lstm_html (str): LSTM 시각화 HTML.
146
+ prophet_html (str): Prophet 시각화 HTML.
147
+ """
80
148
  code: str
81
149
  name: str
82
150
 
@@ -94,22 +162,66 @@ class CorpCompileData:
94
162
 
95
163
 
96
164
  class CorpCompile:
165
+ """
166
+ 기업 데이터를 컴파일하는 클래스.
167
+
168
+ 메서드:
169
+ get(refresh=False) -> CorpCompileData:
170
+ 기업 데이터를 컴파일하거나 캐시에서 가져옵니다.
171
+
172
+ red_ranking(expect_earn: float = 0.06, refresh=False) -> OrderedDict:
173
+ RED 데이터를 기반으로 기업 순위를 계산합니다.
174
+
175
+ prophet_ranking(refresh=False, top: Union[int, str]='all') -> OrderedDict:
176
+ Prophet 데이터를 기반으로 기업 순위를 계산합니다.
177
+
178
+ analyse_lstm_topn(refresh: bool, top=40):
179
+ 상위 N개의 기업에 대해 LSTM 예측 수행.
180
+ """
97
181
  def __init__(self, code: str, expect_earn=0.06):
182
+ """
183
+ CorpCompile 객체를 초기화합니다.
184
+
185
+ 매개변수:
186
+ code (str): 기업 코드.
187
+ expect_earn (float, optional): 예상 수익률. 기본값은 0.06.
188
+ """
98
189
  assert tools.is_6digit(code), f'Invalid value : {code}'
99
190
  self._code = code
100
191
  self.expect_earn = expect_earn
101
192
 
102
193
  @property
103
194
  def code(self) -> str:
195
+ """
196
+ 기업 코드를 반환합니다.
197
+
198
+ 반환값:
199
+ str: 기업 코드.
200
+ """
104
201
  return self._code
105
202
 
106
203
  @code.setter
107
204
  def code(self, code: str):
205
+ """
206
+ 기업 코드를 변경합니다.
207
+
208
+ 매개변수:
209
+ code (str): 새로 설정할 기업 코드.
210
+ """
108
211
  assert tools.is_6digit(code), f'Invalid value : {code}'
109
212
  mylogger.info(f'change code : {self.code} -> {code}')
110
213
  self._code = code
111
214
 
112
- def get(self, refresh=False) -> dict:
215
+ def get(self, refresh=False) -> CorpCompileData:
216
+ """
217
+ 기업 데이터를 컴파일하거나 캐시에서 가져옵니다.
218
+
219
+ 매개변수:
220
+ refresh (bool): 데이터를 새로 가져올지 여부.
221
+
222
+ 반환값:
223
+ CorpCompileData: 컴파일된 기업 데이터.
224
+ """
113
225
  print(f"{self.code}의 compiling을 시작합니다.")
114
226
  redis_name = self.code + '_corp_compile'
115
227
  print(
@@ -139,11 +251,19 @@ class CorpCompile:
139
251
 
140
252
  @staticmethod
141
253
  def red_ranking(expect_earn: float = 0.06, refresh=False) -> OrderedDict:
142
- # 이전 expect earn 과 비교하여 다르거나 없으면 강제 refresh 설정
254
+ """
255
+ RED 데이터를 기반으로 기업 순위를 계산합니다.
256
+
257
+ 매개변수:
258
+ expect_earn (float, optional): 예상 수익률. 기본값은 0.06.
259
+ refresh (bool): 데이터를 새로 가져올지 여부.
260
+
261
+ 반환값:
262
+ OrderedDict: RED 점수를 기준으로 정렬된 기업 순위.
263
+ """
143
264
  redis_name = 'red_ranking_prev_expect_earn'
144
265
  pee = tools.to_float(myredis.Base.get_value(redis_name))
145
266
  if pee != expect_earn:
146
- # expect earn의 이전 계산값이 없거나 이전 값과 다르면 새로 계산
147
267
  mylogger.warning(
148
268
  f"expect earn : {expect_earn} / prev expect earn : {pee} 두 값이 달라 refresh = True"
149
269
  )
@@ -172,7 +292,16 @@ class CorpCompile:
172
292
 
173
293
  @staticmethod
174
294
  def prophet_ranking(refresh=False, top: Union[int, str]='all') -> OrderedDict:
295
+ """
296
+ Prophet 데이터를 기반으로 기업 순위를 계산합니다.
175
297
 
298
+ 매개변수:
299
+ refresh (bool): 데이터를 새로 가져올지 여부.
300
+ top (Union[int, str], optional): 상위 기업 개수. 'all'이면 전체 반환. 기본값은 'all'.
301
+
302
+ 반환값:
303
+ OrderedDict: Prophet 점수를 기준으로 정렬된 기업 순위.
304
+ """
176
305
  print("**** Start Compiling scores and sorting... ****")
177
306
  redis_name = 'prophet_ranking'
178
307
 
@@ -195,7 +324,6 @@ class CorpCompile:
195
324
 
196
325
  data_dict = myredis.Base.fetch_and_cache_data(redis_name, refresh, fetch_prophet_ranking, timer=expire_time)
197
326
 
198
- # prophet_score를 기준으로 정렬
199
327
  ranking = OrderedDict(sorted(data_dict.items(), key=lambda x: x[1], reverse=True))
200
328
 
201
329
  if top == 'all':
@@ -208,6 +336,13 @@ class CorpCompile:
208
336
 
209
337
  @staticmethod
210
338
  def analyse_lstm_topn(refresh: bool, top=40):
339
+ """
340
+ 상위 N개의 기업에 대해 LSTM 예측을 수행합니다.
341
+
342
+ 매개변수:
343
+ refresh (bool): 데이터를 새로 가져올지 여부.
344
+ top (int, optional): 상위 기업 개수. 기본값은 40.
345
+ """
211
346
  ranking_topn = CorpCompile.prophet_ranking(refresh=False, top=top)
212
347
  mylogger.info(ranking_topn)
213
348
  corp_lstm = tsa.CorpLSTM('005930')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: analyser_hj3415
3
- Version: 3.3.0
3
+ Version: 3.3.1
4
4
  Summary: Stock analyser and database processing programs
5
5
  Requires-Python: >=3.6
6
6
  Description-Content-Type: text/markdown
@@ -1,7 +1,7 @@
1
1
  analyser_hj3415/__init__.py,sha256=jqHEUoBeihYOMaS0bPOe3nRVXBufZ0clxc6M6jxPY0o,320
2
2
  analyser_hj3415/cli.py,sha256=rn9feZcUpgIXM8JX0OsNCKy9oZauMnEcNKR38sSQfds,12017
3
3
  analyser_hj3415/analyser/__init__.py,sha256=N0XyBfWJNpDS_6JYziKETWePO_jtFB1m7E8Qbwt1w0Q,1096
4
- analyser_hj3415/analyser/compile.py,sha256=_zOxWfBSLGv2QuKqL2LR-OS97JzXvkZfSSrpuRLU48c,8037
4
+ analyser_hj3415/analyser/compile.py,sha256=xumUdFxcBWPqiT0fLzl7ZP6Sx0Vj3uThPTMOJcjfeUE,12513
5
5
  analyser_hj3415/analyser/eval/__init__.py,sha256=IP1d0Q3nOCAD3zK1qxrC685MkJQfUh-qaXc7xptTxk8,80
6
6
  analyser_hj3415/analyser/eval/blue.py,sha256=p9_ddqLMJGq5HSn6NApuLhrX29qD--AASig9F71eb8I,10952
7
7
  analyser_hj3415/analyser/eval/common.py,sha256=sNXapoofShA43ww_SLjXmIjkrAr1AhAcezdaN_X_3Us,11443
@@ -17,7 +17,7 @@ analyser_hj3415/workroom/mysklearn.py,sha256=wJXKz5MqqTzADdG2mqRMMzc_G9RzwYjj5_j
17
17
  analyser_hj3415/workroom/mysklearn2.py,sha256=1lIy6EWEQHkOzDS-av8U0zQH6DuCLKWMI73dnJx5KRs,1495
18
18
  analyser_hj3415/workroom/score.py,sha256=P6nHBJYmyhigGtT4qna4BmNtvt4B93b7SKyzdstJK24,17376
19
19
  analyser_hj3415/workroom/trash.py,sha256=zF-W0piqkGr66UP6-iybo9EXh2gO0RP6R1FnIpsGkl8,12262
20
- analyser_hj3415-3.3.0.dist-info/entry_points.txt,sha256=ZfjPnJuH8SzvhE9vftIPMBIofsc65IAWYOhqOC_L5ck,65
21
- analyser_hj3415-3.3.0.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82
22
- analyser_hj3415-3.3.0.dist-info/METADATA,sha256=oQXcQ45N87lL1UNCjceZWvAsgbzOKoL2m06iIM3cOvE,6777
23
- analyser_hj3415-3.3.0.dist-info/RECORD,,
20
+ analyser_hj3415-3.3.1.dist-info/entry_points.txt,sha256=ZfjPnJuH8SzvhE9vftIPMBIofsc65IAWYOhqOC_L5ck,65
21
+ analyser_hj3415-3.3.1.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82
22
+ analyser_hj3415-3.3.1.dist-info/METADATA,sha256=fkHlNPU6RQq-I-oxqzDi1vb7C0nFH6UNg0AbQ6SyWfw,6777
23
+ analyser_hj3415-3.3.1.dist-info/RECORD,,