akshare-one 0.2.2__py3-none-any.whl → 0.3.0__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 (40) hide show
  1. akshare_one/__init__.py +31 -31
  2. akshare_one/financial.py +46 -46
  3. akshare_one/indicators.py +395 -0
  4. akshare_one/insider.py +33 -33
  5. akshare_one/modules/cache.py +9 -9
  6. akshare_one/modules/eastmoney/client.py +88 -88
  7. akshare_one/modules/eastmoney/utils.py +104 -104
  8. akshare_one/modules/financial/base.py +22 -22
  9. akshare_one/modules/financial/factory.py +44 -44
  10. akshare_one/modules/financial/sina.py +273 -273
  11. akshare_one/modules/historical/base.py +47 -39
  12. akshare_one/modules/historical/eastmoney.py +241 -241
  13. akshare_one/modules/historical/eastmoney_direct.py +79 -79
  14. akshare_one/modules/historical/factory.py +48 -48
  15. akshare_one/modules/historical/sina.py +218 -218
  16. akshare_one/modules/indicators/__init__.py +0 -0
  17. akshare_one/modules/indicators/base.py +158 -0
  18. akshare_one/modules/indicators/factory.py +33 -0
  19. akshare_one/modules/indicators/simple.py +230 -0
  20. akshare_one/modules/indicators/talib.py +263 -0
  21. akshare_one/modules/insider/base.py +28 -28
  22. akshare_one/modules/insider/factory.py +44 -44
  23. akshare_one/modules/insider/xueqiu.py +115 -115
  24. akshare_one/modules/news/base.py +22 -22
  25. akshare_one/modules/news/eastmoney.py +47 -47
  26. akshare_one/modules/news/factory.py +44 -44
  27. akshare_one/modules/realtime/base.py +27 -27
  28. akshare_one/modules/realtime/eastmoney.py +57 -57
  29. akshare_one/modules/realtime/eastmoney_direct.py +37 -37
  30. akshare_one/modules/realtime/factory.py +48 -48
  31. akshare_one/modules/realtime/xueqiu.py +60 -60
  32. akshare_one/modules/utils.py +10 -10
  33. akshare_one/news.py +27 -27
  34. akshare_one/stock.py +78 -78
  35. {akshare_one-0.2.2.dist-info → akshare_one-0.3.0.dist-info}/METADATA +70 -66
  36. akshare_one-0.3.0.dist-info/RECORD +39 -0
  37. {akshare_one-0.2.2.dist-info → akshare_one-0.3.0.dist-info}/licenses/LICENSE +21 -21
  38. akshare_one-0.2.2.dist-info/RECORD +0 -33
  39. {akshare_one-0.2.2.dist-info → akshare_one-0.3.0.dist-info}/WHEEL +0 -0
  40. {akshare_one-0.2.2.dist-info → akshare_one-0.3.0.dist-info}/top_level.txt +0 -0
