FinMind 2.0.1__tar.gz → 2.0.3__tar.gz

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 (59) hide show
  1. {finmind-2.0.1 → finmind-2.0.3}/FinMind/data/data_loader.py +11 -0
  2. {finmind-2.0.1 → finmind-2.0.3}/FinMind/data/finmind_api.py +18 -16
  3. {finmind-2.0.1 → finmind-2.0.3}/FinMind/schema/plot.py +15 -19
  4. {finmind-2.0.1/finmind.egg-info → finmind-2.0.3}/PKG-INFO +4 -5
  5. {finmind-2.0.1 → finmind-2.0.3/finmind.egg-info}/PKG-INFO +4 -5
  6. {finmind-2.0.1 → finmind-2.0.3}/finmind.egg-info/requires.txt +3 -4
  7. {finmind-2.0.1 → finmind-2.0.3}/pyproject.toml +3 -4
  8. {finmind-2.0.1 → finmind-2.0.3}/FinMind/__init__.py +0 -0
  9. {finmind-2.0.1 → finmind-2.0.3}/FinMind/_version.py +0 -0
  10. {finmind-2.0.1 → finmind-2.0.3}/FinMind/crawler/__init__.py +0 -0
  11. {finmind-2.0.1 → finmind-2.0.3}/FinMind/crawler/base.py +0 -0
  12. {finmind-2.0.1 → finmind-2.0.3}/FinMind/crawler/commodities.py +0 -0
  13. {finmind-2.0.1 → finmind-2.0.3}/FinMind/crawler/demo.py +0 -0
  14. {finmind-2.0.1 → finmind-2.0.3}/FinMind/crawler/government_bonds.py +0 -0
  15. {finmind-2.0.1 → finmind-2.0.3}/FinMind/data/__init__.py +0 -0
  16. {finmind-2.0.1 → finmind-2.0.3}/FinMind/data/data_subscriber.py +0 -0
  17. {finmind-2.0.1 → finmind-2.0.3}/FinMind/indicators/__init__.py +0 -0
  18. {finmind-2.0.1 → finmind-2.0.3}/FinMind/indicators/bias.py +0 -0
  19. {finmind-2.0.1 → finmind-2.0.3}/FinMind/indicators/continue_holding.py +0 -0
  20. {finmind-2.0.1 → finmind-2.0.3}/FinMind/indicators/institutional_investors_follower.py +0 -0
  21. {finmind-2.0.1 → finmind-2.0.3}/FinMind/indicators/institutional_investors_over_buy.py +0 -0
  22. {finmind-2.0.1 → finmind-2.0.3}/FinMind/indicators/kd.py +0 -0
  23. {finmind-2.0.1 → finmind-2.0.3}/FinMind/indicators/kd_crossover.py +0 -0
  24. {finmind-2.0.1 → finmind-2.0.3}/FinMind/indicators/ma_cross_orver.py +0 -0
  25. {finmind-2.0.1 → finmind-2.0.3}/FinMind/indicators/short_sale_margin_purchase_ratio.py +0 -0
  26. {finmind-2.0.1 → finmind-2.0.3}/FinMind/plotting/__init__.py +0 -0
  27. {finmind-2.0.1 → finmind-2.0.3}/FinMind/plotting/bar.py +0 -0
  28. {finmind-2.0.1 → finmind-2.0.3}/FinMind/plotting/kline.py +0 -0
  29. {finmind-2.0.1 → finmind-2.0.3}/FinMind/plotting/line.py +0 -0
  30. {finmind-2.0.1 → finmind-2.0.3}/FinMind/plotting/pie.py +0 -0
  31. {finmind-2.0.1 → finmind-2.0.3}/FinMind/schema/__init__.py +0 -0
  32. {finmind-2.0.1 → finmind-2.0.3}/FinMind/schema/data.py +0 -0
  33. {finmind-2.0.1 → finmind-2.0.3}/FinMind/schema/indicators.py +0 -0
  34. {finmind-2.0.1 → finmind-2.0.3}/FinMind/schema/info.py +0 -0
  35. {finmind-2.0.1 → finmind-2.0.3}/FinMind/schema/rule.py +0 -0
  36. {finmind-2.0.1 → finmind-2.0.3}/FinMind/strategies/__init__.py +0 -0
  37. {finmind-2.0.1 → finmind-2.0.3}/FinMind/strategies/base.py +0 -0
  38. {finmind-2.0.1 → finmind-2.0.3}/FinMind/strategies/bias.py +0 -0
  39. {finmind-2.0.1 → finmind-2.0.3}/FinMind/strategies/continue_holding.py +0 -0
  40. {finmind-2.0.1 → finmind-2.0.3}/FinMind/strategies/institutional_investors_follower.py +0 -0
  41. {finmind-2.0.1 → finmind-2.0.3}/FinMind/strategies/kd.py +0 -0
  42. {finmind-2.0.1 → finmind-2.0.3}/FinMind/strategies/kd_crossover.py +0 -0
  43. {finmind-2.0.1 → finmind-2.0.3}/FinMind/strategies/ma_crossover.py +0 -0
  44. {finmind-2.0.1 → finmind-2.0.3}/FinMind/strategies/macd_crossover.py +0 -0
  45. {finmind-2.0.1 → finmind-2.0.3}/FinMind/strategies/max_min_period_bias.py +0 -0
  46. {finmind-2.0.1 → finmind-2.0.3}/FinMind/strategies/naive_kd.py +0 -0
  47. {finmind-2.0.1 → finmind-2.0.3}/FinMind/strategies/short_sale_margin_purchase_ratio.py +0 -0
  48. {finmind-2.0.1 → finmind-2.0.3}/FinMind/strategies/utils.py +0 -0
  49. {finmind-2.0.1 → finmind-2.0.3}/FinMind/templates/post.html +0 -0
  50. {finmind-2.0.1 → finmind-2.0.3}/FinMind/utility/__init__.py +0 -0
  51. {finmind-2.0.1 → finmind-2.0.3}/FinMind/utility/request.py +0 -0
  52. {finmind-2.0.1 → finmind-2.0.3}/FinMind/utility/rule.py +0 -0
  53. {finmind-2.0.1 → finmind-2.0.3}/LICENSE +0 -0
  54. {finmind-2.0.1 → finmind-2.0.3}/README.md +0 -0
  55. {finmind-2.0.1 → finmind-2.0.3}/finmind.egg-info/SOURCES.txt +0 -0
  56. {finmind-2.0.1 → finmind-2.0.3}/finmind.egg-info/dependency_links.txt +0 -0
  57. {finmind-2.0.1 → finmind-2.0.3}/finmind.egg-info/top_level.txt +0 -0
  58. {finmind-2.0.1 → finmind-2.0.3}/setup.cfg +0 -0
  59. {finmind-2.0.1 → finmind-2.0.3}/setup.py +0 -0
