FinMind 2.0.0__tar.gz → 2.0.2__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.
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/data/data_loader.py +60 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/schema/data.py +3 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/schema/plot.py +15 -19
- {finmind-2.0.0/finmind.egg-info → finmind-2.0.2}/PKG-INFO +4 -5
- {finmind-2.0.0 → finmind-2.0.2/finmind.egg-info}/PKG-INFO +4 -5
- {finmind-2.0.0 → finmind-2.0.2}/finmind.egg-info/requires.txt +3 -4
- {finmind-2.0.0 → finmind-2.0.2}/pyproject.toml +3 -4
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/__init__.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/_version.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/crawler/__init__.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/crawler/base.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/crawler/commodities.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/crawler/demo.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/crawler/government_bonds.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/data/__init__.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/data/data_subscriber.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/data/finmind_api.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/indicators/__init__.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/indicators/bias.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/indicators/continue_holding.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/indicators/institutional_investors_follower.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/indicators/institutional_investors_over_buy.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/indicators/kd.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/indicators/kd_crossover.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/indicators/ma_cross_orver.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/indicators/short_sale_margin_purchase_ratio.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/plotting/__init__.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/plotting/bar.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/plotting/kline.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/plotting/line.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/plotting/pie.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/schema/__init__.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/schema/indicators.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/schema/info.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/schema/rule.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/strategies/__init__.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/strategies/base.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/strategies/bias.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/strategies/continue_holding.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/strategies/institutional_investors_follower.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/strategies/kd.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/strategies/kd_crossover.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/strategies/ma_crossover.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/strategies/macd_crossover.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/strategies/max_min_period_bias.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/strategies/naive_kd.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/strategies/short_sale_margin_purchase_ratio.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/strategies/utils.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/templates/post.html +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/utility/__init__.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/utility/request.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/FinMind/utility/rule.py +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/LICENSE +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/README.md +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/finmind.egg-info/SOURCES.txt +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/finmind.egg-info/dependency_links.txt +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/finmind.egg-info/top_level.txt +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/setup.cfg +0 -0
- {finmind-2.0.0 → finmind-2.0.2}/setup.py +0 -0
|
@@ -509,6 +509,55 @@ class DataLoader(FinMindApi):
|
|
|
509
509
|
)
|
|
510
510
|
return stock_institutional_investors
|
|
511
511
|
|
|
512
|
+
def taiwan_stock_institutional_investors_wide(
|
|
513
|
+
self,
|
|
514
|
+
stock_id: str = "",
|
|
515
|
+
start_date: str = "",
|
|
516
|
+
end_date: str = "",
|
|
517
|
+
timeout: int = None,
|
|
518
|
+
use_async: bool = False,
|
|
519
|
+
stock_id_list: typing.List[str] = None,
|
|
520
|
+
) -> pd.DataFrame:
|
|
521
|
+
"""get 個股三大法人買賣表(寬表)
|
|
522
|
+
|
|
523
|
+
與 taiwan_stock_institutional_investors 相同資料,改為寬表(橫式):
|
|
524
|
+
每個交易日一列,各法人別買進、賣出攤平成獨立欄位。欄位涵蓋所有歷史
|
|
525
|
+
法人別分類,尚未存在的年代該欄為 0(自營商於 2014-12-01 由合併拆為
|
|
526
|
+
自行買賣/避險、外資自營商於 2018-01-15 起提供)。
|
|
527
|
+
|
|
528
|
+
:param stock_id (str): 股票代號("2330")
|
|
529
|
+
:param start_date (str): 起始日期("2018-01-01")
|
|
530
|
+
:param end_date (str): 結束日期("2021-03-06")
|
|
531
|
+
:param timeout (int): timeout seconds, default None
|
|
532
|
+
|
|
533
|
+
:return: 個股三大法人買賣表(寬表)TaiwanStockInstitutionalInvestorsBuySellWide
|
|
534
|
+
:rtype pd.DataFrame
|
|
535
|
+
:rtype column date (str): 日期
|
|
536
|
+
:rtype column stock_id (str): 股票代碼
|
|
537
|
+
:rtype column Foreign_Investor_buy (int): 外資買進
|
|
538
|
+
:rtype column Foreign_Investor_sell (int): 外資賣出
|
|
539
|
+
:rtype column Foreign_Dealer_Self_buy (int): 外資自營商買進
|
|
540
|
+
:rtype column Foreign_Dealer_Self_sell (int): 外資自營商賣出
|
|
541
|
+
:rtype column Investment_Trust_buy (int): 投信買進
|
|
542
|
+
:rtype column Investment_Trust_sell (int): 投信賣出
|
|
543
|
+
:rtype column Dealer_buy (int): 自營商買進(合併,舊制)
|
|
544
|
+
:rtype column Dealer_sell (int): 自營商賣出(合併,舊制)
|
|
545
|
+
:rtype column Dealer_self_buy (int): 自營商買進(自行買賣)
|
|
546
|
+
:rtype column Dealer_self_sell (int): 自營商賣出(自行買賣)
|
|
547
|
+
:rtype column Dealer_Hedging_buy (int): 自營商買進(避險)
|
|
548
|
+
:rtype column Dealer_Hedging_sell (int): 自營商賣出(避險)
|
|
549
|
+
"""
|
|
550
|
+
stock_institutional_investors_wide = self.get_data(
|
|
551
|
+
dataset=Dataset.TaiwanStockInstitutionalInvestorsBuySellWide,
|
|
552
|
+
data_id=stock_id,
|
|
553
|
+
start_date=start_date,
|
|
554
|
+
end_date=end_date,
|
|
555
|
+
timeout=timeout,
|
|
556
|
+
use_async=use_async,
|
|
557
|
+
data_id_list=stock_id_list,
|
|
558
|
+
)
|
|
559
|
+
return stock_institutional_investors_wide
|
|
560
|
+
|
|
512
561
|
def taiwan_stock_institutional_investors_total(
|
|
513
562
|
self, start_date: str, end_date: str = "", timeout: int = None
|
|
514
563
|
) -> pd.DataFrame:
|
|
@@ -2440,12 +2489,17 @@ class DataLoader(FinMindApi):
|
|
|
2440
2489
|
date: str = "",
|
|
2441
2490
|
timeout: int = None,
|
|
2442
2491
|
use_async: bool = False,
|
|
2492
|
+
use_object: bool = False,
|
|
2443
2493
|
) -> pd.DataFrame:
|
|
2444
2494
|
"""get 當日權證卷商分點表
|
|
2445
2495
|
:param stock_id (str): 股票代號("2330")
|
|
2446
2496
|
:param securities_trader_id (str): 卷商代號("1020")
|
|
2447
2497
|
:param date (str): 日期("2018-01-01")
|
|
2448
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
|
|
2449
2503
|
|
|
2450
2504
|
:return: 當日權證卷商分點表 TaiwanStockWarrantTradingDailyReport
|
|
2451
2505
|
:rtype pd.DataFrame
|
|
@@ -2457,6 +2511,12 @@ class DataLoader(FinMindApi):
|
|
|
2457
2511
|
:rtype column stock_id (str): 股票代碼
|
|
2458
2512
|
:rtype column date (str): 日期
|
|
2459
2513
|
"""
|
|
2514
|
+
if use_object:
|
|
2515
|
+
return self.get_object(
|
|
2516
|
+
dataset=Dataset.TaiwanStockWarrantTradingDailyReport,
|
|
2517
|
+
date=date,
|
|
2518
|
+
timeout=timeout,
|
|
2519
|
+
)
|
|
2460
2520
|
stock_trading_daily_report = self.get_data(
|
|
2461
2521
|
dataset=Dataset.TaiwanStockWarrantTradingDailyReport,
|
|
2462
2522
|
data_id=stock_id,
|
|
@@ -7,6 +7,9 @@ class Dataset(str, Enum):
|
|
|
7
7
|
TaiwanStockInstitutionalInvestorsBuySell = (
|
|
8
8
|
"TaiwanStockInstitutionalInvestorsBuySell"
|
|
9
9
|
)
|
|
10
|
+
TaiwanStockInstitutionalInvestorsBuySellWide = (
|
|
11
|
+
"TaiwanStockInstitutionalInvestorsBuySellWide"
|
|
12
|
+
)
|
|
10
13
|
TaiwanStockTotalInstitutionalInvestors = (
|
|
11
14
|
"TaiwanStockTotalInstitutionalInvestors"
|
|
12
15
|
)
|
|
@@ -1,38 +1,34 @@
|
|
|
1
1
|
import typing
|
|
2
2
|
|
|
3
3
|
import pandas as pd
|
|
4
|
-
from pydantic import BaseModel,
|
|
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
|
-
@
|
|
10
|
+
@field_validator("labels")
|
|
11
|
+
@classmethod
|
|
11
12
|
def valid(cls, value):
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
@
|
|
24
|
+
@field_validator("series")
|
|
25
|
+
@classmethod
|
|
27
26
|
def valid(cls, value):
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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.
|
|
3
|
+
Version: 2.0.2
|
|
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<
|
|
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<
|
|
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<
|
|
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.
|
|
3
|
+
Version: 2.0.2
|
|
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<
|
|
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<
|
|
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<
|
|
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
|
+
numpy<3.0.0,>=1.19.5
|
|
3
3
|
requests<3.0.0,>=2.23.0
|
|
4
|
-
pydantic<
|
|
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<
|
|
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,<
|
|
27
|
+
"numpy>=1.19.5,<3.0.0",
|
|
28
28
|
"requests>=2.23.0,<3.0.0",
|
|
29
|
-
"pydantic>=
|
|
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,<
|
|
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
|
|
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
|
|
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
|
|
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
|