neurostats-API 0.0.21b0__py3-none-any.whl → 0.0.23__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.
- neurostats_API/__init__.py +1 -1
- neurostats_API/fetchers/balance_sheet.py +152 -102
- neurostats_API/fetchers/base.py +93 -74
- neurostats_API/fetchers/cash_flow.py +143 -113
- neurostats_API/fetchers/finance_overview.py +28 -28
- neurostats_API/fetchers/institution.py +211 -97
- neurostats_API/fetchers/margin_trading.py +121 -94
- neurostats_API/fetchers/month_revenue.py +139 -105
- neurostats_API/fetchers/profit_lose.py +203 -108
- neurostats_API/fetchers/tech.py +117 -42
- neurostats_API/fetchers/tej_finance_report.py +248 -338
- neurostats_API/fetchers/value_invest.py +32 -12
- neurostats_API/tools/company_list/tw.json +2175 -0
- neurostats_API/tools/tej_db/tej_db_percent_index.yaml +0 -3
- neurostats_API/tools/tej_db/tej_db_skip_index.yaml +14 -1
- neurostats_API/tools/tej_db/tej_db_thousand_index.yaml +0 -5
- neurostats_API/utils/__init__.py +0 -1
- neurostats_API/utils/calculate_value.py +102 -1
- neurostats_API/utils/data_process.py +53 -19
- neurostats_API/utils/logger.py +21 -0
- {neurostats_API-0.0.21b0.dist-info → neurostats_API-0.0.23.dist-info}/METADATA +2 -2
- neurostats_API-0.0.23.dist-info/RECORD +35 -0
- neurostats_API/utils/fetcher.py +0 -1056
- neurostats_API-0.0.21b0.dist-info/RECORD +0 -34
- /neurostats_API/tools/{balance_sheet.yaml → twse/balance_sheet.yaml} +0 -0
- /neurostats_API/tools/{cash_flow_percentage.yaml → twse/cash_flow_percentage.yaml} +0 -0
- /neurostats_API/tools/{finance_overview_dict.yaml → twse/finance_overview_dict.yaml} +0 -0
- /neurostats_API/tools/{profit_lose.yaml → twse/profit_lose.yaml} +0 -0
- /neurostats_API/tools/{seasonal_data_field_dict.txt → twse/seasonal_data_field_dict.txt} +0 -0
- {neurostats_API-0.0.21b0.dist-info → neurostats_API-0.0.23.dist-info}/WHEEL +0 -0
- {neurostats_API-0.0.21b0.dist-info → neurostats_API-0.0.23.dist-info}/top_level.txt +0 -0
@@ -11,168 +11,151 @@ class CashFlowFetcher(StatsFetcher):
|
|
11
11
|
super().__init__(ticker, db_client)
|
12
12
|
|
13
13
|
self.cash_flow_dict = StatsProcessor.load_yaml(
|
14
|
-
"cash_flow_percentage.yaml"
|
14
|
+
"twse/cash_flow_percentage.yaml"
|
15
15
|
) # 計算子表格用
|
16
|
+
|
17
|
+
self.process_function_map = {
|
18
|
+
"twse_stats": self.process_data_twse,
|
19
|
+
"us_stats": self.process_data_us
|
20
|
+
}
|
21
|
+
|
22
|
+
self.return_keys = ['cash_flow', 'CASHO', 'CASHI', 'CASHF', 'cash_flow_all', 'cash_flow_YoY']
|
16
23
|
|
17
|
-
def prepare_query(self
|
24
|
+
def prepare_query(self):
|
18
25
|
pipeline = super().prepare_query()
|
19
26
|
|
20
|
-
|
27
|
+
name_map = {
|
28
|
+
"twse_stats": "cash_flow",
|
29
|
+
"us_stats": "cash_flow"
|
30
|
+
}
|
31
|
+
|
32
|
+
|
33
|
+
chart_name = name_map.get(self.collection_name, "cash_flow")
|
34
|
+
|
35
|
+
append_pipeline = [
|
36
|
+
{
|
21
37
|
"$project": {
|
22
38
|
"_id": 0,
|
23
39
|
"ticker": 1,
|
24
40
|
"company_name": 1,
|
25
|
-
"
|
26
|
-
"$
|
27
|
-
"input": {
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
"$eq":
|
35
|
-
["$$season.season", target_season]
|
36
|
-
}
|
37
|
-
}
|
38
|
-
},
|
39
|
-
"as": "target_season_data",
|
40
|
-
"in": {
|
41
|
-
"year":
|
42
|
-
"$$target_season_data.year",
|
43
|
-
"season":
|
44
|
-
"$$target_season_data.season",
|
45
|
-
"cash_flow":
|
46
|
-
"$$target_season_data.cash_flow"
|
47
|
-
}
|
48
|
-
}
|
49
|
-
},
|
50
|
-
"sortBy": {
|
51
|
-
"year": -1
|
52
|
-
} # 按 year 降序排序
|
41
|
+
"seasonal_data": {
|
42
|
+
"$map": {
|
43
|
+
"input": {"$ifNull": ["$seasonal_data", []]},
|
44
|
+
"as": "season",
|
45
|
+
"in": {
|
46
|
+
"year": "$$season.year",
|
47
|
+
"season": "$$season.season",
|
48
|
+
"data": {"$ifNull": [f"$$season.{chart_name}", []]}
|
49
|
+
}
|
53
50
|
}
|
54
51
|
}
|
55
52
|
}
|
56
|
-
}
|
53
|
+
}
|
54
|
+
]
|
55
|
+
|
56
|
+
pipeline = pipeline + append_pipeline
|
57
57
|
|
58
58
|
return pipeline
|
59
59
|
|
60
|
-
def collect_data(self
|
61
|
-
|
62
|
-
|
63
|
-
fetched_data = self.collection.aggregate(pipeline)
|
64
|
-
|
65
|
-
return list(fetched_data)[0]
|
60
|
+
def collect_data(self):
|
61
|
+
return super().collect_data()
|
66
62
|
|
67
63
|
def query_data(self):
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
except:
|
74
|
-
today = StatsDateTime.get_today()
|
75
|
-
target_season = today.season - 1 if (today.season > 1) else 4
|
76
|
-
|
77
|
-
fetched_data = self.collect_data(target_season)
|
78
|
-
|
79
|
-
return self.process_data(fetched_data, target_season)
|
64
|
+
fetched_data = self.collect_data()
|
65
|
+
fetched_data = fetched_data[0]
|
66
|
+
|
67
|
+
process_fn = self.process_function_map.get(self.collection_name, self.process_data_us)
|
68
|
+
return process_fn(fetched_data)
|
80
69
|
|
81
|
-
def
|
70
|
+
def process_data_twse(self, fetched_data):
|
82
71
|
"""
|
83
72
|
處理現金流量表頁面的所有表格
|
84
73
|
金流表本身沒有比例 但是Ifa有算,
|
85
74
|
項目所屬的情況也不一(分別所屬營業,投資,籌資三個活動)
|
86
75
|
所以這裡選擇不用slicing處理
|
87
76
|
"""
|
88
|
-
cash_flows = fetched_data['cash_flows']
|
89
77
|
|
90
78
|
index_names = []
|
91
79
|
column_names = []
|
92
80
|
|
93
|
-
table_dict =
|
94
|
-
CASHO_dict =
|
95
|
-
CASHI_dict =
|
96
|
-
CASHF_dict =
|
97
|
-
|
98
|
-
return_dict = {
|
99
|
-
"ticker": fetched_data['ticker'],
|
100
|
-
"company_name": fetched_data['company_name'],
|
101
|
-
"cash_flow": dict(),
|
102
|
-
"CASHO": dict(),
|
103
|
-
"CASHI": dict(),
|
104
|
-
"CASHF": dict()
|
105
|
-
}
|
81
|
+
table_dict = {}
|
82
|
+
CASHO_dict = {}
|
83
|
+
CASHI_dict = {}
|
84
|
+
CASHF_dict = {}
|
106
85
|
|
86
|
+
# 處理cash_flow 比例
|
107
87
|
checkpoints = ["營業活動之現金流量-間接法", "投資活動之現金流量", "籌資活動之現金流量", "匯率變動對現金及約當現金之影響"]
|
108
88
|
main_cash_flows = [
|
109
|
-
"營業活動之淨現金流入(流出)", "投資活動之淨現金流入(流出)", "籌資活動之淨現金流入(流出)",
|
89
|
+
"營業活動之淨現金流入(流出)", "投資活動之淨現金流入(流出)", "籌資活動之淨現金流入(流出)", "其他"
|
110
90
|
] # 主要的比例對象
|
111
91
|
partial_cash_flows = [CASHO_dict, CASHI_dict, CASHF_dict, dict()]
|
112
92
|
|
113
93
|
# 作法: dictionary中也有checkpoints,如果出現了就換下一個index去計算
|
114
94
|
|
115
|
-
|
116
|
-
|
95
|
+
return_dict = {
|
96
|
+
"ticker": self.ticker,
|
97
|
+
"company_name": fetched_data['company_name']
|
98
|
+
}
|
99
|
+
seasonal_data = fetched_data.get('seasonal_data')
|
100
|
+
if not seasonal_data:
|
101
|
+
return_dict.update(self._get_empty_structure())
|
102
|
+
return return_dict
|
103
|
+
|
104
|
+
for data in seasonal_data:
|
105
|
+
year, season, cash_flow = data['year'], data['season'], data['data']
|
117
106
|
|
118
|
-
time_index = f"{year}Q{
|
107
|
+
time_index = f"{year}Q{season}"
|
119
108
|
|
120
|
-
|
121
|
-
|
122
|
-
partial_cash_flow = None
|
109
|
+
main_cash_flow_name = ""
|
110
|
+
partial_cash_flow = {}
|
123
111
|
next_checkpoint = 0
|
124
112
|
|
125
|
-
|
113
|
+
temp_dict = {}
|
114
|
+
|
115
|
+
for index_name, cash_flow_value in cash_flow.items():
|
126
116
|
if (next_checkpoint < 3
|
127
117
|
and index_name == checkpoints[next_checkpoint]): # 找到了主要的變動點
|
128
118
|
main_cash_flow_name = main_cash_flows[next_checkpoint]
|
129
119
|
partial_cash_flow = partial_cash_flows[next_checkpoint]
|
120
|
+
partial_cash_flow[time_index] = {}
|
130
121
|
next_checkpoint += 1
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
ratio = np.round(
|
136
|
-
(value['value'] / cash_flow[
|
137
|
-
main_cash_flow_name]['value']) * 100, 2)
|
138
|
-
table_dict[time_index][index_name][
|
139
|
-
'percentage'] = f"{ratio}%"
|
122
|
+
|
123
|
+
if main_cash_flow_name: # 有取得cash flow name再進行接下來的計算percentage
|
124
|
+
if (isinstance(cash_flow_value, dict)):
|
125
|
+
value = cash_flow_value.get('value', None)
|
140
126
|
else:
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
table_dict[time_index][index_name]['value'] = value[
|
149
|
-
'value']
|
150
|
-
if (value['value']):
|
151
|
-
ratio = np.round(
|
152
|
-
(value['value'] / cash_flow[
|
153
|
-
main_cash_flow_name]['value']) * 100, 2)
|
154
|
-
table_dict[time_index][index_name][
|
155
|
-
'percentage'] = f"{ratio}%"
|
127
|
+
value = cash_flow_value
|
128
|
+
|
129
|
+
# 處理cashflow percentage部分(取2位 + 接%)
|
130
|
+
main_value = cash_flow.get(main_cash_flow_name, None)
|
131
|
+
if (isinstance(main_value, dict)):
|
132
|
+
main_value = main_value.get('value', None)
|
156
133
|
else:
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
134
|
+
pass
|
135
|
+
|
136
|
+
try:
|
137
|
+
ratio = np.round(
|
138
|
+
(value / main_value) * 100, 2
|
139
|
+
)
|
140
|
+
ratio = f"{ratio}%"
|
141
|
+
except:
|
142
|
+
ratio = None
|
143
|
+
|
144
|
+
value = StatsProcessor.cal_non_percentage(value, postfix="千元")
|
145
|
+
temp_dict[index_name] = {
|
146
|
+
"value" : value,
|
147
|
+
"percentage": ratio
|
148
|
+
}
|
149
|
+
partial_cash_flow[time_index][index_name] = temp_dict[index_name]
|
168
150
|
|
151
|
+
table_dict[time_index] = temp_dict
|
169
152
|
index_names += list(cash_flow.keys())
|
170
153
|
|
171
154
|
# 轉成dictionary keys
|
172
155
|
index_names = list(dict.fromkeys(index_names))
|
173
156
|
|
174
157
|
cash_flow_table = pd.DataFrame(table_dict)
|
175
|
-
|
158
|
+
cash_flow_table_stats = StatsProcessor.expand_value_percentage(cash_flow_table)
|
176
159
|
|
177
160
|
CASHO_table = pd.DataFrame(CASHO_dict)
|
178
161
|
CASHO_table = StatsProcessor.expand_value_percentage(CASHO_table)
|
@@ -183,9 +166,56 @@ class CashFlowFetcher(StatsFetcher):
|
|
183
166
|
CASHF_table = pd.DataFrame(CASHF_dict)
|
184
167
|
CASHF_table = StatsProcessor.expand_value_percentage(CASHF_table)
|
185
168
|
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
169
|
+
# 回傳歷來格式
|
170
|
+
target_season = seasonal_data[0]['season']
|
171
|
+
|
172
|
+
cash_flow_flatten, cash_flow_flatten_YoY = self.flatten_twse(
|
173
|
+
table_dict, target_season, index_names
|
174
|
+
)
|
175
|
+
|
176
|
+
return_dict.update({
|
177
|
+
"cash_flow": cash_flow_table_stats,
|
178
|
+
"CASHO": CASHO_table,
|
179
|
+
"CASHI": CASHI_table,
|
180
|
+
"CASHF": CASHF_table,
|
181
|
+
"cash_flow_all": cash_flow_flatten,
|
182
|
+
"cash_flow_YoY": cash_flow_flatten_YoY
|
183
|
+
})
|
184
|
+
return return_dict
|
185
|
+
|
186
|
+
def flatten_twse(self, data_dict: dict, target_season: int, index_names: list):
|
187
|
+
for time_index in data_dict.keys():
|
188
|
+
data_dict[time_index] = self.flatten_dict(data_dict[time_index], index_names, target_keys=['value', 'percentage'])
|
189
|
+
cash_flow_flatten = pd.DataFrame.from_dict(data_dict)
|
190
|
+
|
191
|
+
target_season_column = cash_flow_flatten.columns.str.endswith(f"Q{target_season}")
|
192
|
+
|
193
|
+
return cash_flow_flatten, cash_flow_flatten.loc[:, target_season_column]
|
194
|
+
|
195
|
+
def process_data_us(self, fetched_data):
|
196
|
+
|
197
|
+
table_dict = {
|
198
|
+
f"{data['year']}Q{data['season']}": data['cash_flow']
|
199
|
+
for data in fetched_data
|
200
|
+
}
|
201
|
+
|
202
|
+
cash_flow_df = pd.DataFrame.from_dict(table_dict)
|
203
|
+
|
204
|
+
latest_season = fetched_data[0]['season']
|
205
|
+
target_season_columns = cash_flow_df.columns.str.endswith(
|
206
|
+
f"Q{latest_season}"
|
207
|
+
)
|
208
|
+
cash_flow_df_YoY = cash_flow_df.loc[:, target_season_columns]
|
190
209
|
|
210
|
+
return_dict = {
|
211
|
+
"ticker": self.ticker,
|
212
|
+
"company_name": fetched_data[-1]['company_name'],
|
213
|
+
"cash_flow": cash_flow_df,
|
214
|
+
"cash_flow_YoY": cash_flow_df_YoY
|
215
|
+
}
|
191
216
|
return return_dict
|
217
|
+
|
218
|
+
def _get_empty_structure(self):
|
219
|
+
return {
|
220
|
+
key: pd.DataFrame(columns= pd.Index([], name = 'date')) for key in self.return_keys
|
221
|
+
}
|
@@ -16,9 +16,9 @@ class FinanceOverviewFetcher(StatsFetcher):
|
|
16
16
|
super().__init__(ticker, db_client)
|
17
17
|
|
18
18
|
self.target_fields = StatsProcessor.load_yaml(
|
19
|
-
"finance_overview_dict.yaml")
|
19
|
+
"twse/finance_overview_dict.yaml")
|
20
20
|
self.inverse_dict = StatsProcessor.load_txt(
|
21
|
-
"seasonal_data_field_dict.txt", json_load=True)
|
21
|
+
"twse/seasonal_data_field_dict.txt", json_load=True)
|
22
22
|
|
23
23
|
def prepare_query(self, target_year, target_season):
|
24
24
|
|
@@ -196,7 +196,7 @@ class FinanceOverviewProcessor(StatsProcessor):
|
|
196
196
|
finance_dict['EBIT'] = StatsProcessor.cal_non_percentage(EBIT)
|
197
197
|
except (KeyError, ZeroDivisionError, TypeError) as e:
|
198
198
|
finance_dict['EBIT'] = None
|
199
|
-
print(f"Error calculating EBIT: {e}")
|
199
|
+
# print(f"Error calculating EBIT: {e}")
|
200
200
|
|
201
201
|
@classmethod
|
202
202
|
def cal_fcf(cls, finance_dict):
|
@@ -210,7 +210,7 @@ class FinanceOverviewProcessor(StatsProcessor):
|
|
210
210
|
finance_dict["fcf"] = StatsProcessor.cal_non_percentage(fcf)
|
211
211
|
except (KeyError, ZeroDivisionError, TypeError) as e:
|
212
212
|
finance_dict['fcf'] = None
|
213
|
-
print(f"Error calculating FCF: {e}")
|
213
|
+
# print(f"Error calculating FCF: {e}")
|
214
214
|
|
215
215
|
@classmethod
|
216
216
|
def cal_interest_bearing_debt(cls, finance_dict):
|
@@ -242,7 +242,7 @@ class FinanceOverviewProcessor(StatsProcessor):
|
|
242
242
|
finance_dict['eps'])
|
243
243
|
except (KeyError, ZeroDivisionError, TypeError) as e:
|
244
244
|
finance_dict['share_outstanding'] = None
|
245
|
-
print(f"share_outstanding failed because of {str(e)}")
|
245
|
+
# print(f"share_outstanding failed because of {str(e)}")
|
246
246
|
|
247
247
|
@classmethod
|
248
248
|
def cal_revenue_per_share(cls, finance_dict):
|
@@ -258,7 +258,7 @@ class FinanceOverviewProcessor(StatsProcessor):
|
|
258
258
|
revenue_per_share, False)
|
259
259
|
except (KeyError, ZeroDivisionError, TypeError) as e:
|
260
260
|
finance_dict['revenue_per_share'] = None
|
261
|
-
print(f"revenue_per_share failed because of {str(e)}")
|
261
|
+
# print(f"revenue_per_share failed because of {str(e)}")
|
262
262
|
|
263
263
|
@classmethod
|
264
264
|
def cal_gross_per_share(cls, finance_dict):
|
@@ -283,7 +283,7 @@ class FinanceOverviewProcessor(StatsProcessor):
|
|
283
283
|
|
284
284
|
except (KeyError, ZeroDivisionError, TypeError) as e:
|
285
285
|
finance_dict['gross_per_share'] = None
|
286
|
-
print(f"gross_per_share failed because of {str(e)}")
|
286
|
+
# print(f"gross_per_share failed because of {str(e)}")
|
287
287
|
|
288
288
|
@classmethod
|
289
289
|
def cal_operating_income_per_share(cls, finance_dict):
|
@@ -299,7 +299,7 @@ class FinanceOverviewProcessor(StatsProcessor):
|
|
299
299
|
operating_income_per_share)
|
300
300
|
except (KeyError, ZeroDivisionError, TypeError) as e:
|
301
301
|
finance_dict['operating_income_per_share'] = None
|
302
|
-
print(f"operating_income_per_share failed because of {str(e)}")
|
302
|
+
# print(f"operating_income_per_share failed because of {str(e)}")
|
303
303
|
|
304
304
|
@classmethod
|
305
305
|
def cal_operating_cash_flow_per_share(cls, finance_dict):
|
@@ -331,7 +331,7 @@ class FinanceOverviewProcessor(StatsProcessor):
|
|
331
331
|
fcf_per_share)
|
332
332
|
except (KeyError, ZeroDivisionError, TypeError) as e:
|
333
333
|
finance_dict['fcf_per_share'] = None
|
334
|
-
print(f"fcf_per_share failed because of {str(e)}")
|
334
|
+
# print(f"fcf_per_share failed because of {str(e)}")
|
335
335
|
|
336
336
|
# 盈利能力
|
337
337
|
|
@@ -375,7 +375,7 @@ class FinanceOverviewProcessor(StatsProcessor):
|
|
375
375
|
gross_over_asset)
|
376
376
|
except (KeyError, ZeroDivisionError, TypeError) as e:
|
377
377
|
finance_dict['gross_over_asset'] = None
|
378
|
-
print(f"營業毛利/總資產 failed because of {str(e)}")
|
378
|
+
# print(f"營業毛利/總資產 failed because of {str(e)}")
|
379
379
|
|
380
380
|
@classmethod
|
381
381
|
def cal_roce(cls, finance_dict):
|
@@ -392,7 +392,7 @@ class FinanceOverviewProcessor(StatsProcessor):
|
|
392
392
|
|
393
393
|
except (KeyError, ZeroDivisionError, TypeError) as e:
|
394
394
|
finance_dict['roce'] = None
|
395
|
-
print(f"ROCE failed because of {str(e)}")
|
395
|
+
# print(f"ROCE failed because of {str(e)}")
|
396
396
|
|
397
397
|
@classmethod
|
398
398
|
def cal_gross_profit_marginal(cls, finance_dict):
|
@@ -408,7 +408,7 @@ class FinanceOverviewProcessor(StatsProcessor):
|
|
408
408
|
gross_profit_margin)
|
409
409
|
except Exception as e:
|
410
410
|
finance_dict['gross_profit_margin'] = None
|
411
|
-
print(f"gross_profit_margin failed because of {str(e)}")
|
411
|
+
# print(f"gross_profit_margin failed because of {str(e)}")
|
412
412
|
|
413
413
|
@classmethod
|
414
414
|
def cal_operation_profit_rate(cls, finance_dict):
|
@@ -425,7 +425,7 @@ class FinanceOverviewProcessor(StatsProcessor):
|
|
425
425
|
operation_profit_rate)
|
426
426
|
except (KeyError, ZeroDivisionError, TypeError) as e:
|
427
427
|
finance_dict["operation_profit_rate"] = None
|
428
|
-
print(f"operation_profit failed because of {str(e)}")
|
428
|
+
# print(f"operation_profit failed because of {str(e)}")
|
429
429
|
|
430
430
|
@classmethod
|
431
431
|
def cal_operating_cash_flow_profit_rate(cls, finance_dict):
|
@@ -441,8 +441,8 @@ class FinanceOverviewProcessor(StatsProcessor):
|
|
441
441
|
operating_cash_flow_profit_rate)
|
442
442
|
except (KeyError, ZeroDivisionError, TypeError) as e:
|
443
443
|
finance_dict["operating_cash_flow_profit_rate"] = None
|
444
|
-
print(
|
445
|
-
|
444
|
+
# print(
|
445
|
+
# f"operating_cash_flow_profit_rate failed because of {str(e)}")
|
446
446
|
|
447
447
|
|
448
448
|
# 成長動能
|
@@ -466,7 +466,7 @@ class FinanceOverviewProcessor(StatsProcessor):
|
|
466
466
|
dso, to_str=True, postfix="日")
|
467
467
|
except Exception as e:
|
468
468
|
finance_dict['dso'] = None
|
469
|
-
print(f"Error calculating 應收帳款收現天數 because of {str(e)}")
|
469
|
+
# print(f"Error calculating 應收帳款收現天數 because of {str(e)}")
|
470
470
|
|
471
471
|
@classmethod
|
472
472
|
def cal_account_receive_over_revenue(cls, finance_dict):
|
@@ -498,7 +498,7 @@ class FinanceOverviewProcessor(StatsProcessor):
|
|
498
498
|
dpo, to_str=True, postfix="日")
|
499
499
|
except (KeyError, ZeroDivisionError, TypeError) as e:
|
500
500
|
finance_dict["dpo"] = None
|
501
|
-
print(f"應付帳款週轉天數 failed because of {str(e)}")
|
501
|
+
# print(f"應付帳款週轉天數 failed because of {str(e)}")
|
502
502
|
|
503
503
|
@classmethod
|
504
504
|
def cal_inventories_cycle_ratio(cls, finance_dict):
|
@@ -515,7 +515,7 @@ class FinanceOverviewProcessor(StatsProcessor):
|
|
515
515
|
inventories_cycle_ratio)
|
516
516
|
except (KeyError, ZeroDivisionError, TypeError) as e:
|
517
517
|
finance_dict["inventories_cycle_ratio"] = None
|
518
|
-
print(f"Error calculating 存貨周轉率 because of {str(e)}")
|
518
|
+
# print(f"Error calculating 存貨周轉率 because of {str(e)}")
|
519
519
|
|
520
520
|
@classmethod
|
521
521
|
def cal_dio(cls, finance_dict):
|
@@ -531,7 +531,7 @@ class FinanceOverviewProcessor(StatsProcessor):
|
|
531
531
|
dio, to_str=True, postfix="日")
|
532
532
|
except (KeyError, ZeroDivisionError, TypeError) as e:
|
533
533
|
finance_dict["dio"] = None
|
534
|
-
print(f"Error calculating 存貨週轉天數 because of {str(e)}")
|
534
|
+
# print(f"Error calculating 存貨週轉天數 because of {str(e)}")
|
535
535
|
|
536
536
|
@classmethod
|
537
537
|
def cal_inventories_revenue_ratio(cls, finance_dict):
|
@@ -548,7 +548,7 @@ class FinanceOverviewProcessor(StatsProcessor):
|
|
548
548
|
inventories_revenue_ratio)
|
549
549
|
except (KeyError, ZeroDivisionError, TypeError) as e:
|
550
550
|
finance_dict["inventories_revenue_ratio"] = None
|
551
|
-
print(f"Error calculating 存貨佔營收比率 because of {str(e)}")
|
551
|
+
# print(f"Error calculating 存貨佔營收比率 because of {str(e)}")
|
552
552
|
|
553
553
|
@classmethod
|
554
554
|
def cal_cash_of_conversion_cycle(cls, finance_dict):
|
@@ -609,7 +609,7 @@ class FinanceOverviewProcessor(StatsProcessor):
|
|
609
609
|
current_ratio)
|
610
610
|
except (KeyError, ZeroDivisionError, TypeError) as e:
|
611
611
|
finance_dict['current_ratio'] = None
|
612
|
-
print(f"Error calculating current ratio: {e}")
|
612
|
+
# print(f"Error calculating current ratio: {e}")
|
613
613
|
|
614
614
|
@classmethod
|
615
615
|
def cal_quick_ratio(cls, finance_dict):
|
@@ -625,7 +625,7 @@ class FinanceOverviewProcessor(StatsProcessor):
|
|
625
625
|
quick_ratio)
|
626
626
|
except (KeyError, ZeroDivisionError, TypeError) as e:
|
627
627
|
finance_dict['quick_ratio'] = None
|
628
|
-
print(f"Error calculating quick ratio: {e}")
|
628
|
+
# print(f"Error calculating quick ratio: {e}")
|
629
629
|
|
630
630
|
@classmethod
|
631
631
|
def cal_debt_to_equity_ratio(cls, finance_dict):
|
@@ -640,7 +640,7 @@ class FinanceOverviewProcessor(StatsProcessor):
|
|
640
640
|
debt_to_equity_ratio)
|
641
641
|
except (KeyError, ZeroDivisionError, TypeError) as e:
|
642
642
|
finance_dict['debt_to_equity_ratio'] = None
|
643
|
-
print(f"Error calculating debt to equity ratio: {e}")
|
643
|
+
# print(f"Error calculating debt to equity ratio: {e}")
|
644
644
|
|
645
645
|
@classmethod
|
646
646
|
def cal_net_debt_to_equity_ratio(cls, finance_dict):
|
@@ -657,7 +657,7 @@ class FinanceOverviewProcessor(StatsProcessor):
|
|
657
657
|
net_debt_to_equity_ratio)
|
658
658
|
except (KeyError, ZeroDivisionError, TypeError) as e:
|
659
659
|
finance_dict['net_debt_to_equity_ratio'] = None
|
660
|
-
print(f"Error calculating net debt to equity ratio: {e}")
|
660
|
+
# print(f"Error calculating net debt to equity ratio: {e}")
|
661
661
|
|
662
662
|
@classmethod
|
663
663
|
def cal_interest_coverage_ratio(cls, finance_dict):
|
@@ -672,7 +672,7 @@ class FinanceOverviewProcessor(StatsProcessor):
|
|
672
672
|
interest_coverage_ratio, to_str=True, postfix="倍")
|
673
673
|
except (KeyError, ZeroDivisionError, TypeError) as e:
|
674
674
|
finance_dict['interest_coverage_ratio'] = None
|
675
|
-
print(f"Error calculating interest coverage ratio: {e}")
|
675
|
+
# print(f"Error calculating interest coverage ratio: {e}")
|
676
676
|
|
677
677
|
@classmethod
|
678
678
|
def cal_debt_to_operating_cash_flow(cls, finance_dict):
|
@@ -687,7 +687,7 @@ class FinanceOverviewProcessor(StatsProcessor):
|
|
687
687
|
debt_to_operating_cash_flow)
|
688
688
|
except (KeyError, ZeroDivisionError, TypeError) as e:
|
689
689
|
finance_dict['debt_to_operating_cash_flow'] = None
|
690
|
-
print(f"Error calculating debt to operating cash flow: {e}")
|
690
|
+
# print(f"Error calculating debt to operating cash flow: {e}")
|
691
691
|
|
692
692
|
@classmethod
|
693
693
|
def cal_debt_to_free_cash_flow(cls, finance_dict):
|
@@ -702,7 +702,7 @@ class FinanceOverviewProcessor(StatsProcessor):
|
|
702
702
|
debt_to_free_cash_flow)
|
703
703
|
except (KeyError, ZeroDivisionError, TypeError) as e:
|
704
704
|
finance_dict['debt_to_free_cash_flow'] = None
|
705
|
-
print(f"Error calculating debt to free cash flow: {e}")
|
705
|
+
# print(f"Error calculating debt to free cash flow: {e}")
|
706
706
|
|
707
707
|
@classmethod
|
708
708
|
def cal_cash_flow_ratio(cls, finance_dict):
|
@@ -716,4 +716,4 @@ class FinanceOverviewProcessor(StatsProcessor):
|
|
716
716
|
cash_flow_ratio)
|
717
717
|
except (KeyError, ZeroDivisionError, TypeError) as e:
|
718
718
|
finance_dict['cash_flow_ratio'] = None
|
719
|
-
print(f"Error calculating cash flow ratio: {e}")
|
719
|
+
# print(f"Error calculating cash flow ratio: {e}")
|