analyser_hj3415 4.0.5__py3-none-any.whl → 4.0.7__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/analyser/tsa/common.py +18 -2
- analyser_hj3415/analyser/tsa/lstm.py +3 -6
- analyser_hj3415/analyser/tsa/prophet.py +5 -9
- {analyser_hj3415-4.0.5.dist-info → analyser_hj3415-4.0.7.dist-info}/METADATA +1 -1
- {analyser_hj3415-4.0.5.dist-info → analyser_hj3415-4.0.7.dist-info}/RECORD +7 -7
- {analyser_hj3415-4.0.5.dist-info → analyser_hj3415-4.0.7.dist-info}/WHEEL +0 -0
- {analyser_hj3415-4.0.5.dist-info → analyser_hj3415-4.0.7.dist-info}/entry_points.txt +0 -0
@@ -1,6 +1,9 @@
|
|
1
1
|
import numpy as np
|
2
|
+
from dataclasses import dataclass, field
|
3
|
+
from typing import List
|
2
4
|
import pandas as pd
|
3
|
-
from marshmallow import fields
|
5
|
+
from marshmallow import fields, Schema
|
6
|
+
from marshmallow_dataclass import class_schema
|
4
7
|
|
5
8
|
|
6
9
|
def is_up_by_OLS(data: dict) -> bool:
|
@@ -34,12 +37,25 @@ def is_up_by_OLS(data: dict) -> bool:
|
|
34
37
|
# 4) 기울기가 양수면 "우상향 추세"로 판별
|
35
38
|
return slope > 0
|
36
39
|
|
37
|
-
|
40
|
+
@dataclass
|
38
41
|
class PandasTimestampField(fields.DateTime):
|
39
42
|
"""pandas.Timestamp를 ISO 8601 문자열로 직렬화하고 역직렬화하는 필드"""
|
40
43
|
|
44
|
+
def __init__(self, *args, **kwargs):
|
45
|
+
# 꼭 부모의 __init__을 호출해야 함
|
46
|
+
super().__init__(*args, **kwargs)
|
47
|
+
|
41
48
|
def _serialize(self, value, attr, obj, **kwargs):
|
42
49
|
return value.isoformat() if isinstance(value, pd.Timestamp) else None
|
43
50
|
|
44
51
|
def _deserialize(self, value, attr, data, **kwargs):
|
45
52
|
return pd.Timestamp(value)
|
53
|
+
|
54
|
+
@dataclass
|
55
|
+
class ChartPoint:
|
56
|
+
"""prices 리스트의 각 원소(x, y)를 표현할 데이터 클래스"""
|
57
|
+
x: pd.Timestamp = field(metadata={"marshmallow_field": PandasTimestampField()})
|
58
|
+
y: float
|
59
|
+
|
60
|
+
|
61
|
+
|
@@ -16,7 +16,7 @@ from marshmallow import fields
|
|
16
16
|
from utils_hj3415 import tools, setup_logger
|
17
17
|
from db_hj3415 import myredis
|
18
18
|
from analyser_hj3415.analyser import MIs, tsa
|
19
|
-
from analyser_hj3415.analyser.tsa.common import PandasTimestampField
|
19
|
+
from analyser_hj3415.analyser.tsa.common import PandasTimestampField, ChartPoint
|
20
20
|
|
21
21
|
mylogger = setup_logger(__name__,'INFO')
|
22
22
|
expire_time = tools.to_int(os.getenv('DEFAULT_EXPIRE_TIME_H', 48)) * 3600
|
@@ -79,11 +79,8 @@ class LSTMChartData:
|
|
79
79
|
ticker: str
|
80
80
|
|
81
81
|
labels: List[pd.Timestamp] = field(metadata={"marshmallow_field": fields.List(PandasTimestampField())})
|
82
|
-
prices: List[
|
83
|
-
|
84
|
-
future_prices: List[Dict[pd.Timestamp, float]] = field(
|
85
|
-
metadata={"marshmallow_field": fields.List(fields.Dict(keys=PandasTimestampField(), values=fields.Float()))})
|
86
|
-
|
82
|
+
prices: List[ChartPoint]
|
83
|
+
future_prices: List[ChartPoint]
|
87
84
|
grade: LSTMGrade
|
88
85
|
num: int
|
89
86
|
is_lstm_up: bool
|
@@ -15,7 +15,7 @@ from utils_hj3415 import tools, setup_logger
|
|
15
15
|
from db_hj3415 import myredis
|
16
16
|
|
17
17
|
from analyser_hj3415.analyser import eval, MIs, tsa
|
18
|
-
from analyser_hj3415.analyser.tsa.common import PandasTimestampField
|
18
|
+
from analyser_hj3415.analyser.tsa.common import PandasTimestampField, ChartPoint
|
19
19
|
|
20
20
|
|
21
21
|
mylogger = setup_logger(__name__,'INFO')
|
@@ -41,14 +41,10 @@ class ProphetChartData:
|
|
41
41
|
ticker: str
|
42
42
|
|
43
43
|
labels: List[pd.Timestamp] = field(metadata={"marshmallow_field": fields.List(PandasTimestampField())})
|
44
|
-
prices: List[
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
yhat_uppers: List[Dict[pd.Timestamp, float]] = field(
|
49
|
-
metadata={"marshmallow_field": fields.List(fields.Dict(keys=PandasTimestampField(), values=fields.Float()))})
|
50
|
-
yhat_lowers: List[Dict[pd.Timestamp, float]] = field(
|
51
|
-
metadata={"marshmallow_field": fields.List(fields.Dict(keys=PandasTimestampField(), values=fields.Float()))})
|
44
|
+
prices: List[ChartPoint]
|
45
|
+
yhats: List[ChartPoint]
|
46
|
+
yhat_uppers: List[ChartPoint]
|
47
|
+
yhat_lowers: List[ChartPoint]
|
52
48
|
|
53
49
|
is_prophet_up: bool
|
54
50
|
|
@@ -8,10 +8,10 @@ analyser_hj3415/analyser/eval/growth.py,sha256=sfJ7h06efrTfL4ylhUCV525IzUzilbun1
|
|
8
8
|
analyser_hj3415/analyser/eval/mil.py,sha256=mFMiFCuCBvlQrhQcM5hMg8U4zF32TS1GnUmk8fPd950,15178
|
9
9
|
analyser_hj3415/analyser/eval/red.py,sha256=b-Odud8pxQIO2NjI7m3HbK4FOND5WhaoYV94mCHqDPo,13907
|
10
10
|
analyser_hj3415/analyser/tsa/__init__.py,sha256=pg20ZQRABedTdaIoOr5t043RNKtJ7ji_WmnZrD1IhPg,147
|
11
|
-
analyser_hj3415/analyser/tsa/common.py,sha256=
|
12
|
-
analyser_hj3415/analyser/tsa/lstm.py,sha256=
|
13
|
-
analyser_hj3415/analyser/tsa/prophet.py,sha256=
|
14
|
-
analyser_hj3415-4.0.
|
15
|
-
analyser_hj3415-4.0.
|
16
|
-
analyser_hj3415-4.0.
|
17
|
-
analyser_hj3415-4.0.
|
11
|
+
analyser_hj3415/analyser/tsa/common.py,sha256=ZLUkifupOlLKsrPiqR3y6FaEN4M_loZhxCZXYxkX0us,1874
|
12
|
+
analyser_hj3415/analyser/tsa/lstm.py,sha256=Ew6banylC0rXFKiyKz2n5kE3lmJUP65NZvr11VjOsVM,28115
|
13
|
+
analyser_hj3415/analyser/tsa/prophet.py,sha256=sJPbJg7bTViF0jWeFfFrThwpryLmn528RmELxeARYe0,17713
|
14
|
+
analyser_hj3415-4.0.7.dist-info/entry_points.txt,sha256=ZfjPnJuH8SzvhE9vftIPMBIofsc65IAWYOhqOC_L5ck,65
|
15
|
+
analyser_hj3415-4.0.7.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82
|
16
|
+
analyser_hj3415-4.0.7.dist-info/METADATA,sha256=xLDHA852h0Zgt8mGCLg8FjrT0-WHZlrCCMH3IVDQAdE,6777
|
17
|
+
analyser_hj3415-4.0.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|