@@ -2489,12 +2489,17 @@ class DataLoader(FinMindApi):
2489
2489
  date: str = "",
2490
2490
  timeout: int = None,
2491
2491
  use_async: bool = False,
2492
+ use_object: bool = False,
2492
2493
  ) -> pd.DataFrame:
2493
2494
  """get 當日權證卷商分點表
2494
2495
  :param stock_id (str): 股票代號("2330")
2495
2496
  :param securities_trader_id (str): 卷商代號("1020")
2496
2497
  :param date (str): 日期("2018-01-01")
2497
2498
  :param timeout (int): timeout seconds, default None
2499
+ :param use_async (bool): 是否使用非同步下載, default False
2500
+ :param use_object (bool): 是否透過 signed URL 下載整日 parquet 資料物件,
2501
+ 設為 True 時忽略 stock_id, securities_trader_id, stock_id_list,
2502
+ use_async 參數, default False
2498
2503
 
2499
2504
  :return: 當日權證卷商分點表 TaiwanStockWarrantTradingDailyReport
2500
2505
  :rtype pd.DataFrame
@@ -2506,6 +2511,12 @@ class DataLoader(FinMindApi):
2506
2511
  :rtype column stock_id (str): 股票代碼
2507
2512
  :rtype column date (str): 日期
2508
2513
  """
