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.
Files changed (43) hide show
  1. akshare_one/__init__.py +214 -31
  2. akshare_one/indicators.py +395 -395
  3. akshare_one/modules/cache.py +10 -9
  4. akshare_one/modules/eastmoney/client.py +88 -88
  5. akshare_one/modules/eastmoney/utils.py +104 -104
  6. akshare_one/modules/financial/base.py +27 -22
  7. akshare_one/modules/financial/eastmoney.py +184 -0
  8. akshare_one/modules/financial/factory.py +46 -44
  9. akshare_one/modules/financial/sina.py +298 -273
  10. akshare_one/modules/historical/base.py +47 -47
  11. akshare_one/modules/historical/eastmoney.py +241 -241
  12. akshare_one/modules/historical/eastmoney_direct.py +79 -79
  13. akshare_one/modules/historical/factory.py +48 -48
  14. akshare_one/modules/historical/sina.py +254 -254
  15. akshare_one/modules/indicators/base.py +158 -158
  16. akshare_one/modules/indicators/factory.py +33 -33
  17. akshare_one/modules/indicators/simple.py +230 -230
  18. akshare_one/modules/indicators/talib.py +263 -263
  19. akshare_one/modules/info/base.py +25 -0
  20. akshare_one/modules/info/eastmoney.py +52 -0
  21. akshare_one/modules/info/factory.py +44 -0
  22. akshare_one/modules/insider/base.py +28 -28
  23. akshare_one/modules/insider/factory.py +44 -44
  24. akshare_one/modules/insider/xueqiu.py +115 -115
  25. akshare_one/modules/news/base.py +22 -22
  26. akshare_one/modules/news/eastmoney.py +47 -47
  27. akshare_one/modules/news/factory.py +44 -44
  28. akshare_one/modules/realtime/base.py +27 -27
  29. akshare_one/modules/realtime/eastmoney.py +57 -57
  30. akshare_one/modules/realtime/eastmoney_direct.py +37 -37
  31. akshare_one/modules/realtime/factory.py +48 -48
  32. akshare_one/modules/realtime/xueqiu.py +60 -60
  33. akshare_one/modules/utils.py +10 -10
  34. {akshare_one-0.3.1.dist-info → akshare_one-0.3.3.dist-info}/METADATA +70 -70
  35. akshare_one-0.3.3.dist-info/RECORD +39 -0
  36. {akshare_one-0.3.1.dist-info → akshare_one-0.3.3.dist-info}/licenses/LICENSE +21 -21
  37. akshare_one/financial.py +0 -46
  38. akshare_one/insider.py +0 -33
  39. akshare_one/news.py +0 -27
  40. akshare_one/stock.py +0 -78
  41. akshare_one-0.3.1.dist-info/RECORD +0 -39
  42. {akshare_one-0.3.1.dist-info → akshare_one-0.3.3.dist-info}/WHEEL +0 -0
  43. {akshare_one-0.3.1.dist-info → akshare_one-0.3.3.dist-info}/top_level.txt +0 -0
