analyser_hj3415 2.8.0__py2.py3-none-any.whl → 2.8.2__py2.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.
- analyser_hj3415/cli.py +9 -0
- analyser_hj3415/tsa.py +9 -6
- analyser_hj3415/workroom/lstm.py +2 -0
- {analyser_hj3415-2.8.0.dist-info → analyser_hj3415-2.8.2.dist-info}/METADATA +1 -1
- {analyser_hj3415-2.8.0.dist-info → analyser_hj3415-2.8.2.dist-info}/RECORD +8 -8
- {analyser_hj3415-2.8.0.dist-info → analyser_hj3415-2.8.2.dist-info}/LICENSE +0 -0
- {analyser_hj3415-2.8.0.dist-info → analyser_hj3415-2.8.2.dist-info}/WHEEL +0 -0
- {analyser_hj3415-2.8.0.dist-info → analyser_hj3415-2.8.2.dist-info}/entry_points.txt +0 -0
analyser_hj3415/cli.py
CHANGED
@@ -41,6 +41,15 @@ def analyser_manager():
|
|
41
41
|
parser = argparse.ArgumentParser(description="Analyser Commands")
|
42
42
|
type_subparsers = parser.add_subparsers(dest='type', help='분석 타입')
|
43
43
|
|
44
|
+
# tsa 명령어 서브파서
|
45
|
+
tsa_parser = type_subparsers.add_parser('tsa', help='Time serial analysis 타입')
|
46
|
+
tsa_subparser = tsa_parser.add_subparsers(dest='command', help='tsa 관련된 명령')
|
47
|
+
# red - ranking 파서
|
48
|
+
ranking_parser = red_subparser.add_parser('ranking', help='red 랭킹 책정 및 레디스 저장')
|
49
|
+
ranking_parser.add_argument('-e', '--expect_earn', type=float, help='기대수익률 (실수 값 입력)')
|
50
|
+
ranking_parser.add_argument('-r', '--refresh', action='store_true', help='래디스 캐시를 사용하지 않고 강제로 재계산 할지')
|
51
|
+
ranking_parser.add_argument('-n', '--noti', action='store_true', help='작업 완료 후 메시지 전송 여부')
|
52
|
+
|
44
53
|
# red 명령어 서브파서
|
45
54
|
red_parser = type_subparsers.add_parser('red', help='red 타입')
|
46
55
|
red_subparser = red_parser.add_subparsers(dest='command', help='red 관련된 명령')
|
analyser_hj3415/tsa.py
CHANGED
@@ -105,12 +105,13 @@ class MyProphet:
|
|
105
105
|
|
106
106
|
def get_yhat(self) -> dict:
|
107
107
|
"""
|
108
|
-
|
108
|
+
최근 날짜의 예측데이터를 반환한다.
|
109
109
|
:return: {'ds':..., 'yhat':.., 'yhat_lower':.., 'yhat_upper':..,}
|
110
110
|
"""
|
111
111
|
df = self.df_forecast
|
112
|
-
|
113
|
-
|
112
|
+
last_real_date = self.df_real.iloc[-1]['ds']
|
113
|
+
analyser_logger.info(last_real_date)
|
114
|
+
yhat_dict = df[df['ds']==last_real_date].iloc[0][['ds', 'yhat_lower', 'yhat_upper', 'yhat']].to_dict()
|
114
115
|
analyser_logger.info(yhat_dict)
|
115
116
|
return yhat_dict
|
116
117
|
|
@@ -135,7 +136,7 @@ class MyProphet:
|
|
135
136
|
go.Scatter(x=self.df_forecast['ds'], y=self.df_forecast['yhat_lower'], fill='tonexty', mode='lines', name='하한'))
|
136
137
|
|
137
138
|
fig.update_layout(
|
138
|
-
title=f'{self.code} {self.name} 주가 예측 그래프(prophet)',
|
139
|
+
# title=f'{self.code} {self.name} 주가 예측 그래프(prophet)',
|
139
140
|
xaxis_title='일자',
|
140
141
|
yaxis_title='주가(원)',
|
141
142
|
xaxis = dict(
|
@@ -186,14 +187,16 @@ class MyProphet:
|
|
186
187
|
p = MyProphet('005930')
|
187
188
|
for i, code in enumerate(myredis.Corps.list_all_codes()):
|
188
189
|
p.code = code
|
189
|
-
|
190
|
+
last_real_data = p._preprocessing_for_prophet().iloc[-1]
|
191
|
+
recent_price = last_real_data['y']
|
192
|
+
recent_date = datetime.strftime(last_real_data['ds'], '%Y-%m-%d')
|
190
193
|
yhat_dict = p.get_yhat()
|
191
194
|
analyser_logger.info(f'recent_price: {recent_price}, yhat_dict: {yhat_dict}')
|
192
195
|
yhat_lower = int(yhat_dict['yhat_lower'])
|
193
196
|
if recent_price < yhat_lower:
|
194
197
|
deviation = int(eval.Tools.cal_deviation(recent_price, yhat_lower))
|
195
198
|
data[code] = deviation
|
196
|
-
print(f"{i}.{p.code}/{p.name}
|
199
|
+
print(f"{i}.{p.code}/{p.name} date: {recent_date} 가격:{recent_price} 기대하한값:{yhat_lower} 편차:{deviation}")
|
197
200
|
return data
|
198
201
|
|
199
202
|
data_dict = myredis.Base.fetch_and_cache_data(redis_name, refresh, fetch_ranking, timer=expire_time)
|
analyser_hj3415/workroom/lstm.py
CHANGED
@@ -15,6 +15,8 @@ stock_data = yf.download('259960.KS', start='2020-01-01', end='2024-10-11')
|
|
15
15
|
# 하이닉스 주식 데이터 가져오기 (KOSPI 상장)
|
16
16
|
#stock_data = yf.download('000660.KS', start='2019-01-01', end='2024-10-11')
|
17
17
|
|
18
|
+
stock_data = yf.download('004490.KS', start='2020-01-01', end='2024-10-15')
|
19
|
+
|
18
20
|
|
19
21
|
# 2. 필요한 열만 선택 (종가만 사용)
|
20
22
|
data = stock_data['Close'].values.reshape(-1, 1)
|
@@ -1,16 +1,16 @@
|
|
1
1
|
analyser_hj3415/.DS_Store,sha256=qr9-0FPn5CFKe6kEu8_dWCNhzQ0sN7bwQgffKsaJEEo,6148
|
2
2
|
analyser_hj3415/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
|
-
analyser_hj3415/cli.py,sha256=
|
3
|
+
analyser_hj3415/cli.py,sha256=SnIcejcjbXR9rMA7zIm-hIXgbIIlFJkZPMUCvo_AgtQ,11725
|
4
4
|
analyser_hj3415/eval.py,sha256=4F0GIknCogAhv_iTq8auLrmwW20u8kH0HY0fP4SaVa4,39099
|
5
|
-
analyser_hj3415/tsa.py,sha256=
|
5
|
+
analyser_hj3415/tsa.py,sha256=3mZ0hjUNt202MAytnjAYAoG1Cj9Zl6S_Rmz39_0iC98,7875
|
6
6
|
analyser_hj3415/workroom/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
|
-
analyser_hj3415/workroom/lstm.py,sha256=
|
7
|
+
analyser_hj3415/workroom/lstm.py,sha256=b0ICzIVeCODcH4tAkVyrHVJLXwf21wmkIambKPHaZMQ,4155
|
8
8
|
analyser_hj3415/workroom/mysklearn.py,sha256=wJXKz5MqqTzADdG2mqRMMzc_G9RzwYjj5_j4gyOopxQ,2030
|
9
9
|
analyser_hj3415/workroom/mysklearn2.py,sha256=1lIy6EWEQHkOzDS-av8U0zQH6DuCLKWMI73dnJx5KRs,1495
|
10
10
|
analyser_hj3415/workroom/score.py,sha256=P6nHBJYmyhigGtT4qna4BmNtvt4B93b7SKyzdstJK24,17376
|
11
11
|
analyser_hj3415/workroom/trash.py,sha256=zF-W0piqkGr66UP6-iybo9EXh2gO0RP6R1FnIpsGkl8,12262
|
12
|
-
analyser_hj3415-2.8.
|
13
|
-
analyser_hj3415-2.8.
|
14
|
-
analyser_hj3415-2.8.
|
15
|
-
analyser_hj3415-2.8.
|
16
|
-
analyser_hj3415-2.8.
|
12
|
+
analyser_hj3415-2.8.2.dist-info/entry_points.txt,sha256=ZfjPnJuH8SzvhE9vftIPMBIofsc65IAWYOhqOC_L5ck,65
|
13
|
+
analyser_hj3415-2.8.2.dist-info/LICENSE,sha256=QVKTp0dTnB5xG8RLgG17LwSWCKNEzYoVVM6KjoCPKc0,1079
|
14
|
+
analyser_hj3415-2.8.2.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
|
15
|
+
analyser_hj3415-2.8.2.dist-info/METADATA,sha256=czwwaazkGIYfdqgPoz6AOleeIQgsLuR_99Xd-8OtV0o,6607
|
16
|
+
analyser_hj3415-2.8.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|