akshare_one/__init__.py CHANGED
@@ -1,31 +1,31 @@
1
- """Akshare One - Unified interface for Chinese market data
2
-
3
- Provides standardized access to various financial data sources with:
4
- - Consistent symbol formats
5
- - Unified data schemas
6
- - Cleaned and normalized outputs
7
-
8
- Example:
9
- >>> from akshare_one import get_hist_data, get_realtime_data
10
- >>> # 获取股票历史数据
11
- >>> df = get_hist_data("600000", interval="day")
12
- >>> print(df.head())
13
- >>> # 获取股票实时数据
14
- >>> df = get_realtime_data(symbol="600000")
15
- """
16
-
17
- from .stock import get_hist_data, get_realtime_data
18
- from .news import get_news_data
19
- from .insider import get_inner_trade_data
20
- from .financial import get_balance_sheet, get_income_statement, get_cash_flow
21
-
22
-
23
- __all__ = [
24
- "get_hist_data",
25
- "get_realtime_data",
26
- "get_news_data",
27
- "get_inner_trade_data",
28
- "get_balance_sheet",
29
- "get_income_statement",
30
- "get_cash_flow",
31
- ]
1
+ """Akshare One - Unified interface for Chinese market data
2
+
3
+ Provides standardized access to various financial data sources with:
4
+ - Consistent symbol formats
5
+ - Unified data schemas
6
+ - Cleaned and normalized outputs
7
+
8
+ Example:
9
+ >>> from akshare_one import get_hist_data, get_realtime_data
10
+ >>> # 获取股票历史数据
11
+ >>> df = get_hist_data("600000", interval="day")
12
+ >>> print(df.head())
13
+ >>> # 获取股票实时数据
14
+ >>> df = get_realtime_data(symbol="600000")
15
+ """
16
+
17
+ from .stock import get_hist_data, get_realtime_data
18
+ from .news import get_news_data
19
+ from .insider import get_inner_trade_data
20
+ from .financial import get_balance_sheet, get_income_statement, get_cash_flow
21
+
22
+
23
+ __all__ = [
24
+ "get_hist_data",
25
+ "get_realtime_data",
26
+ "get_news_data",
27
+ "get_inner_trade_data",
28
+ "get_balance_sheet",
29
+ "get_income_statement",
30
+ "get_cash_flow",
31
+ ]
akshare_one/financial.py CHANGED
@@ -1,46 +1,46 @@
1
- """财务报表数据模块
2
-
3
- 包含资产负债表、利润表和现金流量表相关功能
4
- """
5
-
6
- import pandas as pd
7
- from akshare_one.modules.financial.factory import FinancialDataFactory
8
-
9
-
10
- def get_balance_sheet(symbol: str, source: str = "sina") -> "pd.DataFrame":
11
- """获取资产负债表数据
12
-
13
- Args:
14
- symbol: 股票代码 (如 "600600")
15
- source: 数据源 ("sina")
16
- """
17
- if source == "sina":
18
- provider = FinancialDataFactory.get_provider(source, symbol=symbol)
19
- return provider.get_balance_sheet()
20
- raise ValueError(f"Unsupported data source: {source}")
21
-
22
-
23
- def get_income_statement(symbol: str, source: str = "sina") -> "pd.DataFrame":
24
- """获取利润表数据
25
-
26
- Args:
27
- symbol: 股票代码 (如 "600600")
28
- source: 数据源 ("sina")
29
- """
30
- if source == "sina":
31
- provider = FinancialDataFactory.get_provider(source, symbol=symbol)
32
- return provider.get_income_statement()
33
- raise ValueError(f"Unsupported data source: {source}")
34
-
35
-
36
- def get_cash_flow(symbol: str, source: str = "sina") -> "pd.DataFrame":
37
- """获取现金流量表数据
38
-
39
- Args:
40
- symbol: 股票代码 (如 "600600")
41
- source: 数据源 ("sina")
42
- """
43
- if source == "sina":
44
- provider = FinancialDataFactory.get_provider(source, symbol=symbol)
45
- return provider.get_cash_flow()
46
- raise ValueError(f"Unsupported data source: {source}")
1
+ """财务报表数据模块
2
+
3
+ 包含资产负债表、利润表和现金流量表相关功能
4
+ """
5
+
6
+ import pandas as pd
7
+ from akshare_one.modules.financial.factory import FinancialDataFactory
8
+
9
+
10
+ def get_balance_sheet(symbol: str, source: str = "sina") -> "pd.DataFrame":
11
+ """获取资产负债表数据
12
+
13
+ Args:
14
+ symbol: 股票代码 (如 "600600")
15
+ source: 数据源 ("sina")
16
+ """
17
+ if source == "sina":
18
+ provider = FinancialDataFactory.get_provider(source, symbol=symbol)
19
+ return provider.get_balance_sheet()
20
+ raise ValueError(f"Unsupported data source: {source}")
21
+
22
+
23
+ def get_income_statement(symbol: str, source: str = "sina") -> "pd.DataFrame":
24
+ """获取利润表数据
25
+
26
+ Args:
27
+ symbol: 股票代码 (如 "600600")
28
+ source: 数据源 ("sina")
29
+ """
30
+ if source == "sina":
31
+ provider = FinancialDataFactory.get_provider(source, symbol=symbol)
32
+ return provider.get_income_statement()
33
+ raise ValueError(f"Unsupported data source: {source}")
34
+
35
+
36
+ def get_cash_flow(symbol: str, source: str = "sina") -> "pd.DataFrame":
37
+ """获取现金流量表数据
38
+
39
+ Args:
40
+ symbol: 股票代码 (如 "600600")
41
+ source: 数据源 ("sina")
42
+ """
43
+ if source == "sina":
44
+ provider = FinancialDataFactory.get_provider(source, symbol=symbol)
45
+ return provider.get_cash_flow()
46
+ raise ValueError(f"Unsupported data source: {source}")
@@ -0,0 +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)
akshare_one/insider.py CHANGED
@@ -1,33 +1,33 @@
1
- """内部交易数据模块
2
-
3
- 包含上市公司内部交易相关功能
4
- """
5
-
6
- import pandas as pd
7
- from .modules.insider.factory import InsiderDataFactory
8
-
9
-
10
- def get_inner_trade_data(symbol: str, source: str = "xueqiu") -> "pd.DataFrame":
11
- """获取雪球内部交易数据
12
-
13
- Args:
14
- source: 数据源 (目前支持 "xueqiu")
15
- symbol: 股票代码,如"600000"
16
-
17
- Returns:
18
- pd.DataFrame:
19
- - symbol: 股票代码
20
- - issuer: 股票名称
21
- - name: 变动人
22
- - title: 董监高职务
23
- - transaction_date: 变动日期(UTC时区)
24
- - transaction_shares: 变动股数
25
- - transaction_price_per_share: 成交均价
26
- - shares_owned_after_transaction: 变动后持股数
27
- - relationship: 与董监高关系
28
- - is_board_director: 是否为董事会成员
29
- - transaction_value: 交易金额(变动股数*成交均价)
30
- - shares_owned_before_transaction: 变动前持股数
31
- """
32
- provider = InsiderDataFactory.get_provider(source, symbol=symbol)
33
- return provider.get_inner_trade_data()
1
+ """内部交易数据模块
2
+
3
+ 包含上市公司内部交易相关功能
4
+ """
5
+
6
+ import pandas as pd
7
+ from .modules.insider.factory import InsiderDataFactory
8
+
9
+
10
+ def get_inner_trade_data(symbol: str, source: str = "xueqiu") -> "pd.DataFrame":
11
+ """获取雪球内部交易数据
12
+
13
+ Args:
14
+ source: 数据源 (目前支持 "xueqiu")
15
+ symbol: 股票代码,如"600000"
16
+
17
+ Returns:
18
+ pd.DataFrame:
19
+ - symbol: 股票代码
20
+ - issuer: 股票名称
21
+ - name: 变动人
22
+ - title: 董监高职务
23
+ - transaction_date: 变动日期(UTC时区)
24
+ - transaction_shares: 变动股数
25
+ - transaction_price_per_share: 成交均价
26
+ - shares_owned_after_transaction: 变动后持股数
27
+ - relationship: 与董监高关系
28
+ - is_board_director: 是否为董事会成员
29
+ - transaction_value: 交易金额(变动股数*成交均价)
30
+ - shares_owned_before_transaction: 变动前持股数
31
+ """
32
+ provider = InsiderDataFactory.get_provider(source, symbol=symbol)
33
+ return provider.get_inner_trade_data()
@@ -1,9 +1,9 @@
1
- from cachetools import TTLCache
2
-
3
- # 缓存配置
4
- CACHE_CONFIG = {
5
- "hist_data_cache": TTLCache(maxsize=1000, ttl=3600), # 历史数据缓存1小时
6
- "realtime_cache": TTLCache(maxsize=500, ttl=60), # 实时数据缓存1分钟
7
- "news_cache": TTLCache(maxsize=500, ttl=3600),
8
- "financial_cache": TTLCache(maxsize=500, ttl=86400), # 财务数据缓存24小时
9
- }
1
+ from cachetools import TTLCache
2
+
3
+ # 缓存配置
4
+ CACHE_CONFIG = {
5
+ "hist_data_cache": TTLCache(maxsize=1000, ttl=3600), # 历史数据缓存1小时
6
+ "realtime_cache": TTLCache(maxsize=500, ttl=60), # 实时数据缓存1分钟
7
+ "news_cache": TTLCache(maxsize=500, ttl=3600),
8
+ "financial_cache": TTLCache(maxsize=500, ttl=86400), # 财务数据缓存24小时
9
+ }