akshare_one/indicators.py CHANGED
@@ -1,395 +1,395 @@
1
- """Technical indicators module
2
-
3
- Provides common technical analysis indicators like:
4
- - Simple Moving Average (SMA)
5
- - Exponential Moving Average (EMA)
6
- - Relative Strength Index (RSI)
7
- - Moving Average Convergence Divergence (MACD)
8
- - Bollinger Bands (BBANDS)
9
- - Stochastic Oscillator (STOCH)
10
- - Average True Range (ATR)
11
- - Commodity Channel Index (CCI)
12
- - Average Directional Index (ADX)
13
- - Williams' %R (WILLR)
14
- - Chaikin A/D Line (AD)
15
- - Chaikin A/D Oscillator (ADOSC)
16
- - On Balance Volume (OBV)
17
- - Momentum (MOM)
18
- - Parabolic SAR (SAR)
19
- - Time Series Forecast (TSF)
20
- - Absolute Price Oscillator (APO)
21
- - Aroon (AROON)
22
- - Aroon Oscillator (AROONOSC)
23
- - Balance of Power (BOP)
24
- - Chande Momentum Oscillator (CMO)
25
- - Directional Movement Index (DX)
26
- - Money Flow Index (MFI)
27
- - Minus Directional Indicator (MINUS_DI)
28
- - Minus Directional Movement (MINUS_DM)
29
- - Plus Directional Indicator (PLUS_DI)
30
- - Plus Directional Movement (PLUS_DM)
31
- - Percentage Price Oscillator (PPO)
32
- - Rate of change (ROC)
33
- - Rate of change Percentage (ROCP)
34
- - Rate of change ratio (ROCR)
35
- - Rate of change ratio 100 scale (ROCR100)
36
- - 1-day Rate of Change (ROC) of a Triple Smooth EMA (TRIX)
37
- - Ultimate Oscillator (ULTOSC)
38
- """
39
-
40
- import pandas as pd
41
- from .modules.indicators.factory import IndicatorFactory
42
-
43
-
44
- def get_sma(
45
- df: pd.DataFrame, window: int = 20, calculator_type: str = "talib"
46
- ) -> pd.DataFrame:
47
- """Calculate Simple Moving Average
48
-
49
- Args:
50
- df: DataFrame with 'close' column
51
- window: Lookback window size
52
- calculator_type: ('talib', 'simple')
53
- """
54
- calculator = IndicatorFactory.get_calculator(calculator_type)
55
- return calculator.calculate_sma(df, window)
56
-
57
-
58
- def get_ema(
59
- df: pd.DataFrame, window: int = 20, calculator_type: str = "talib"
60
- ) -> pd.DataFrame:
61
- """Calculate Exponential Moving Average
62
-
63
- Args:
64
- df: DataFrame with 'close' column
65
- window: Lookback window size
66
- calculator_type: ('talib', 'simple')
67
- """
68
- calculator = IndicatorFactory.get_calculator(calculator_type)
69
- return calculator.calculate_ema(df, window)
70
-
71
-
72
- def get_rsi(
73
- df: pd.DataFrame, window: int = 14, calculator_type: str = "talib"
74
- ) -> pd.DataFrame:
75
- """Calculate Relative Strength Index
76
-
77
- Args:
78
- df: DataFrame with 'close' column
79
- window: Lookback window size
80
- calculator_type: ('talib', 'simple')
81
- """
82
- calculator = IndicatorFactory.get_calculator(calculator_type)
83
- return calculator.calculate_rsi(df, window)
84
-
85
-
86
- def get_macd(
87
- df: pd.DataFrame,
88
- fast: int = 12,
89
- slow: int = 26,
90
- signal: int = 9,
91
- calculator_type: str = "talib",
92
- ) -> pd.DataFrame:
93
- """Calculate MACD
94
-
95
- Args:
96
- df: DataFrame with 'close' column
97
- fast: Fast period
98
- slow: Slow period
99
- signal: Signal period
100
- calculator_type: ('talib', 'simple')
101
- """
102
- calculator = IndicatorFactory.get_calculator(calculator_type)
103
- return calculator.calculate_macd(df, fast, slow, signal)
104
-
105
-
106
- def get_bollinger_bands(
107
- df: pd.DataFrame,
108
- window: int = 20,
109
- std: int = 2,
110
- calculator_type: str = "talib",
111
- ) -> pd.DataFrame:
112
- """Calculate Bollinger Bands
113
-
114
- Args:
115
- df: DataFrame with 'close' column
116
- window: Lookback window size
117
- std: Standard deviation
118
- calculator_type: ('talib', 'simple')
119
- """
120
- calculator = IndicatorFactory.get_calculator(calculator_type)
121
- return calculator.calculate_bollinger_bands(df, window, std)
122
-
123
-
124
- def get_stoch(
125
- df: pd.DataFrame,
126
- window: int = 14,
127
- smooth_d: int = 3,
128
- smooth_k: int = 3,
129
- calculator_type: str = "talib",
130
- ) -> pd.DataFrame:
131
- """Calculate Stochastic Oscillator
132
-
133
- Args:
134
- df: DataFrame with 'high', 'low', 'close' columns
135
- window: Lookback window size
136
- smooth_d: Smoothing for D line
137
- smooth_k: Smoothing for K line
138
- calculator_type: ('talib', 'simple')
139
- """
140
- calculator = IndicatorFactory.get_calculator(calculator_type)
141
- return calculator.calculate_stoch(df, window, smooth_d, smooth_k)
142
-
143
-
144
- def get_atr(
145
- df: pd.DataFrame, window: int = 14, calculator_type: str = "talib"
146
- ) -> pd.DataFrame:
147
- """Calculate Average True Range
148
-
149
- Args:
150
- df: DataFrame with 'high', 'low', 'close' columns
151
- window: Lookback window size
152
- calculator_type: ('talib', 'simple')
153
- """
154
- calculator = IndicatorFactory.get_calculator(calculator_type)
155
- return calculator.calculate_atr(df, window)
156
-
157
-
158
- def get_cci(
159
- df: pd.DataFrame, window: int = 14, calculator_type: str = "talib"
160
- ) -> pd.DataFrame:
161
- """Calculate Commodity Channel Index
162
-
163
- Args:
164
- df: DataFrame with 'high', 'low', 'close' columns
165
- window: Lookback window size
166
- calculator_type: ('talib', 'simple')
167
- """
168
- calculator = IndicatorFactory.get_calculator(calculator_type)
169
- return calculator.calculate_cci(df, window)
170
-
171
-
172
- def get_adx(
173
- df: pd.DataFrame, window: int = 14, calculator_type: str = "talib"
174
- ) -> pd.DataFrame:
175
- """Calculate Average Directional Index
176
-
177
- Args:
178
- df: DataFrame with 'high', 'low', 'close' columns
179
- window: Lookback window size
180
- calculator_type: ('talib', 'simple')
181
- """
182
- calculator = IndicatorFactory.get_calculator(calculator_type)
183
- return calculator.calculate_adx(df, window)
184
-
185
-
186
- def get_willr(
187
- df: pd.DataFrame, window: int = 14, calculator_type: str = "talib"
188
- ) -> pd.DataFrame:
189
- """Calculate Williams' %R"""
190
- calculator = IndicatorFactory.get_calculator(calculator_type)
191
- return calculator.calculate_willr(df, window)
192
-
193
-
194
- def get_ad(df: pd.DataFrame, calculator_type: str = "talib") -> pd.DataFrame:
195
- """Calculate Chaikin A/D Line"""
196
- calculator = IndicatorFactory.get_calculator(calculator_type)
197
- return calculator.calculate_ad(df)
198
-
199
-
200
- def get_adosc(
201
- df: pd.DataFrame,
202
- fast_period: int = 3,
203
- slow_period: int = 10,
204
- calculator_type: str = "talib",
205
- ) -> pd.DataFrame:
206
- """Calculate Chaikin A/D Oscillator"""
207
- calculator = IndicatorFactory.get_calculator(calculator_type)
208
- return calculator.calculate_adosc(df, fast_period, slow_period)
209
-
210
-
211
- def get_obv(df: pd.DataFrame, calculator_type: str = "talib") -> pd.DataFrame:
212
- """Calculate On Balance Volume"""
213
- calculator = IndicatorFactory.get_calculator(calculator_type)
214
- return calculator.calculate_obv(df)
215
-
216
-
217
- def get_mom(
218
- df: pd.DataFrame, window: int = 10, calculator_type: str = "talib"
219
- ) -> pd.DataFrame:
220
- """Calculate Momentum"""
221
- calculator = IndicatorFactory.get_calculator(calculator_type)
222
- return calculator.calculate_mom(df, window)
223
-
224
-
225
- def get_sar(
226
- df: pd.DataFrame,
227
- acceleration: float = 0.02,
228
- maximum: float = 0.2,
229
- calculator_type: str = "talib",
230
- ) -> pd.DataFrame:
231
- """Calculate Parabolic SAR"""
232
- calculator = IndicatorFactory.get_calculator(calculator_type)
233
- return calculator.calculate_sar(df, acceleration, maximum)
234
-
235
-
236
- def get_tsf(
237
- df: pd.DataFrame, window: int = 14, calculator_type: str = "talib"
238
- ) -> pd.DataFrame:
239
- """Calculate Time Series Forecast"""
240
- calculator = IndicatorFactory.get_calculator(calculator_type)
241
- return calculator.calculate_tsf(df, window)
242
-
243
-
244
- def get_apo(
245
- df: pd.DataFrame,
246
- fast_period: int = 12,
247
- slow_period: int = 26,
248
- ma_type: int = 0,
249
- calculator_type: str = "talib",
250
- ) -> pd.DataFrame:
251
- """Calculate Absolute Price Oscillator"""
252
- calculator = IndicatorFactory.get_calculator(calculator_type)
253
- return calculator.calculate_apo(df, fast_period, slow_period, ma_type)
254
-
255
-
256
- def get_aroon(
257
- df: pd.DataFrame, window: int = 14, calculator_type: str = "talib"
258
- ) -> pd.DataFrame:
259
- """Calculate Aroon"""
260
- calculator = IndicatorFactory.get_calculator(calculator_type)
261
- return calculator.calculate_aroon(df, window)
262
-
263
-
264
- def get_aroonosc(
265
- df: pd.DataFrame, window: int = 14, calculator_type: str = "talib"
266
- ) -> pd.DataFrame:
267
- """Calculate Aroon Oscillator"""
268
- calculator = IndicatorFactory.get_calculator(calculator_type)
269
- return calculator.calculate_aroonosc(df, window)
270
-
271
-
272
- def get_bop(df: pd.DataFrame, calculator_type: str = "talib") -> pd.DataFrame:
273
- """Calculate Balance of Power"""
274
- calculator = IndicatorFactory.get_calculator(calculator_type)
275
- return calculator.calculate_bop(df)
276
-
277
-
278
- def get_cmo(
279
- df: pd.DataFrame, window: int = 14, calculator_type: str = "talib"
280
- ) -> pd.DataFrame:
281
- """Calculate Chande Momentum Oscillator"""
282
- calculator = IndicatorFactory.get_calculator(calculator_type)
283
- return calculator.calculate_cmo(df, window)
284
-
285
-
286
- def get_dx(
287
- df: pd.DataFrame, window: int = 14, calculator_type: str = "talib"
288
- ) -> pd.DataFrame:
289
- """Calculate Directional Movement Index"""
290
- calculator = IndicatorFactory.get_calculator(calculator_type)
291
- return calculator.calculate_dx(df, window)
292
-
293
-
294
- def get_mfi(
295
- df: pd.DataFrame, window: int = 14, calculator_type: str = "talib"
296
- ) -> pd.DataFrame:
297
- """Calculate Money Flow Index"""
298
- calculator = IndicatorFactory.get_calculator(calculator_type)
299
- return calculator.calculate_mfi(df, window)
300
-
301
-
302
- def get_minus_di(
303
- df: pd.DataFrame, window: int = 14, calculator_type: str = "talib"
304
- ) -> pd.DataFrame:
305
- """Calculate Minus Directional Indicator"""
306
- calculator = IndicatorFactory.get_calculator(calculator_type)
307
- return calculator.calculate_minus_di(df, window)
308
-
309
-
310
- def get_minus_dm(
311
- df: pd.DataFrame, window: int = 14, calculator_type: str = "talib"
312
- ) -> pd.DataFrame:
313
- """Calculate Minus Directional Movement"""
314
- calculator = IndicatorFactory.get_calculator(calculator_type)
315
- return calculator.calculate_minus_dm(df, window)
316
-
317
-
318
- def get_plus_di(
319
- df: pd.DataFrame, window: int = 14, calculator_type: str = "talib"
320
- ) -> pd.DataFrame:
321
- """Calculate Plus Directional Indicator"""
322
- calculator = IndicatorFactory.get_calculator(calculator_type)
323
- return calculator.calculate_plus_di(df, window)
324
-
325
-
326
- def get_plus_dm(
327
- df: pd.DataFrame, window: int = 14, calculator_type: str = "talib"
328
- ) -> pd.DataFrame:
329
- """Calculate Plus Directional Movement"""
330
- calculator = IndicatorFactory.get_calculator(calculator_type)
331
- return calculator.calculate_plus_dm(df, window)
332
-
333
-
334
- def get_ppo(
335
- df: pd.DataFrame,
336
- fast_period: int = 12,
337
- slow_period: int = 26,
338
- ma_type: int = 0,
339
- calculator_type: str = "talib",
340
- ) -> pd.DataFrame:
341
- """Calculate Percentage Price Oscillator"""
342
- calculator = IndicatorFactory.get_calculator(calculator_type)
343
- return calculator.calculate_ppo(df, fast_period, slow_period, ma_type)
344
-
345
-
346
- def get_roc(
347
- df: pd.DataFrame, window: int = 10, calculator_type: str = "talib"
348
- ) -> pd.DataFrame:
349
- """Calculate Rate of change"""
350
- calculator = IndicatorFactory.get_calculator(calculator_type)
351
- return calculator.calculate_roc(df, window)
352
-
353
-
354
- def get_rocp(
355
- df: pd.DataFrame, window: int = 10, calculator_type: str = "talib"
356
- ) -> pd.DataFrame:
357
- """Calculate Rate of change Percentage"""
358
- calculator = IndicatorFactory.get_calculator(calculator_type)
359
- return calculator.calculate_rocp(df, window)
360
-
361
-
362
- def get_rocr(
363
- df: pd.DataFrame, window: int = 10, calculator_type: str = "talib"
364
- ) -> pd.DataFrame:
365
- """Calculate Rate of change ratio"""
366
- calculator = IndicatorFactory.get_calculator(calculator_type)
367
- return calculator.calculate_rocr(df, window)
368
-
369
-
370
- def get_rocr100(
371
- df: pd.DataFrame, window: int = 10, calculator_type: str = "talib"
372
- ) -> pd.DataFrame:
373
- """Calculate Rate of change ratio 100 scale"""
374
- calculator = IndicatorFactory.get_calculator(calculator_type)
375
- return calculator.calculate_rocr100(df, window)
376
-
377
-
378
- def get_trix(
379
- df: pd.DataFrame, window: int = 30, calculator_type: str = "talib"
380
- ) -> pd.DataFrame:
381
- """Calculate 1-day Rate of Change (ROC) of a Triple Smooth EMA"""
382
- calculator = IndicatorFactory.get_calculator(calculator_type)
383
- return calculator.calculate_trix(df, window)
384
-
385
-
386
- def get_ultosc(
387
- df: pd.DataFrame,
388
- window1: int = 7,
389
- window2: int = 14,
390
- window3: int = 28,
391
- calculator_type: str = "talib",
392
- ) -> pd.DataFrame:
393
- """Calculate Ultimate Oscillator"""
394
- calculator = IndicatorFactory.get_calculator(calculator_type)
395
- return calculator.calculate_ultosc(df, window1, window2, window3)
1
+ """Technical indicators module
2
+
3
+ Provides common technical analysis indicators like:
4
+ - Simple Moving Average (SMA)
5
+ - Exponential Moving Average (EMA)
6
+ - Relative Strength Index (RSI)
7
+ - Moving Average Convergence Divergence (MACD)
8
+ - Bollinger Bands (BBANDS)
9
+ - Stochastic Oscillator (STOCH)
10
+ - Average True Range (ATR)
11
+ - Commodity Channel Index (CCI)
12
+ - Average Directional Index (ADX)
13
+ - Williams' %R (WILLR)
14
+ - Chaikin A/D Line (AD)
15
+ - Chaikin A/D Oscillator (ADOSC)
16
+ - On Balance Volume (OBV)
17
+ - Momentum (MOM)
18
+ - Parabolic SAR (SAR)
19
+ - Time Series Forecast (TSF)
20
+ - Absolute Price Oscillator (APO)
21
+ - Aroon (AROON)
22
+ - Aroon Oscillator (AROONOSC)
23
+ - Balance of Power (BOP)
24
+ - Chande Momentum Oscillator (CMO)
25
+ - Directional Movement Index (DX)
26
+ - Money Flow Index (MFI)
27
+ - Minus Directional Indicator (MINUS_DI)
28
+ - Minus Directional Movement (MINUS_DM)
29
+ - Plus Directional Indicator (PLUS_DI)
30
+ - Plus Directional Movement (PLUS_DM)
31
+ - Percentage Price Oscillator (PPO)
32
+ - Rate of change (ROC)
33
+ - Rate of change Percentage (ROCP)
34
+ - Rate of change ratio (ROCR)
35
+ - Rate of change ratio 100 scale (ROCR100)
36
+ - 1-day Rate of Change (ROC) of a Triple Smooth EMA (TRIX)
37
+ - Ultimate Oscillator (ULTOSC)
38
+ """
39
+
40
+ import pandas as pd
41
+ from .modules.indicators.factory import IndicatorFactory
42
+
43
+
44
+ def get_sma(
45
+ df: pd.DataFrame, window: int = 20, calculator_type: str = "talib"
46
+ ) -> pd.DataFrame:
47
+ """Calculate Simple Moving Average
48
+
49
+ Args:
50
+ df: DataFrame with 'close' column
51
+ window: Lookback window size
52
+ calculator_type: ('talib', 'simple')
53
+ """
54
+ calculator = IndicatorFactory.get_calculator(calculator_type)
55
+ return calculator.calculate_sma(df, window)
56
+
57
+
58
+ def get_ema(
59
+ df: pd.DataFrame, window: int = 20, calculator_type: str = "talib"
60
+ ) -> pd.DataFrame:
61
+ """Calculate Exponential Moving Average
62
+
63
+ Args:
64
+ df: DataFrame with 'close' column
65
+ window: Lookback window size
66
+ calculator_type: ('talib', 'simple')
67
+ """
68
+ calculator = IndicatorFactory.get_calculator(calculator_type)
69
+ return calculator.calculate_ema(df, window)
70
+
71
+
72
+ def get_rsi(
73
+ df: pd.DataFrame, window: int = 14, calculator_type: str = "talib"
74
+ ) -> pd.DataFrame:
75
+ """Calculate Relative Strength Index
76
+
77
+ Args:
78
+ df: DataFrame with 'close' column
79
+ window: Lookback window size
80
+ calculator_type: ('talib', 'simple')
81
+ """
82
+ calculator = IndicatorFactory.get_calculator(calculator_type)
83
+ return calculator.calculate_rsi(df, window)
84
+
85
+
86
+ def get_macd(
87
+ df: pd.DataFrame,
88
+ fast: int = 12,
89
+ slow: int = 26,
90
+ signal: int = 9,
91
+ calculator_type: str = "talib",
92
+ ) -> pd.DataFrame:
93
+ """Calculate MACD
94
+
95
+ Args:
96
+ df: DataFrame with 'close' column
97
+ fast: Fast period
98
+ slow: Slow period
99
+ signal: Signal period
100
+ calculator_type: ('talib', 'simple')
101
+ """
102
+ calculator = IndicatorFactory.get_calculator(calculator_type)
103
+ return calculator.calculate_macd(df, fast, slow, signal)
104
+
105
+
106
+ def get_bollinger_bands(
107
+ df: pd.DataFrame,
108
+ window: int = 20,
109
+ std: int = 2,
110
+ calculator_type: str = "talib",
111
+ ) -> pd.DataFrame:
112
+ """Calculate Bollinger Bands
113
+
114
+ Args:
115
+ df: DataFrame with 'close' column
116
+ window: Lookback window size
117
+ std: Standard deviation
118
+ calculator_type: ('talib', 'simple')
119
+ """
120
+ calculator = IndicatorFactory.get_calculator(calculator_type)
121
+ return calculator.calculate_bollinger_bands(df, window, std)
122
+
123
+
124
+ def get_stoch(
125
+ df: pd.DataFrame,
126
+ window: int = 14,
127
+ smooth_d: int = 3,
128
+ smooth_k: int = 3,
129
+ calculator_type: str = "talib",
130
+ ) -> pd.DataFrame:
131
+ """Calculate Stochastic Oscillator
132
+
133
+ Args:
134
+ df: DataFrame with 'high', 'low', 'close' columns
135
+ window: Lookback window size
136
+ smooth_d: Smoothing for D line
137
+ smooth_k: Smoothing for K line
138
+ calculator_type: ('talib', 'simple')
139
+ """
140
+ calculator = IndicatorFactory.get_calculator(calculator_type)
141
+ return calculator.calculate_stoch(df, window, smooth_d, smooth_k)
142
+
143
+
144
+ def get_atr(
145
+ df: pd.DataFrame, window: int = 14, calculator_type: str = "talib"
146
+ ) -> pd.DataFrame:
147
+ """Calculate Average True Range
148
+
149
+ Args:
150
+ df: DataFrame with 'high', 'low', 'close' columns
151
+ window: Lookback window size
152
+ calculator_type: ('talib', 'simple')
153
+ """
154
+ calculator = IndicatorFactory.get_calculator(calculator_type)
155
+ return calculator.calculate_atr(df, window)
156
+
157
+
158
+ def get_cci(
159
+ df: pd.DataFrame, window: int = 14, calculator_type: str = "talib"
160
+ ) -> pd.DataFrame:
161
+ """Calculate Commodity Channel Index
162
+
163
+ Args:
164
+ df: DataFrame with 'high', 'low', 'close' columns
165
+ window: Lookback window size
166
+ calculator_type: ('talib', 'simple')
167
+ """
168
+ calculator = IndicatorFactory.get_calculator(calculator_type)
169
+ return calculator.calculate_cci(df, window)
170
+
171
+
172
+ def get_adx(
173
+ df: pd.DataFrame, window: int = 14, calculator_type: str = "talib"
174
+ ) -> pd.DataFrame:
175
+ """Calculate Average Directional Index
176
+
177
+ Args:
178
+ df: DataFrame with 'high', 'low', 'close' columns
179
+ window: Lookback window size
180
+ calculator_type: ('talib', 'simple')
181
+ """
182
+ calculator = IndicatorFactory.get_calculator(calculator_type)
183
+ return calculator.calculate_adx(df, window)
184
+
185
+
186
+ def get_willr(
187
+ df: pd.DataFrame, window: int = 14, calculator_type: str = "talib"
188
+ ) -> pd.DataFrame:
189
+ """Calculate Williams' %R"""
190
+ calculator = IndicatorFactory.get_calculator(calculator_type)
191
+ return calculator.calculate_willr(df, window)
192
+
193
+
194
+ def get_ad(df: pd.DataFrame, calculator_type: str = "talib") -> pd.DataFrame:
195
+ """Calculate Chaikin A/D Line"""
196
+ calculator = IndicatorFactory.get_calculator(calculator_type)
197
+ return calculator.calculate_ad(df)
198
+
199
+
200
+ def get_adosc(
201
+ df: pd.DataFrame,
202
+ fast_period: int = 3,
203
+ slow_period: int = 10,
204
+ calculator_type: str = "talib",
205
+ ) -> pd.DataFrame:
206
+ """Calculate Chaikin A/D Oscillator"""
207
+ calculator = IndicatorFactory.get_calculator(calculator_type)
208
+ return calculator.calculate_adosc(df, fast_period, slow_period)
209
+
210
+
211
+ def get_obv(df: pd.DataFrame, calculator_type: str = "talib") -> pd.DataFrame:
212
+ """Calculate On Balance Volume"""
213
+ calculator = IndicatorFactory.get_calculator(calculator_type)
214
+ return calculator.calculate_obv(df)
215
+
216
+
217
+ def get_mom(
218
+ df: pd.DataFrame, window: int = 10, calculator_type: str = "talib"
219
+ ) -> pd.DataFrame:
220
+ """Calculate Momentum"""
221
+ calculator = IndicatorFactory.get_calculator(calculator_type)
222
+ return calculator.calculate_mom(df, window)
223
+
224
+
225
+ def get_sar(
226
+ df: pd.DataFrame,
227
+ acceleration: float = 0.02,
228
+ maximum: float = 0.2,
229
+ calculator_type: str = "talib",
230
+ ) -> pd.DataFrame:
231
+ """Calculate Parabolic SAR"""
232
+ calculator = IndicatorFactory.get_calculator(calculator_type)
233
+ return calculator.calculate_sar(df, acceleration, maximum)
234
+
235
+
236
+ def get_tsf(
237
+ df: pd.DataFrame, window: int = 14, calculator_type: str = "talib"
238
+ ) -> pd.DataFrame:
239
+ """Calculate Time Series Forecast"""
240
+ calculator = IndicatorFactory.get_calculator(calculator_type)
241
+ return calculator.calculate_tsf(df, window)
242
+
243
+
244
+ def get_apo(
245
+ df: pd.DataFrame,
246
+ fast_period: int = 12,
247
+ slow_period: int = 26,
248
+ ma_type: int = 0,
249
+ calculator_type: str = "talib",
250
+ ) -> pd.DataFrame:
251
+ """Calculate Absolute Price Oscillator"""
252
+ calculator = IndicatorFactory.get_calculator(calculator_type)
253
+ return calculator.calculate_apo(df, fast_period, slow_period, ma_type)
254
+
255
+
256
+ def get_aroon(
257
+ df: pd.DataFrame, window: int = 14, calculator_type: str = "talib"
258
+ ) -> pd.DataFrame:
259
+ """Calculate Aroon"""
260
+ calculator = IndicatorFactory.get_calculator(calculator_type)
261
+ return calculator.calculate_aroon(df, window)
262
+
263
+
264
+ def get_aroonosc(
265
+ df: pd.DataFrame, window: int = 14, calculator_type: str = "talib"
266
+ ) -> pd.DataFrame:
267
+ """Calculate Aroon Oscillator"""
268
+ calculator = IndicatorFactory.get_calculator(calculator_type)
269
+ return calculator.calculate_aroonosc(df, window)
270
+
271
+
272
+ def get_bop(df: pd.DataFrame, calculator_type: str = "talib") -> pd.DataFrame:
273
+ """Calculate Balance of Power"""
274
+ calculator = IndicatorFactory.get_calculator(calculator_type)
275
+ return calculator.calculate_bop(df)
276
+
277
+
278
+ def get_cmo(
279
+ df: pd.DataFrame, window: int = 14, calculator_type: str = "talib"
280
+ ) -> pd.DataFrame:
281
+ """Calculate Chande Momentum Oscillator"""
282
+ calculator = IndicatorFactory.get_calculator(calculator_type)
283
+ return calculator.calculate_cmo(df, window)
284
+
285
+
286
+ def get_dx(
287
+ df: pd.DataFrame, window: int = 14, calculator_type: str = "talib"
288
+ ) -> pd.DataFrame:
289
+ """Calculate Directional Movement Index"""
290
+ calculator = IndicatorFactory.get_calculator(calculator_type)
291
+ return calculator.calculate_dx(df, window)
292
+
293
+
294
+ def get_mfi(
295
+ df: pd.DataFrame, window: int = 14, calculator_type: str = "talib"
296
+ ) -> pd.DataFrame:
297
+ """Calculate Money Flow Index"""
298
+ calculator = IndicatorFactory.get_calculator(calculator_type)
299
+ return calculator.calculate_mfi(df, window)
300
+
301
+
302
+ def get_minus_di(
303
+ df: pd.DataFrame, window: int = 14, calculator_type: str = "talib"
304
+ ) -> pd.DataFrame:
305
+ """Calculate Minus Directional Indicator"""
306
+ calculator = IndicatorFactory.get_calculator(calculator_type)
307
+ return calculator.calculate_minus_di(df, window)
308
+
309
+
310
+ def get_minus_dm(
311
+ df: pd.DataFrame, window: int = 14, calculator_type: str = "talib"
312
+ ) -> pd.DataFrame:
313
+ """Calculate Minus Directional Movement"""
314
+ calculator = IndicatorFactory.get_calculator(calculator_type)
315
+ return calculator.calculate_minus_dm(df, window)
316
+
317
+
318
+ def get_plus_di(
319
+ df: pd.DataFrame, window: int = 14, calculator_type: str = "talib"
320
+ ) -> pd.DataFrame:
321
+ """Calculate Plus Directional Indicator"""
322
+ calculator = IndicatorFactory.get_calculator(calculator_type)
323
+ return calculator.calculate_plus_di(df, window)
324
+
325
+
326
+ def get_plus_dm(
327
+ df: pd.DataFrame, window: int = 14, calculator_type: str = "talib"
328
+ ) -> pd.DataFrame:
329
+ """Calculate Plus Directional Movement"""
330
+ calculator = IndicatorFactory.get_calculator(calculator_type)
331
+ return calculator.calculate_plus_dm(df, window)
332
+
333
+
334
+ def get_ppo(
335
+ df: pd.DataFrame,
336
+ fast_period: int = 12,
337
+ slow_period: int = 26,
338
+ ma_type: int = 0,
339
+ calculator_type: str = "talib",
340
+ ) -> pd.DataFrame:
341
+ """Calculate Percentage Price Oscillator"""
342
+ calculator = IndicatorFactory.get_calculator(calculator_type)
343
+ return calculator.calculate_ppo(df, fast_period, slow_period, ma_type)
344
+
345
+
346
+ def get_roc(
347
+ df: pd.DataFrame, window: int = 10, calculator_type: str = "talib"
348
+ ) -> pd.DataFrame:
349
+ """Calculate Rate of change"""
350
+ calculator = IndicatorFactory.get_calculator(calculator_type)
351
+ return calculator.calculate_roc(df, window)
352
+
353
+
354
+ def get_rocp(
355
+ df: pd.DataFrame, window: int = 10, calculator_type: str = "talib"
356
+ ) -> pd.DataFrame:
357
+ """Calculate Rate of change Percentage"""
358
+ calculator = IndicatorFactory.get_calculator(calculator_type)
359
+ return calculator.calculate_rocp(df, window)
360
+
361
+
362
+ def get_rocr(
363
+ df: pd.DataFrame, window: int = 10, calculator_type: str = "talib"
364
+ ) -> pd.DataFrame:
365
+ """Calculate Rate of change ratio"""
366
+ calculator = IndicatorFactory.get_calculator(calculator_type)
367
+ return calculator.calculate_rocr(df, window)
368
+
369
+
370
+ def get_rocr100(
371
+ df: pd.DataFrame, window: int = 10, calculator_type: str = "talib"
372
+ ) -> pd.DataFrame:
373
+ """Calculate Rate of change ratio 100 scale"""
374
+ calculator = IndicatorFactory.get_calculator(calculator_type)
375
+ return calculator.calculate_rocr100(df, window)
376
+
377
+
378
+ def get_trix(
379
+ df: pd.DataFrame, window: int = 30, calculator_type: str = "talib"
380
+ ) -> pd.DataFrame:
381
+ """Calculate 1-day Rate of Change (ROC) of a Triple Smooth EMA"""
382
+ calculator = IndicatorFactory.get_calculator(calculator_type)
383
+ return calculator.calculate_trix(df, window)
384
+
385
+
386
+ def get_ultosc(
387
+ df: pd.DataFrame,
388
+ window1: int = 7,
389
+ window2: int = 14,
390
+ window3: int = 28,
391
+ calculator_type: str = "talib",
392
+ ) -> pd.DataFrame:
393
+ """Calculate Ultimate Oscillator"""
394
+ calculator = IndicatorFactory.get_calculator(calculator_type)
395
+ return calculator.calculate_ultosc(df, window1, window2, window3)