akshare-one 0.3.1__py3-none-any.whl → 0.3.3__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.
- akshare_one/__init__.py +214 -31
- akshare_one/indicators.py +395 -395
- akshare_one/modules/cache.py +10 -9
- akshare_one/modules/eastmoney/client.py +88 -88
- akshare_one/modules/eastmoney/utils.py +104 -104
- akshare_one/modules/financial/base.py +27 -22
- akshare_one/modules/financial/eastmoney.py +184 -0
- akshare_one/modules/financial/factory.py +46 -44
- akshare_one/modules/financial/sina.py +298 -273
- akshare_one/modules/historical/base.py +47 -47
- akshare_one/modules/historical/eastmoney.py +241 -241
- akshare_one/modules/historical/eastmoney_direct.py +79 -79
- akshare_one/modules/historical/factory.py +48 -48
- akshare_one/modules/historical/sina.py +254 -254
- akshare_one/modules/indicators/base.py +158 -158
- akshare_one/modules/indicators/factory.py +33 -33
- akshare_one/modules/indicators/simple.py +230 -230
- akshare_one/modules/indicators/talib.py +263 -263
- akshare_one/modules/info/base.py +25 -0
- akshare_one/modules/info/eastmoney.py +52 -0
- akshare_one/modules/info/factory.py +44 -0
- akshare_one/modules/insider/base.py +28 -28
- akshare_one/modules/insider/factory.py +44 -44
- akshare_one/modules/insider/xueqiu.py +115 -115
- akshare_one/modules/news/base.py +22 -22
- akshare_one/modules/news/eastmoney.py +47 -47
- akshare_one/modules/news/factory.py +44 -44
- akshare_one/modules/realtime/base.py +27 -27
- akshare_one/modules/realtime/eastmoney.py +57 -57
- akshare_one/modules/realtime/eastmoney_direct.py +37 -37
- akshare_one/modules/realtime/factory.py +48 -48
- akshare_one/modules/realtime/xueqiu.py +60 -60
- akshare_one/modules/utils.py +10 -10
- {akshare_one-0.3.1.dist-info → akshare_one-0.3.3.dist-info}/METADATA +70 -70
- akshare_one-0.3.3.dist-info/RECORD +39 -0
- {akshare_one-0.3.1.dist-info → akshare_one-0.3.3.dist-info}/licenses/LICENSE +21 -21
- akshare_one/financial.py +0 -46
- akshare_one/insider.py +0 -33
- akshare_one/news.py +0 -27
- akshare_one/stock.py +0 -78
- akshare_one-0.3.1.dist-info/RECORD +0 -39
- {akshare_one-0.3.1.dist-info → akshare_one-0.3.3.dist-info}/WHEEL +0 -0
- {akshare_one-0.3.1.dist-info → akshare_one-0.3.3.dist-info}/top_level.txt +0 -0
@@ -1,158 +1,158 @@
|
|
1
|
-
from abc import ABC, abstractmethod
|
2
|
-
import pandas as pd
|
3
|
-
|
4
|
-
|
5
|
-
class BaseIndicatorCalculator(ABC):
|
6
|
-
"""Base class for indicator calculators"""
|
7
|
-
|
8
|
-
@abstractmethod
|
9
|
-
def calculate_sma(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
10
|
-
pass
|
11
|
-
|
12
|
-
@abstractmethod
|
13
|
-
def calculate_ema(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
14
|
-
pass
|
15
|
-
|
16
|
-
@abstractmethod
|
17
|
-
def calculate_rsi(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
18
|
-
pass
|
19
|
-
|
20
|
-
@abstractmethod
|
21
|
-
def calculate_macd(
|
22
|
-
self, df: pd.DataFrame, fast: int, slow: int, signal: int
|
23
|
-
) -> pd.DataFrame:
|
24
|
-
pass
|
25
|
-
|
26
|
-
@abstractmethod
|
27
|
-
def calculate_bollinger_bands(
|
28
|
-
self, df: pd.DataFrame, window: int, std: int
|
29
|
-
) -> pd.DataFrame:
|
30
|
-
pass
|
31
|
-
|
32
|
-
@abstractmethod
|
33
|
-
def calculate_stoch(
|
34
|
-
self, df: pd.DataFrame, window: int, smooth_d: int, smooth_k: int
|
35
|
-
) -> pd.DataFrame:
|
36
|
-
pass
|
37
|
-
|
38
|
-
@abstractmethod
|
39
|
-
def calculate_atr(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
40
|
-
pass
|
41
|
-
|
42
|
-
@abstractmethod
|
43
|
-
def calculate_cci(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
44
|
-
pass
|
45
|
-
|
46
|
-
@abstractmethod
|
47
|
-
def calculate_adx(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
48
|
-
pass
|
49
|
-
|
50
|
-
@abstractmethod
|
51
|
-
def calculate_willr(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
52
|
-
pass
|
53
|
-
|
54
|
-
@abstractmethod
|
55
|
-
def calculate_ad(self, df: pd.DataFrame) -> pd.DataFrame:
|
56
|
-
pass
|
57
|
-
|
58
|
-
@abstractmethod
|
59
|
-
def calculate_adosc(
|
60
|
-
self, df: pd.DataFrame, fast_period: int, slow_period: int
|
61
|
-
) -> pd.DataFrame:
|
62
|
-
pass
|
63
|
-
|
64
|
-
@abstractmethod
|
65
|
-
def calculate_obv(self, df: pd.DataFrame) -> pd.DataFrame:
|
66
|
-
pass
|
67
|
-
|
68
|
-
@abstractmethod
|
69
|
-
def calculate_mom(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
70
|
-
pass
|
71
|
-
|
72
|
-
@abstractmethod
|
73
|
-
def calculate_sar(
|
74
|
-
self, df: pd.DataFrame, acceleration: float, maximum: float
|
75
|
-
) -> pd.DataFrame:
|
76
|
-
pass
|
77
|
-
|
78
|
-
@abstractmethod
|
79
|
-
def calculate_tsf(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
80
|
-
pass
|
81
|
-
|
82
|
-
@abstractmethod
|
83
|
-
def calculate_apo(
|
84
|
-
self, df: pd.DataFrame, fast_period: int, slow_period: int, ma_type: int
|
85
|
-
) -> pd.DataFrame:
|
86
|
-
pass
|
87
|
-
|
88
|
-
@abstractmethod
|
89
|
-
def calculate_aroon(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
90
|
-
pass
|
91
|
-
|
92
|
-
@abstractmethod
|
93
|
-
def calculate_aroonosc(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
94
|
-
pass
|
95
|
-
|
96
|
-
@abstractmethod
|
97
|
-
def calculate_bop(self, df: pd.DataFrame) -> pd.DataFrame:
|
98
|
-
pass
|
99
|
-
|
100
|
-
@abstractmethod
|
101
|
-
def calculate_cmo(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
102
|
-
pass
|
103
|
-
|
104
|
-
@abstractmethod
|
105
|
-
def calculate_dx(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
106
|
-
pass
|
107
|
-
|
108
|
-
@abstractmethod
|
109
|
-
def calculate_mfi(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
110
|
-
pass
|
111
|
-
|
112
|
-
@abstractmethod
|
113
|
-
def calculate_minus_di(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
114
|
-
pass
|
115
|
-
|
116
|
-
@abstractmethod
|
117
|
-
def calculate_minus_dm(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
118
|
-
pass
|
119
|
-
|
120
|
-
@abstractmethod
|
121
|
-
def calculate_plus_di(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
122
|
-
pass
|
123
|
-
|
124
|
-
@abstractmethod
|
125
|
-
def calculate_plus_dm(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
126
|
-
pass
|
127
|
-
|
128
|
-
@abstractmethod
|
129
|
-
def calculate_ppo(
|
130
|
-
self, df: pd.DataFrame, fast_period: int, slow_period: int, ma_type: int
|
131
|
-
) -> pd.DataFrame:
|
132
|
-
pass
|
133
|
-
|
134
|
-
@abstractmethod
|
135
|
-
def calculate_roc(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
136
|
-
pass
|
137
|
-
|
138
|
-
@abstractmethod
|
139
|
-
def calculate_rocp(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
140
|
-
pass
|
141
|
-
|
142
|
-
@abstractmethod
|
143
|
-
def calculate_rocr(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
144
|
-
pass
|
145
|
-
|
146
|
-
@abstractmethod
|
147
|
-
def calculate_rocr100(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
148
|
-
pass
|
149
|
-
|
150
|
-
@abstractmethod
|
151
|
-
def calculate_trix(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
152
|
-
pass
|
153
|
-
|
154
|
-
@abstractmethod
|
155
|
-
def calculate_ultosc(
|
156
|
-
self, df: pd.DataFrame, window1: int, window2: int, window3: int
|
157
|
-
) -> pd.DataFrame:
|
158
|
-
pass
|
1
|
+
from abc import ABC, abstractmethod
|
2
|
+
import pandas as pd
|
3
|
+
|
4
|
+
|
5
|
+
class BaseIndicatorCalculator(ABC):
|
6
|
+
"""Base class for indicator calculators"""
|
7
|
+
|
8
|
+
@abstractmethod
|
9
|
+
def calculate_sma(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
10
|
+
pass
|
11
|
+
|
12
|
+
@abstractmethod
|
13
|
+
def calculate_ema(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
14
|
+
pass
|
15
|
+
|
16
|
+
@abstractmethod
|
17
|
+
def calculate_rsi(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
18
|
+
pass
|
19
|
+
|
20
|
+
@abstractmethod
|
21
|
+
def calculate_macd(
|
22
|
+
self, df: pd.DataFrame, fast: int, slow: int, signal: int
|
23
|
+
) -> pd.DataFrame:
|
24
|
+
pass
|
25
|
+
|
26
|
+
@abstractmethod
|
27
|
+
def calculate_bollinger_bands(
|
28
|
+
self, df: pd.DataFrame, window: int, std: int
|
29
|
+
) -> pd.DataFrame:
|
30
|
+
pass
|
31
|
+
|
32
|
+
@abstractmethod
|
33
|
+
def calculate_stoch(
|
34
|
+
self, df: pd.DataFrame, window: int, smooth_d: int, smooth_k: int
|
35
|
+
) -> pd.DataFrame:
|
36
|
+
pass
|
37
|
+
|
38
|
+
@abstractmethod
|
39
|
+
def calculate_atr(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
40
|
+
pass
|
41
|
+
|
42
|
+
@abstractmethod
|
43
|
+
def calculate_cci(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
44
|
+
pass
|
45
|
+
|
46
|
+
@abstractmethod
|
47
|
+
def calculate_adx(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
48
|
+
pass
|
49
|
+
|
50
|
+
@abstractmethod
|
51
|
+
def calculate_willr(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
52
|
+
pass
|
53
|
+
|
54
|
+
@abstractmethod
|
55
|
+
def calculate_ad(self, df: pd.DataFrame) -> pd.DataFrame:
|
56
|
+
pass
|
57
|
+
|
58
|
+
@abstractmethod
|
59
|
+
def calculate_adosc(
|
60
|
+
self, df: pd.DataFrame, fast_period: int, slow_period: int
|
61
|
+
) -> pd.DataFrame:
|
62
|
+
pass
|
63
|
+
|
64
|
+
@abstractmethod
|
65
|
+
def calculate_obv(self, df: pd.DataFrame) -> pd.DataFrame:
|
66
|
+
pass
|
67
|
+
|
68
|
+
@abstractmethod
|
69
|
+
def calculate_mom(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
70
|
+
pass
|
71
|
+
|
72
|
+
@abstractmethod
|
73
|
+
def calculate_sar(
|
74
|
+
self, df: pd.DataFrame, acceleration: float, maximum: float
|
75
|
+
) -> pd.DataFrame:
|
76
|
+
pass
|
77
|
+
|
78
|
+
@abstractmethod
|
79
|
+
def calculate_tsf(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
80
|
+
pass
|
81
|
+
|
82
|
+
@abstractmethod
|
83
|
+
def calculate_apo(
|
84
|
+
self, df: pd.DataFrame, fast_period: int, slow_period: int, ma_type: int
|
85
|
+
) -> pd.DataFrame:
|
86
|
+
pass
|
87
|
+
|
88
|
+
@abstractmethod
|
89
|
+
def calculate_aroon(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
90
|
+
pass
|
91
|
+
|
92
|
+
@abstractmethod
|
93
|
+
def calculate_aroonosc(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
94
|
+
pass
|
95
|
+
|
96
|
+
@abstractmethod
|
97
|
+
def calculate_bop(self, df: pd.DataFrame) -> pd.DataFrame:
|
98
|
+
pass
|
99
|
+
|
100
|
+
@abstractmethod
|
101
|
+
def calculate_cmo(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
102
|
+
pass
|
103
|
+
|
104
|
+
@abstractmethod
|
105
|
+
def calculate_dx(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
106
|
+
pass
|
107
|
+
|
108
|
+
@abstractmethod
|
109
|
+
def calculate_mfi(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
110
|
+
pass
|
111
|
+
|
112
|
+
@abstractmethod
|
113
|
+
def calculate_minus_di(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
114
|
+
pass
|
115
|
+
|
116
|
+
@abstractmethod
|
117
|
+
def calculate_minus_dm(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
118
|
+
pass
|
119
|
+
|
120
|
+
@abstractmethod
|
121
|
+
def calculate_plus_di(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
122
|
+
pass
|
123
|
+
|
124
|
+
@abstractmethod
|
125
|
+
def calculate_plus_dm(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
126
|
+
pass
|
127
|
+
|
128
|
+
@abstractmethod
|
129
|
+
def calculate_ppo(
|
130
|
+
self, df: pd.DataFrame, fast_period: int, slow_period: int, ma_type: int
|
131
|
+
) -> pd.DataFrame:
|
132
|
+
pass
|
133
|
+
|
134
|
+
@abstractmethod
|
135
|
+
def calculate_roc(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
136
|
+
pass
|
137
|
+
|
138
|
+
@abstractmethod
|
139
|
+
def calculate_rocp(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
140
|
+
pass
|
141
|
+
|
142
|
+
@abstractmethod
|
143
|
+
def calculate_rocr(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
144
|
+
pass
|
145
|
+
|
146
|
+
@abstractmethod
|
147
|
+
def calculate_rocr100(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
148
|
+
pass
|
149
|
+
|
150
|
+
@abstractmethod
|
151
|
+
def calculate_trix(self, df: pd.DataFrame, window: int) -> pd.DataFrame:
|
152
|
+
pass
|
153
|
+
|
154
|
+
@abstractmethod
|
155
|
+
def calculate_ultosc(
|
156
|
+
self, df: pd.DataFrame, window1: int, window2: int, window3: int
|
157
|
+
) -> pd.DataFrame:
|
158
|
+
pass
|
@@ -1,33 +1,33 @@
|
|
1
|
-
from .base import BaseIndicatorCalculator
|
2
|
-
from .simple import SimpleIndicatorCalculator
|
3
|
-
|
4
|
-
_calculators = {
|
5
|
-
"simple": SimpleIndicatorCalculator,
|
6
|
-
}
|
7
|
-
TALIB_AVAILABLE = False
|
8
|
-
try:
|
9
|
-
from .talib import TalibIndicatorCalculator
|
10
|
-
|
11
|
-
_calculators["talib"] = TalibIndicatorCalculator
|
12
|
-
TALIB_AVAILABLE = True
|
13
|
-
except ImportError:
|
14
|
-
# talib is optional
|
15
|
-
pass
|
16
|
-
|
17
|
-
|
18
|
-
class IndicatorFactory:
|
19
|
-
"""Factory for indicator calculators"""
|
20
|
-
|
21
|
-
@classmethod
|
22
|
-
def get_calculator(cls, calculator_type: str = "talib") -> BaseIndicatorCalculator:
|
23
|
-
"""Get indicator calculator instance
|
24
|
-
|
25
|
-
If talib is not installed, it will fall back to the simple implementation.
|
26
|
-
"""
|
27
|
-
if calculator_type == "talib" and not TALIB_AVAILABLE:
|
28
|
-
calculator_type = "simple"
|
29
|
-
|
30
|
-
calculator_class = _calculators.get(calculator_type)
|
31
|
-
if not calculator_class:
|
32
|
-
raise ValueError(f"Unsupported calculator type: {calculator_type}")
|
33
|
-
return calculator_class()
|
1
|
+
from .base import BaseIndicatorCalculator
|
2
|
+
from .simple import SimpleIndicatorCalculator
|
3
|
+
|
4
|
+
_calculators = {
|
5
|
+
"simple": SimpleIndicatorCalculator,
|
6
|
+
}
|
7
|
+
TALIB_AVAILABLE = False
|
8
|
+
try:
|
9
|
+
from .talib import TalibIndicatorCalculator
|
10
|
+
|
11
|
+
_calculators["talib"] = TalibIndicatorCalculator
|
12
|
+
TALIB_AVAILABLE = True
|
13
|
+
except ImportError:
|
14
|
+
# talib is optional
|
15
|
+
pass
|
16
|
+
|
17
|
+
|
18
|
+
class IndicatorFactory:
|
19
|
+
"""Factory for indicator calculators"""
|
20
|
+
|
21
|
+
@classmethod
|
22
|
+
def get_calculator(cls, calculator_type: str = "talib") -> BaseIndicatorCalculator:
|
23
|
+
"""Get indicator calculator instance
|
24
|
+
|
25
|
+
If talib is not installed, it will fall back to the simple implementation.
|
26
|
+
"""
|
27
|
+
if calculator_type == "talib" and not TALIB_AVAILABLE:
|
28
|
+
calculator_type = "simple"
|
29
|
+
|
30
|
+
calculator_class = _calculators.get(calculator_type)
|
31
|
+
if not calculator_class:
|
32
|
+
raise ValueError(f"Unsupported calculator type: {calculator_type}")
|
33
|
+
return calculator_class()
|