2514
+ if use_object:
2515
+ return self.get_object(
2516
+ dataset=Dataset.TaiwanStockWarrantTradingDailyReport,
2517
+ date=date,
2518
+ timeout=timeout,
2519
+ )
2509
2520
  stock_trading_daily_report = self.get_data(
2510
2521
  dataset=Dataset.TaiwanStockWarrantTradingDailyReport,
2511
2522
  data_id=stock_id,
@@ -144,22 +144,24 @@ class FinMindApi:
144
144
  :param params: finmind api參數
145
145
  :return:
146
146
  """
147
- if use_async:
148
- if securities_trader_id_list:
149
- return self._get_data_with_async_with_securities_trader_id(
150
- dataset=dataset,
151
- securities_trader_id_list=securities_trader_id_list,
152
- start_date=start_date,
153
- end_date=end_date,
154
- )
155
- elif data_id_list:
156
- return self._get_data_with_async(
157
- dataset=dataset,
158
- data_id_list=data_id_list,
159
- start_date=start_date,
160
- end_date=end_date,
161
- max_retry_times=max_retry_times,
162
- )
147
+ # 只要傳入 id 列表就走非同步批次下載,不再依賴 use_async 旗標。
148
+ # 過去 use_async 預設 False 時 sync 分支會忽略 data_id_list、
149
+ # 只用空的 data_id 查詢,導致回傳空 DataFrame。
150
+ if securities_trader_id_list:
151
+ return self._get_data_with_async_with_securities_trader_id(
152
+ dataset=dataset,
153
+ securities_trader_id_list=securities_trader_id_list,
154
+ start_date=start_date,
155
+ end_date=end_date,
156
+ )
157
+ elif data_id_list:
158
+ return self._get_data_with_async(
159
+ dataset=dataset,
160
+ data_id_list=data_id_list,
161
+ start_date=start_date,
162
+ end_date=end_date,
163
+ max_retry_times=max_retry_times,
164
+ )
163
165
  else:
164
166
  logger.info(f"download {dataset}, data_id: {data_id}")
165
167
  params = dict(
@@ -1,38 +1,34 @@
1
1
  import typing
2
2
 
3
3
  import pandas as pd
4
- from pydantic import BaseModel, validator
4
+ from pydantic import BaseModel, field_validator
5
5
 
6
6
 
7
7
  class Labels(BaseModel):
8
8
  labels: typing.List[typing.Union[str, int]]
9
9
 
10
- @validator("labels", allow_reuse=True, each_item=True)
10
+ @field_validator("labels")
11
+ @classmethod
11
12
  def valid(cls, value):
12
- if isinstance(value, str):
13
- pass
14
- elif isinstance(value, int):
15
- pass
16
- else:
17
- raise Exception(
18
- "the type of labels must be list[int] for list[str]."
19
- )
13
+ for item in value:
14
+ if not isinstance(item, (str, int)):
15
+ raise Exception(
16
+ "the type of labels must be list[int] for list[str]."
17
+ )
20
18
  return value
21
19
 
22
20
 
23
21
  class Series(BaseModel):
24
22
  series: typing.List[typing.Union[int, float]]
25
23
 
26
- @validator("series", allow_reuse=True, each_item=True)
24
+ @field_validator("series")
25
+ @classmethod
27
26
  def valid(cls, value):
28
- if isinstance(value, int):
29
- pass
30
- elif isinstance(value, float):
31
- pass
32
- else:
33
- raise Exception(
34
- "the type of series must be list[int] for list[str]."
35
- )
27
+ for item in value:
28
+ if not isinstance(item, (int, float)):
29
+ raise Exception(
30
+ "the type of series must be list[int] for list[str]."
31
+ )
36
32
  return value
37
33
 
38
34
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: finmind
3
- Version: 2.0.1
3
+ Version: 2.0.3
4
4
  Summary: financial mining
5
5
  Author-email: linsam <finmind.tw@gmail.com>
6
6
  License: Apache License
@@ -219,17 +219,16 @@ Requires-Python: >=3.8
219
219
  Description-Content-Type: text/markdown
220
220
  License-File: LICENSE
221
221
  Requires-Dist: pandas<3.0.0,>=2.0.0
222
- Requires-Dist: numpy<2.0.0,>=1.19.5
222
+ Requires-Dist: numpy<3.0.0,>=1.19.5
223
223
  Requires-Dist: requests<3.0.0,>=2.23.0
224
- Requires-Dist: pydantic<2.0.0,>=1.6.1
224
+ Requires-Dist: pydantic<3.0.0,>=2.0.0
225
225
  Requires-Dist: ta<1.0.0,>=0.11.0
226
226
  Requires-Dist: lxml<5.0.0,>=4.6.3
227
227
  Requires-Dist: pyecharts<2.0.0,>=1.9.0
228
228
  Requires-Dist: ipython<8.0.0,>=7.16.1
229
229
  Requires-Dist: loguru<1.0.0,>=0.5.3
230
230
  Requires-Dist: aiohttp<4.0.0,>=3.7.4.post0
231
- Requires-Dist: importlib-metadata<5.0.0,>=4.8.1
232
- Requires-Dist: Flask<3.0.0,>=2.0.2
231
+ Requires-Dist: importlib-metadata<9.0.0,>=4.8.1
233
232
  Requires-Dist: typing-extensions<5.0.0,>=4.0.0
234
233
  Requires-Dist: tqdm
235
234
  Requires-Dist: nest-asyncio==1.6.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: finmind
3
- Version: 2.0.1
3
+ Version: 2.0.3
4
4
  Summary: financial mining
5
5
  Author-email: linsam <finmind.tw@gmail.com>
6
6
  License: Apache License
@@ -219,17 +219,16 @@ Requires-Python: >=3.8
219
219
  Description-Content-Type: text/markdown
220
220
  License-File: LICENSE
221
221
  Requires-Dist: pandas<3.0.0,>=2.0.0
222
- Requires-Dist: numpy<2.0.0,>=1.19.5
222
+ Requires-Dist: numpy<3.0.0,>=1.19.5
223
223
  Requires-Dist: requests<3.0.0,>=2.23.0
224
- Requires-Dist: pydantic<2.0.0,>=1.6.1
224
+ Requires-Dist: pydantic<3.0.0,>=2.0.0
225
225
  Requires-Dist: ta<1.0.0,>=0.11.0
226
226
  Requires-Dist: lxml<5.0.0,>=4.6.3
227
227
  Requires-Dist: pyecharts<2.0.0,>=1.9.0
228
228
  Requires-Dist: ipython<8.0.0,>=7.16.1
229
229
  Requires-Dist: loguru<1.0.0,>=0.5.3
230
230
  Requires-Dist: aiohttp<4.0.0,>=3.7.4.post0
231
- Requires-Dist: importlib-metadata<5.0.0,>=4.8.1
232
- Requires-Dist: Flask<3.0.0,>=2.0.2
231
+ Requires-Dist: importlib-metadata<9.0.0,>=4.8.1
233
232
  Requires-Dist: typing-extensions<5.0.0,>=4.0.0
234
233
  Requires-Dist: tqdm
235
234
  Requires-Dist: nest-asyncio==1.6.0
@@ -1,15 +1,14 @@
1
1
  pandas<3.0.0,>=2.0.0
2
- numpy<2.0.0,>=1.19.5
2
+ numpy<3.0.0,>=1.19.5
3
3
  requests<3.0.0,>=2.23.0
4
- pydantic<2.0.0,>=1.6.1
4
+ pydantic<3.0.0,>=2.0.0
5
5
  ta<1.0.0,>=0.11.0
6
6
  lxml<5.0.0,>=4.6.3
7
7
  pyecharts<2.0.0,>=1.9.0
8
8
  ipython<8.0.0,>=7.16.1
9
9
  loguru<1.0.0,>=0.5.3
10
10
  aiohttp<4.0.0,>=3.7.4.post0
11
- importlib-metadata<5.0.0,>=4.8.1
12
- Flask<3.0.0,>=2.0.2
11
+ importlib-metadata<9.0.0,>=4.8.1
13
12
  typing-extensions<5.0.0,>=4.0.0
14
13
  tqdm
15
14
  nest-asyncio==1.6.0
@@ -24,17 +24,16 @@ classifiers = [
24
24
  dynamic = ["version"]
25
25
  dependencies = [
26
26
  "pandas>=2.0.0,<3.0.0",
27
- "numpy>=1.19.5,<2.0.0",
27
+ "numpy>=1.19.5,<3.0.0",
28
28
  "requests>=2.23.0,<3.0.0",
29
- "pydantic>=1.6.1,<2.0.0",
29
+ "pydantic>=2.0.0,<3.0.0",
30
30
  "ta>=0.11.0,<1.0.0",
31
31
  "lxml>=4.6.3,<5.0.0",
32
32
  "pyecharts>=1.9.0,<2.0.0",
33
33
  "ipython>=7.16.1,<8.0.0",
34
34
  "loguru>=0.5.3,<1.0.0",
35
35
  "aiohttp>=3.7.4.post0,<4.0.0",
36
- "importlib-metadata>=4.8.1,<5.0.0",
37
- "Flask>=2.0.2,<3.0.0",
36
+ "importlib-metadata>=4.8.1,<9.0.0",
38
37
  "typing-extensions>=4.0.0,<5.0.0",
39
38
  "tqdm",
40
39
  "nest-asyncio==1.6.0",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes