neurostats-API 0.0.12__tar.gz → 0.0.13__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {neurostats_api-0.0.12 → neurostats_API-0.0.13}/PKG-INFO +74 -2
- {neurostats_api-0.0.12 → neurostats_API-0.0.13}/README.md +73 -1
- neurostats_API-0.0.13/neurostats_API/__init__.py +1 -0
- {neurostats_api-0.0.12 → neurostats_API-0.0.13}/neurostats_API/fetchers/value_invest.py +72 -0
- {neurostats_api-0.0.12 → neurostats_API-0.0.13}/neurostats_API.egg-info/PKG-INFO +75 -3
- {neurostats_api-0.0.12 → neurostats_API-0.0.13}/setup.py +1 -1
- {neurostats_api-0.0.12 → neurostats_API-0.0.13}/test/test_fetchers.py +13 -0
- neurostats_api-0.0.12/neurostats_API/__init__.py +0 -1
- {neurostats_api-0.0.12 → neurostats_API-0.0.13}/MANIFEST.in +0 -0
- {neurostats_api-0.0.12 → neurostats_API-0.0.13}/neurostats_API/cli.py +0 -0
- {neurostats_api-0.0.12 → neurostats_API-0.0.13}/neurostats_API/fetchers/__init__.py +0 -0
- {neurostats_api-0.0.12 → neurostats_API-0.0.13}/neurostats_API/fetchers/balance_sheet.py +0 -0
- {neurostats_api-0.0.12 → neurostats_API-0.0.13}/neurostats_API/fetchers/base.py +0 -0
- {neurostats_api-0.0.12 → neurostats_API-0.0.13}/neurostats_API/fetchers/cash_flow.py +0 -0
- {neurostats_api-0.0.12 → neurostats_API-0.0.13}/neurostats_API/fetchers/finance_overview.py +0 -0
- {neurostats_api-0.0.12 → neurostats_API-0.0.13}/neurostats_API/fetchers/institution.py +0 -0
- {neurostats_api-0.0.12 → neurostats_API-0.0.13}/neurostats_API/fetchers/margin_trading.py +0 -0
- {neurostats_api-0.0.12 → neurostats_API-0.0.13}/neurostats_API/fetchers/month_revenue.py +0 -0
- {neurostats_api-0.0.12 → neurostats_API-0.0.13}/neurostats_API/fetchers/profit_lose.py +0 -0
- {neurostats_api-0.0.12 → neurostats_API-0.0.13}/neurostats_API/fetchers/tech.py +0 -0
- {neurostats_api-0.0.12 → neurostats_API-0.0.13}/neurostats_API/main.py +0 -0
- {neurostats_api-0.0.12 → neurostats_API-0.0.13}/neurostats_API/tools/balance_sheet.yaml +0 -0
- {neurostats_api-0.0.12 → neurostats_API-0.0.13}/neurostats_API/tools/cash_flow_percentage.yaml +0 -0
- {neurostats_api-0.0.12 → neurostats_API-0.0.13}/neurostats_API/tools/finance_overview_dict.yaml +0 -0
- {neurostats_api-0.0.12 → neurostats_API-0.0.13}/neurostats_API/tools/profit_lose.yaml +0 -0
- {neurostats_api-0.0.12 → neurostats_API-0.0.13}/neurostats_API/tools/seasonal_data_field_dict.txt +0 -0
- {neurostats_api-0.0.12 → neurostats_API-0.0.13}/neurostats_API/utils/__init__.py +0 -0
- {neurostats_api-0.0.12 → neurostats_API-0.0.13}/neurostats_API/utils/data_process.py +0 -0
- {neurostats_api-0.0.12 → neurostats_API-0.0.13}/neurostats_API/utils/datetime.py +0 -0
- {neurostats_api-0.0.12 → neurostats_API-0.0.13}/neurostats_API/utils/db_client.py +0 -0
- {neurostats_api-0.0.12 → neurostats_API-0.0.13}/neurostats_API/utils/fetcher.py +0 -0
- {neurostats_api-0.0.12 → neurostats_API-0.0.13}/neurostats_API.egg-info/SOURCES.txt +0 -0
- {neurostats_api-0.0.12 → neurostats_API-0.0.13}/neurostats_API.egg-info/dependency_links.txt +0 -0
- {neurostats_api-0.0.12 → neurostats_API-0.0.13}/neurostats_API.egg-info/top_level.txt +0 -0
- {neurostats_api-0.0.12 → neurostats_API-0.0.13}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: neurostats_API
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.13
|
4
4
|
Summary: The service of NeuroStats website
|
5
5
|
Home-page: https://github.com/NeurowattStats/NeuroStats_API.git
|
6
6
|
Author: JasonWang@Neurowatt
|
@@ -14,6 +14,7 @@ Description-Content-Type: text/markdown
|
|
14
14
|
- [使用方法](#使用方法)
|
15
15
|
- [下載](#下載)
|
16
16
|
- [價值投資](#得到最新一期的評價資料與歷年評價)
|
17
|
+
- [歷史評價](#得到指定公司的歷來評價)
|
17
18
|
- [財務分析-重要指標](#財務分析-重要指標)
|
18
19
|
- [月營收表](#回傳月營收表)
|
19
20
|
- [損益表](#損益表)
|
@@ -82,7 +83,7 @@ pip install neurostats-API
|
|
82
83
|
```Python
|
83
84
|
>>> import neurostats_API
|
84
85
|
>>> print(neurostats_API.__version__)
|
85
|
-
0.0.
|
86
|
+
0.0.13
|
86
87
|
```
|
87
88
|
|
88
89
|
### 得到最新一期的評價資料與歷年評價
|
@@ -127,6 +128,69 @@ fetcher.query_data()
|
|
127
128
|
```
|
128
129
|
> 這裡有Nan是因為本益比與P/B等資料沒有爬到最新的時間
|
129
130
|
|
131
|
+
### 得到指定公司的歷來評價
|
132
|
+
``` Python
|
133
|
+
from neurostats_API.utils import ValueFetcher, DBClient
|
134
|
+
db_client = DBClient("<連接的DB位置>").get_client()
|
135
|
+
ticker = "2330" # 換成tw50內任意ticker
|
136
|
+
fetcher = ValueFetcher(ticker, db_client)
|
137
|
+
|
138
|
+
fetcher.query_value_serie()
|
139
|
+
```
|
140
|
+
#### 回傳(2330為例)
|
141
|
+
```Python
|
142
|
+
{
|
143
|
+
'EV_EBIT': EV_EBIT
|
144
|
+
2014-01-02 NaN
|
145
|
+
2014-01-03 NaN
|
146
|
+
... ...
|
147
|
+
2024-12-12 15.021431
|
148
|
+
2024-12-13 15.088321
|
149
|
+
,
|
150
|
+
'EV_OPI': EV_OPI
|
151
|
+
2014-01-03 NaN
|
152
|
+
... ...
|
153
|
+
2024-12-12 15.999880
|
154
|
+
2024-12-13 16.071128
|
155
|
+
,
|
156
|
+
'EV_S': EV_S
|
157
|
+
2014-01-02 NaN
|
158
|
+
2014-01-03 NaN
|
159
|
+
... ...
|
160
|
+
2024-12-12 6.945457
|
161
|
+
2024-12-13 6.976385
|
162
|
+
,
|
163
|
+
'P_B': P_B
|
164
|
+
2014-01-02 NaN
|
165
|
+
2014-01-03 NaN
|
166
|
+
... ...
|
167
|
+
2024-12-12 6.79
|
168
|
+
2024-12-13 6.89
|
169
|
+
,
|
170
|
+
'P_E': P_E
|
171
|
+
2014-01-02 NaN
|
172
|
+
2014-01-03 NaN
|
173
|
+
... ...
|
174
|
+
2024-12-12 26.13
|
175
|
+
2024-12-13 26.50
|
176
|
+
,
|
177
|
+
'P_FCF': P_FCF
|
178
|
+
2014-01-02 NaN
|
179
|
+
2014-01-03 NaN
|
180
|
+
... ...
|
181
|
+
2024-12-12 45.302108
|
182
|
+
2024-12-13 45.515797
|
183
|
+
,
|
184
|
+
'P_S': P_S
|
185
|
+
2014-01-02 NaN
|
186
|
+
2014-01-03 NaN
|
187
|
+
... ...
|
188
|
+
2024-12-12 6.556760
|
189
|
+
2024-12-13 6.587688
|
190
|
+
}
|
191
|
+
```
|
192
|
+
|
193
|
+
|
130
194
|
### 回傳月營收表
|
131
195
|
``` Python
|
132
196
|
from neurostats_API.fetchers import MonthRevenueFetcher, DBClient
|
@@ -604,6 +668,14 @@ fetcher.query()
|
|
604
668
|
請注意`range`, `last_range`, `52week_range`這三個項目型態為字串,其餘為float
|
605
669
|
|
606
670
|
## 版本紀錄
|
671
|
+
### 0.0.13
|
672
|
+
- value_fetcher 新增獲得一序列評價的功能
|
673
|
+
|
674
|
+
### 0.0.12
|
675
|
+
- 新增資券變化(margin trading)
|
676
|
+
|
677
|
+
- 修改法人買賣(institution_trading)的query方式
|
678
|
+
|
607
679
|
### 0.0.11
|
608
680
|
- 修復財務分析的千元計算問題
|
609
681
|
|
@@ -4,6 +4,7 @@
|
|
4
4
|
- [使用方法](#使用方法)
|
5
5
|
- [下載](#下載)
|
6
6
|
- [價值投資](#得到最新一期的評價資料與歷年評價)
|
7
|
+
- [歷史評價](#得到指定公司的歷來評價)
|
7
8
|
- [財務分析-重要指標](#財務分析-重要指標)
|
8
9
|
- [月營收表](#回傳月營收表)
|
9
10
|
- [損益表](#損益表)
|
@@ -72,7 +73,7 @@ pip install neurostats-API
|
|
72
73
|
```Python
|
73
74
|
>>> import neurostats_API
|
74
75
|
>>> print(neurostats_API.__version__)
|
75
|
-
0.0.
|
76
|
+
0.0.13
|
76
77
|
```
|
77
78
|
|
78
79
|
### 得到最新一期的評價資料與歷年評價
|
@@ -117,6 +118,69 @@ fetcher.query_data()
|
|
117
118
|
```
|
118
119
|
> 這裡有Nan是因為本益比與P/B等資料沒有爬到最新的時間
|
119
120
|
|
121
|
+
### 得到指定公司的歷來評價
|
122
|
+
``` Python
|
123
|
+
from neurostats_API.utils import ValueFetcher, DBClient
|
124
|
+
db_client = DBClient("<連接的DB位置>").get_client()
|
125
|
+
ticker = "2330" # 換成tw50內任意ticker
|
126
|
+
fetcher = ValueFetcher(ticker, db_client)
|
127
|
+
|
128
|
+
fetcher.query_value_serie()
|
129
|
+
```
|
130
|
+
#### 回傳(2330為例)
|
131
|
+
```Python
|
132
|
+
{
|
133
|
+
'EV_EBIT': EV_EBIT
|
134
|
+
2014-01-02 NaN
|
135
|
+
2014-01-03 NaN
|
136
|
+
... ...
|
137
|
+
2024-12-12 15.021431
|
138
|
+
2024-12-13 15.088321
|
139
|
+
,
|
140
|
+
'EV_OPI': EV_OPI
|
141
|
+
2014-01-03 NaN
|
142
|
+
... ...
|
143
|
+
2024-12-12 15.999880
|
144
|
+
2024-12-13 16.071128
|
145
|
+
,
|
146
|
+
'EV_S': EV_S
|
147
|
+
2014-01-02 NaN
|
148
|
+
2014-01-03 NaN
|
149
|
+
... ...
|
150
|
+
2024-12-12 6.945457
|
151
|
+
2024-12-13 6.976385
|
152
|
+
,
|
153
|
+
'P_B': P_B
|
154
|
+
2014-01-02 NaN
|
155
|
+
2014-01-03 NaN
|
156
|
+
... ...
|
157
|
+
2024-12-12 6.79
|
158
|
+
2024-12-13 6.89
|
159
|
+
,
|
160
|
+
'P_E': P_E
|
161
|
+
2014-01-02 NaN
|
162
|
+
2014-01-03 NaN
|
163
|
+
... ...
|
164
|
+
2024-12-12 26.13
|
165
|
+
2024-12-13 26.50
|
166
|
+
,
|
167
|
+
'P_FCF': P_FCF
|
168
|
+
2014-01-02 NaN
|
169
|
+
2014-01-03 NaN
|
170
|
+
... ...
|
171
|
+
2024-12-12 45.302108
|
172
|
+
2024-12-13 45.515797
|
173
|
+
,
|
174
|
+
'P_S': P_S
|
175
|
+
2014-01-02 NaN
|
176
|
+
2014-01-03 NaN
|
177
|
+
... ...
|
178
|
+
2024-12-12 6.556760
|
179
|
+
2024-12-13 6.587688
|
180
|
+
}
|
181
|
+
```
|
182
|
+
|
183
|
+
|
120
184
|
### 回傳月營收表
|
121
185
|
``` Python
|
122
186
|
from neurostats_API.fetchers import MonthRevenueFetcher, DBClient
|
@@ -594,6 +658,14 @@ fetcher.query()
|
|
594
658
|
請注意`range`, `last_range`, `52week_range`這三個項目型態為字串,其餘為float
|
595
659
|
|
596
660
|
## 版本紀錄
|
661
|
+
### 0.0.13
|
662
|
+
- value_fetcher 新增獲得一序列評價的功能
|
663
|
+
|
664
|
+
### 0.0.12
|
665
|
+
- 新增資券變化(margin trading)
|
666
|
+
|
667
|
+
- 修改法人買賣(institution_trading)的query方式
|
668
|
+
|
597
669
|
### 0.0.11
|
598
670
|
- 修復財務分析的千元計算問題
|
599
671
|
|
@@ -0,0 +1 @@
|
|
1
|
+
__version__='0.0.13'
|
@@ -79,6 +79,78 @@ class ValueFetcher(StatsFetcher):
|
|
79
79
|
)
|
80
80
|
|
81
81
|
return fetched_data
|
82
|
+
|
83
|
+
def query_value_serie(self):
|
84
|
+
"""
|
85
|
+
回傳指定公司的歷來評價
|
86
|
+
return : Dict[pd.DataFrame]
|
87
|
+
Dict中包含以下八個key, 每個key對應DataFrame
|
88
|
+
{
|
89
|
+
P_E,
|
90
|
+
P_FCF,
|
91
|
+
P_S,
|
92
|
+
P_B,
|
93
|
+
EV_OPI,
|
94
|
+
EV_EBIT,
|
95
|
+
EV_EBITDA,
|
96
|
+
EV_S
|
97
|
+
}
|
98
|
+
"""
|
99
|
+
|
100
|
+
pipeline = [
|
101
|
+
{
|
102
|
+
"$match": {
|
103
|
+
"ticker": self.ticker,
|
104
|
+
}
|
105
|
+
},
|
106
|
+
{
|
107
|
+
"$project": {
|
108
|
+
"_id": 0,
|
109
|
+
"ticker": 1,
|
110
|
+
"company_name": 1,
|
111
|
+
"daily_data": {
|
112
|
+
"$map": {
|
113
|
+
"input": "$daily_data", # 正確地指定要處理的陣列
|
114
|
+
"as": "daily", # 每個元素的名稱
|
115
|
+
"in": {
|
116
|
+
"date": "$$daily.date",
|
117
|
+
"P_E": "$$daily.P_E",
|
118
|
+
"P_FCF": "$$daily.P_FCF",
|
119
|
+
"P_B": "$$daily.P_B",
|
120
|
+
"P_S": "$$daily.P_S",
|
121
|
+
"EV_OPI": "$$daily.EV_OPI",
|
122
|
+
"EV_EBIT": "$$daily.EV_EBIT",
|
123
|
+
"EV_EBITDA": "$$daily.EV_EBITDA",
|
124
|
+
"EV_S": "$$daily.EV_S"
|
125
|
+
}
|
126
|
+
}
|
127
|
+
}
|
128
|
+
}
|
129
|
+
}
|
130
|
+
]
|
131
|
+
|
132
|
+
fetched_data = self.collection.aggregate(pipeline).to_list()
|
133
|
+
fetched_data = fetched_data[0]
|
134
|
+
|
135
|
+
value_keys = ["P_E", "P_FCF", "P_B", "P_S", "EV_OPI", "EV_EBIT", "EV_EVITDA", "EV_S"]
|
136
|
+
return_dict = {
|
137
|
+
value_key: dict() for value_key in value_keys
|
138
|
+
}
|
139
|
+
|
140
|
+
for value_key in value_keys:
|
141
|
+
for data in fetched_data['daily_data']:
|
142
|
+
if (value_key not in data.keys()):
|
143
|
+
continue
|
144
|
+
else:
|
145
|
+
return_dict[value_key].update({
|
146
|
+
data['date']: data[value_key]
|
147
|
+
})
|
148
|
+
|
149
|
+
return_dict = {
|
150
|
+
value_key: pd.DataFrame.from_dict(value_dict, orient = 'index', columns = [value_key])
|
151
|
+
for value_key, value_dict in return_dict.items()
|
152
|
+
}
|
153
|
+
return return_dict
|
82
154
|
|
83
155
|
|
84
156
|
class ValueProcessor(StatsProcessor):
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
|
-
Name:
|
3
|
-
Version: 0.0.
|
2
|
+
Name: neurostats-API
|
3
|
+
Version: 0.0.13
|
4
4
|
Summary: The service of NeuroStats website
|
5
5
|
Home-page: https://github.com/NeurowattStats/NeuroStats_API.git
|
6
6
|
Author: JasonWang@Neurowatt
|
@@ -14,6 +14,7 @@ Description-Content-Type: text/markdown
|
|
14
14
|
- [使用方法](#使用方法)
|
15
15
|
- [下載](#下載)
|
16
16
|
- [價值投資](#得到最新一期的評價資料與歷年評價)
|
17
|
+
- [歷史評價](#得到指定公司的歷來評價)
|
17
18
|
- [財務分析-重要指標](#財務分析-重要指標)
|
18
19
|
- [月營收表](#回傳月營收表)
|
19
20
|
- [損益表](#損益表)
|
@@ -82,7 +83,7 @@ pip install neurostats-API
|
|
82
83
|
```Python
|
83
84
|
>>> import neurostats_API
|
84
85
|
>>> print(neurostats_API.__version__)
|
85
|
-
0.0.
|
86
|
+
0.0.13
|
86
87
|
```
|
87
88
|
|
88
89
|
### 得到最新一期的評價資料與歷年評價
|
@@ -127,6 +128,69 @@ fetcher.query_data()
|
|
127
128
|
```
|
128
129
|
> 這裡有Nan是因為本益比與P/B等資料沒有爬到最新的時間
|
129
130
|
|
131
|
+
### 得到指定公司的歷來評價
|
132
|
+
``` Python
|
133
|
+
from neurostats_API.utils import ValueFetcher, DBClient
|
134
|
+
db_client = DBClient("<連接的DB位置>").get_client()
|
135
|
+
ticker = "2330" # 換成tw50內任意ticker
|
136
|
+
fetcher = ValueFetcher(ticker, db_client)
|
137
|
+
|
138
|
+
fetcher.query_value_serie()
|
139
|
+
```
|
140
|
+
#### 回傳(2330為例)
|
141
|
+
```Python
|
142
|
+
{
|
143
|
+
'EV_EBIT': EV_EBIT
|
144
|
+
2014-01-02 NaN
|
145
|
+
2014-01-03 NaN
|
146
|
+
... ...
|
147
|
+
2024-12-12 15.021431
|
148
|
+
2024-12-13 15.088321
|
149
|
+
,
|
150
|
+
'EV_OPI': EV_OPI
|
151
|
+
2014-01-03 NaN
|
152
|
+
... ...
|
153
|
+
2024-12-12 15.999880
|
154
|
+
2024-12-13 16.071128
|
155
|
+
,
|
156
|
+
'EV_S': EV_S
|
157
|
+
2014-01-02 NaN
|
158
|
+
2014-01-03 NaN
|
159
|
+
... ...
|
160
|
+
2024-12-12 6.945457
|
161
|
+
2024-12-13 6.976385
|
162
|
+
,
|
163
|
+
'P_B': P_B
|
164
|
+
2014-01-02 NaN
|
165
|
+
2014-01-03 NaN
|
166
|
+
... ...
|
167
|
+
2024-12-12 6.79
|
168
|
+
2024-12-13 6.89
|
169
|
+
,
|
170
|
+
'P_E': P_E
|
171
|
+
2014-01-02 NaN
|
172
|
+
2014-01-03 NaN
|
173
|
+
... ...
|
174
|
+
2024-12-12 26.13
|
175
|
+
2024-12-13 26.50
|
176
|
+
,
|
177
|
+
'P_FCF': P_FCF
|
178
|
+
2014-01-02 NaN
|
179
|
+
2014-01-03 NaN
|
180
|
+
... ...
|
181
|
+
2024-12-12 45.302108
|
182
|
+
2024-12-13 45.515797
|
183
|
+
,
|
184
|
+
'P_S': P_S
|
185
|
+
2014-01-02 NaN
|
186
|
+
2014-01-03 NaN
|
187
|
+
... ...
|
188
|
+
2024-12-12 6.556760
|
189
|
+
2024-12-13 6.587688
|
190
|
+
}
|
191
|
+
```
|
192
|
+
|
193
|
+
|
130
194
|
### 回傳月營收表
|
131
195
|
``` Python
|
132
196
|
from neurostats_API.fetchers import MonthRevenueFetcher, DBClient
|
@@ -604,6 +668,14 @@ fetcher.query()
|
|
604
668
|
請注意`range`, `last_range`, `52week_range`這三個項目型態為字串,其餘為float
|
605
669
|
|
606
670
|
## 版本紀錄
|
671
|
+
### 0.0.13
|
672
|
+
- value_fetcher 新增獲得一序列評價的功能
|
673
|
+
|
674
|
+
### 0.0.12
|
675
|
+
- 新增資券變化(margin trading)
|
676
|
+
|
677
|
+
- 修改法人買賣(institution_trading)的query方式
|
678
|
+
|
607
679
|
### 0.0.11
|
608
680
|
- 修復財務分析的千元計算問題
|
609
681
|
|
@@ -16,6 +16,19 @@ with open(f"./neurostats_API/tw50_company_list.json") as f:
|
|
16
16
|
company_list = json.load(f)
|
17
17
|
db_client = DBClient("mongodb://neurowatt:neurodb123@db.neurowatt.ai:27017/neurowatt").get_client()
|
18
18
|
|
19
|
+
def test_value_serie():
|
20
|
+
from neurostats_API.fetchers import ValueFetcher
|
21
|
+
company_list = {
|
22
|
+
"2330": "台積電"
|
23
|
+
}
|
24
|
+
for ticker in company_list.keys():
|
25
|
+
|
26
|
+
fetcher = ValueFetcher(ticker=ticker, db_client=db_client)
|
27
|
+
|
28
|
+
fetched_data = fetcher.query_value_serie()
|
29
|
+
|
30
|
+
pp.pprint(fetched_data)
|
31
|
+
|
19
32
|
def test_value():
|
20
33
|
from neurostats_API.fetchers import ValueFetcher
|
21
34
|
for ticker in company_list.keys():
|
@@ -1 +0,0 @@
|
|
1
|
-
__version__='0.0.12'
|
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
|
{neurostats_api-0.0.12 → neurostats_API-0.0.13}/neurostats_API/tools/cash_flow_percentage.yaml
RENAMED
File without changes
|
{neurostats_api-0.0.12 → neurostats_API-0.0.13}/neurostats_API/tools/finance_overview_dict.yaml
RENAMED
File without changes
|
File without changes
|
{neurostats_api-0.0.12 → neurostats_API-0.0.13}/neurostats_API/tools/seasonal_data_field_dict.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{neurostats_api-0.0.12 → neurostats_API-0.0.13}/neurostats_API.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|