neurostats-API 1.0.0rc5__py3-none-any.whl → 1.0.0rc6__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/async_mode/fetchers/__init__.py +1 -1
- neurostats_API/async_mode/fetchers/tej/__init__.py +2 -0
- neurostats_API/async_mode/fetchers/{tej.py → tej/seasonal_data.py} +1 -1
- neurostats_API/async_mode/fetchers/tej/tech.py +34 -0
- neurostats_API/transformers/month_revenue/twse.py +7 -7
- {neurostats_API-1.0.0rc5.dist-info → neurostats_API-1.0.0rc6.dist-info}/METADATA +2 -2
- {neurostats_API-1.0.0rc5.dist-info → neurostats_API-1.0.0rc6.dist-info}/RECORD +9 -7
- {neurostats_API-1.0.0rc5.dist-info → neurostats_API-1.0.0rc6.dist-info}/WHEEL +0 -0
- {neurostats_API-1.0.0rc5.dist-info → neurostats_API-1.0.0rc6.dist-info}/top_level.txt +0 -0
@@ -7,4 +7,4 @@ from .twse_margin import AsyncTWSEMarginFetcher
|
|
7
7
|
from .month_revenue import AsyncMonthlyRevenueFetcher
|
8
8
|
from .profit_lose import AsyncProfitLoseFetcher
|
9
9
|
from .value import AsyncTWSEStatsValueFetcher
|
10
|
-
from .tej import AsyncTEJSeasonalFetcher
|
10
|
+
from .tej import AsyncTEJDailyTechFetcher, AsyncTEJSeasonalFetcher
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import pandas as pd
|
2
|
+
from neurostats_API.async_mode.fetchers.base import AsyncBaseFetcher
|
3
|
+
from neurostats_API.async_mode.factory import get_extractor
|
4
|
+
from neurostats_API.utils import NotSupportedError
|
5
|
+
|
6
|
+
class AsyncTEJDailyTechFetcher(AsyncBaseFetcher):
|
7
|
+
|
8
|
+
def __init__(
|
9
|
+
self,
|
10
|
+
ticker,
|
11
|
+
client,
|
12
|
+
):
|
13
|
+
self.ticker = ticker
|
14
|
+
try:
|
15
|
+
self.extractor = get_extractor("TEJ_tech", ticker, client)
|
16
|
+
|
17
|
+
self.company_name = self.extractor.get_company_name()
|
18
|
+
self.zone = self.extractor.get_zone()
|
19
|
+
|
20
|
+
except NotSupportedError as e:
|
21
|
+
raise NotSupportedError(
|
22
|
+
f"{self.__class__.__name__} only support TW companies now, {ticker} is not available"
|
23
|
+
) from e
|
24
|
+
|
25
|
+
async def query_data(self, start_date, end_date):
|
26
|
+
data = await self.extractor.query_data(start_date, end_date)
|
27
|
+
df = pd.DataFrame(data)
|
28
|
+
return df.rename(columns={
|
29
|
+
"open_d": "open",
|
30
|
+
"high_d": "high",
|
31
|
+
"low_d": "low",
|
32
|
+
"close_d": "close",
|
33
|
+
"vol": "volume"
|
34
|
+
})
|
@@ -68,11 +68,11 @@ class TWSEMonthlyRevenueTransformer(BaseMonthRevenueTransformer):
|
|
68
68
|
return return_dict
|
69
69
|
|
70
70
|
def _get_recent_growth(self, monthly_data, grand_total_dict, interval=12):
|
71
|
-
last_month_data = monthly_data[
|
71
|
+
last_month_data = monthly_data[-(interval + 1): ] + [{}] * max(0, interval - len(monthly_data) + 1)
|
72
72
|
|
73
73
|
MoMs = [
|
74
74
|
YoY_Calculator.cal_growth(this.get('revenue'), last.get('revenue'), delta = 1)
|
75
|
-
for
|
75
|
+
for last, this in zip(last_month_data[:interval], last_month_data[1 :interval + 1])
|
76
76
|
]
|
77
77
|
|
78
78
|
def safe_accum_yoy(data):
|
@@ -85,15 +85,15 @@ class TWSEMonthlyRevenueTransformer(BaseMonthRevenueTransformer):
|
|
85
85
|
return None
|
86
86
|
|
87
87
|
recent_month_data = {
|
88
|
-
"date": [f"{d.get('year', 0)}/{d.get('month', 0)}" for d in
|
89
|
-
"revenue": [d.get('revenue') for d in
|
88
|
+
"date": [f"{d.get('year', 0)}/{d.get('month', 0)}" for d in last_month_data[:interval]],
|
89
|
+
"revenue": [d.get('revenue') for d in last_month_data[:interval]],
|
90
90
|
"MoM": [f"{(m * 100):.2f}%" if isinstance(m, float) else None for m in MoMs],
|
91
|
-
"YoY": [d.get('revenue_increment_ratio') for d in
|
92
|
-
"total_YoY": [d.get('grand_total_increment_ratio') for d in
|
91
|
+
"YoY": [d.get('revenue_increment_ratio') for d in last_month_data[:interval]],
|
92
|
+
"total_YoY": [d.get('grand_total_increment_ratio') for d in last_month_data[:interval]],
|
93
93
|
# accum_YoY
|
94
94
|
# accum_YoY 為 Davis提出的定義
|
95
95
|
# 2024/6的累計YoY(accum_YoY) 為 2024累計到6月為止的總營收/2023年度總營收
|
96
|
-
"accum_YoY": [safe_accum_yoy(d) for d in
|
96
|
+
"accum_YoY": [safe_accum_yoy(d) for d in last_month_data[:interval]]
|
97
97
|
}
|
98
98
|
|
99
99
|
df = pd.DataFrame(recent_month_data)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: neurostats_API
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.0rc6
|
4
4
|
Summary: The service of NeuroStats website
|
5
5
|
Home-page: https://github.com/NeurowattStats/NeuroStats_API.git
|
6
6
|
Author: JasonWang@Neurowatt
|
@@ -71,7 +71,7 @@ pip install neurostats-API
|
|
71
71
|
```Python
|
72
72
|
>>> import neurostats_API
|
73
73
|
>>> print(neurostats_API.__version__)
|
74
|
-
1.0.
|
74
|
+
1.0.0rc6
|
75
75
|
```
|
76
76
|
|
77
77
|
### 下載舊版
|
@@ -28,7 +28,7 @@ neurostats_API/async_mode/db_extractors/seasonal/tej.py,sha256=SqObDqR3uOnxXGF12
|
|
28
28
|
neurostats_API/async_mode/factory/__init__.py,sha256=7dw36HPjV9JHfEBF7n1pA8i4f-07ACKREnGMUHxh7KY,45
|
29
29
|
neurostats_API/async_mode/factory/extractor_factory.py,sha256=6dV_-zAtLj6WDbc0N0hRPy7RWl-4ppAyAy1YCbWii0M,4530
|
30
30
|
neurostats_API/async_mode/factory/transformer_factory.py,sha256=atw_-wPz2JZpJscPVE2jvFB6QNwwmcRNKQH9iai-13E,4942
|
31
|
-
neurostats_API/async_mode/fetchers/__init__.py,sha256=
|
31
|
+
neurostats_API/async_mode/fetchers/__init__.py,sha256=AM8P6YQG4_5OI49GcfoKd3GiLL1y4MfaafDnkk2v52Q,536
|
32
32
|
neurostats_API/async_mode/fetchers/balance_sheet.py,sha256=wzlXW5gPh5S5MD5jIUB_yeEL_aW2_CeX2DNKBio0-EA,1129
|
33
33
|
neurostats_API/async_mode/fetchers/base.py,sha256=fWlPmvsQWHcgv8z36BsXj8Y92-VKmr8cUW1EjkqI3_8,1785
|
34
34
|
neurostats_API/async_mode/fetchers/cash_flow.py,sha256=uj2JEbilgn595yJcMNvlTZHdkvu7E9y2e7rqs_ne270,2130
|
@@ -36,10 +36,12 @@ neurostats_API/async_mode/fetchers/finance_overview.py,sha256=nBjKPqrzhXrYvBMbhv
|
|
36
36
|
neurostats_API/async_mode/fetchers/month_revenue.py,sha256=GDrFrjTe81uAzeKvd5HghH9iPXouXL8JTt8hfaFkig4,1258
|
37
37
|
neurostats_API/async_mode/fetchers/profit_lose.py,sha256=-YMqO6hEbGntAeAf9y66LX56fj6VrHWr1_IIbQ_bUBQ,1483
|
38
38
|
neurostats_API/async_mode/fetchers/tech.py,sha256=xj6LRnexMePi4Nc9P0lduAjJwjcVOp1xInIFjrRMrbM,6686
|
39
|
-
neurostats_API/async_mode/fetchers/tej.py,sha256=PfYA0ap7ebWMpffVT9tmLFdwHWETAU7MKLFxAjOlg-E,2802
|
40
39
|
neurostats_API/async_mode/fetchers/twse_institution.py,sha256=DKyecoIa_2-CUfDXKp2dBFJk0lfCBIr2steVVa-jq9o,2055
|
41
40
|
neurostats_API/async_mode/fetchers/twse_margin.py,sha256=wra84uFh9ooCoyFWhRuV4vP3Uhojc13XHx51UD90uYo,3173
|
42
41
|
neurostats_API/async_mode/fetchers/value.py,sha256=7FpO0_BOOvq4ZlwwaIfSD8xO_s1O8ykxz147fkiZIt4,2883
|
42
|
+
neurostats_API/async_mode/fetchers/tej/__init__.py,sha256=QNXGg1gE_bnkZWybulRZXtcCPWV6Aj1nLz7r0Mo4BN0,93
|
43
|
+
neurostats_API/async_mode/fetchers/tej/seasonal_data.py,sha256=oeMpj4GMzw22KHjVDTcVO2hwVfxmnO291N6O_dKp0sw,2836
|
44
|
+
neurostats_API/async_mode/fetchers/tej/tech.py,sha256=0wG2bep_nJp3kBS0nIzH6191R5bwEeS-upK40DTGpjU,1110
|
43
45
|
neurostats_API/config/company_list/ticker_index_industry_map.json,sha256=JPSrkMrxOg5GB6HoOhOKeCatznvGAFJpWt92iAhutak,162681
|
44
46
|
neurostats_API/config/company_list/tw.json,sha256=VWaDFvd0ACCVSWItcHHpmVuM_RzP71jLZl9RBHztu-0,51332
|
45
47
|
neurostats_API/config/company_list/us.json,sha256=XtXr6Pm1KO1fPrXtzuvKgI1_wzUzJk5pjXwNJ-lnTWk,445260
|
@@ -94,7 +96,7 @@ neurostats_API/transformers/finance_overview/base.py,sha256=uksr5sUhbaL12ZBH3cUt
|
|
94
96
|
neurostats_API/transformers/finance_overview/stats_overview.py,sha256=ml-u6BHCSKaTebvDAOBgyJfT6o3LCmluCfneABn1ysw,2884
|
95
97
|
neurostats_API/transformers/month_revenue/__init__.py,sha256=fNj-FNJgl7yhYeswd3UFZEcSNoDF4kL6Mkspjom2cSo,47
|
96
98
|
neurostats_API/transformers/month_revenue/base.py,sha256=cDswLIZ7UBJX3insyI3NPunxOva9Pf-6TEW15tHjn4s,1881
|
97
|
-
neurostats_API/transformers/month_revenue/twse.py,sha256=
|
99
|
+
neurostats_API/transformers/month_revenue/twse.py,sha256=sXCI2KBfMenEShtK3MUdIn7ZmiAJMUnqD1GAqpV31xM,5862
|
98
100
|
neurostats_API/transformers/profit_lose/__init__.py,sha256=oOPyakP1wDnmq7bsxgEm4vu1uWtUR34dd3Oegk9kvq0,83
|
99
101
|
neurostats_API/transformers/profit_lose/base.py,sha256=BJZjE1GmWBI3ayjDkzrtQTrn0vjTSVckPbrQ_u6zEl0,3125
|
100
102
|
neurostats_API/transformers/profit_lose/twse.py,sha256=RwAJWQBdsjFaLlW-HL6oUGxLAd8jXPpp6ljVB8uOfhQ,5400
|
@@ -113,7 +115,7 @@ neurostats_API/utils/datetime.py,sha256=XJya4G8b_-ZOaBbMXgQjWh2MC4wc-o6goQ7EQJQM
|
|
113
115
|
neurostats_API/utils/db_client.py,sha256=OYe6yazcR4Aa6jYmy47JrryUeh2NnKGqY2K_lSZe6i8,455
|
114
116
|
neurostats_API/utils/exception.py,sha256=yv92GVh5uHV1BgRmO4DwJcX_PtE0-TSgQoo3VnZ5hOQ,277
|
115
117
|
neurostats_API/utils/logger.py,sha256=egBiiPGTi5l1FoX_o6EvdGh81R0_k8hFPctSxq8RCoo,693
|
116
|
-
neurostats_API-1.0.
|
117
|
-
neurostats_API-1.0.
|
118
|
-
neurostats_API-1.0.
|
119
|
-
neurostats_API-1.0.
|
118
|
+
neurostats_API-1.0.0rc6.dist-info/METADATA,sha256=cYiiQtKB6WO18_7IjI9-R_47cJ1zbrYcEPv3pT99M_M,2964
|
119
|
+
neurostats_API-1.0.0rc6.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
|
120
|
+
neurostats_API-1.0.0rc6.dist-info/top_level.txt,sha256=nSlQPMG0VtXivJyedp4Bkf86EOy2TpW10VGxolXrqnU,15
|
121
|
+
neurostats_API-1.0.0rc6.dist-info/RECORD,,
|
File without changes
|
File without changes
|