neurostats-API 1.0.0rc4__py3-none-any.whl → 1.0.0rc5__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/async_mode/fetchers/tech.py +2 -2
- neurostats_API/transformers/balance_sheet/us.py +17 -9
- neurostats_API/transformers/base.py +1 -1
- neurostats_API/transformers/daily_chip/twse_chip.py +1 -1
- neurostats_API/transformers/month_revenue/twse.py +6 -1
- neurostats_API/transformers/profit_lose/us.py +1 -0
- neurostats_API/transformers/tej/finance_statement.py +1 -1
- neurostats_API/transformers/value/twse.py +1 -1
- {neurostats_API-1.0.0rc4.dist-info → neurostats_API-1.0.0rc5.dist-info}/METADATA +2 -2
- {neurostats_API-1.0.0rc4.dist-info → neurostats_API-1.0.0rc5.dist-info}/RECORD +13 -13
- {neurostats_API-1.0.0rc4.dist-info → neurostats_API-1.0.0rc5.dist-info}/WHEEL +0 -0
- {neurostats_API-1.0.0rc4.dist-info → neurostats_API-1.0.0rc5.dist-info}/top_level.txt +0 -0
neurostats_API/__init__.py
CHANGED
@@ -157,7 +157,7 @@ class AsyncTechFetcher(AsyncBaseFetcher):
|
|
157
157
|
start_date, end_date
|
158
158
|
)
|
159
159
|
|
160
|
-
if (
|
160
|
+
if (fetched_data):
|
161
161
|
df = pd.DataFrame(fetched_data)
|
162
162
|
return df
|
163
163
|
else:
|
@@ -171,7 +171,7 @@ class AsyncTechFetcher(AsyncBaseFetcher):
|
|
171
171
|
start_date, end_date
|
172
172
|
)
|
173
173
|
|
174
|
-
if (
|
174
|
+
if (fetched_data):
|
175
175
|
df = pd.DataFrame(fetched_data)
|
176
176
|
df = df.rename(
|
177
177
|
columns={
|
@@ -1,24 +1,32 @@
|
|
1
1
|
from .base import BaseBalanceSheetTransformer
|
2
2
|
from neurostats_API.utils import StatsProcessor
|
3
3
|
|
4
|
+
|
4
5
|
class USBalanceSheetTransformer(BaseBalanceSheetTransformer):
|
5
|
-
|
6
|
+
|
7
|
+
def __init__(self, ticker, company_name, zone):
|
6
8
|
super().__init__(ticker, company_name, zone)
|
7
9
|
|
8
10
|
self.data_df = None
|
9
|
-
|
11
|
+
self.return_keys = [
|
12
|
+
'balance_sheet',
|
13
|
+
'balance_sheet_YoY'
|
14
|
+
]
|
15
|
+
|
10
16
|
def process_transform(self, fetched_data):
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
}
|
17
|
+
if (not fetched_data):
|
18
|
+
return self._get_empty_structure()
|
19
|
+
|
20
|
+
return_dict = {"ticker": self.ticker, "company_name": self.company_name}
|
15
21
|
|
16
22
|
# QoQ表格
|
17
23
|
self.data_df = self._process_us_format(fetched_data)
|
18
|
-
|
24
|
+
|
19
25
|
# YoY表格
|
20
26
|
target_season = fetched_data[0]['season']
|
21
|
-
total_table_YoY = self._slice_target_season(
|
27
|
+
total_table_YoY = self._slice_target_season(
|
28
|
+
self.data_df.T, target_season
|
29
|
+
)
|
22
30
|
|
23
31
|
return_dict.update(
|
24
32
|
{
|
@@ -27,4 +35,4 @@ class USBalanceSheetTransformer(BaseBalanceSheetTransformer):
|
|
27
35
|
}
|
28
36
|
)
|
29
37
|
|
30
|
-
return return_dict
|
38
|
+
return return_dict
|
@@ -35,7 +35,7 @@ class TWSEChipTransformer(BaseChipTransformer):
|
|
35
35
|
|
36
36
|
tech_dict = {data['date']: data for data in tech_data}
|
37
37
|
latest_tech = tech_data[-1]
|
38
|
-
if (
|
38
|
+
if (not fetched_data):
|
39
39
|
return_dict['latest_trading'].update(
|
40
40
|
self._process_latest({}, latest_tech, key)
|
41
41
|
)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
from .base import BaseMonthRevenueTransformer
|
2
|
+
from datetime import datetime
|
2
3
|
from neurostats_API.utils import StatsProcessor, YoY_Calculator
|
3
4
|
import pandas as pd
|
4
5
|
|
@@ -8,6 +9,8 @@ class TWSEMonthlyRevenueTransformer(BaseMonthRevenueTransformer):
|
|
8
9
|
|
9
10
|
self.data_df = None
|
10
11
|
def process_transform(self, fetched_data):
|
12
|
+
if (not fetched_data):
|
13
|
+
return self._get_empty_structure()
|
11
14
|
self.data_df = self._process_data(fetched_data)
|
12
15
|
target_month = fetched_data[0]['month']
|
13
16
|
|
@@ -97,10 +100,12 @@ class TWSEMonthlyRevenueTransformer(BaseMonthRevenueTransformer):
|
|
97
100
|
return df[df['date'] != "0/0"].set_index('date').T
|
98
101
|
|
99
102
|
|
100
|
-
def _get_empty_structure(self
|
103
|
+
def _get_empty_structure(self):
|
101
104
|
"""
|
102
105
|
Exception 發生時回傳
|
103
106
|
"""
|
107
|
+
target_date = datetime.today()
|
108
|
+
target_year, target_month = target_date.year, target_date.month
|
104
109
|
recent_date = [f"{target_year}/{target_month}"]
|
105
110
|
for _ in range(11):
|
106
111
|
target_year, target_month = (target_year - 1, 12) if target_month == 1 else (target_year, target_month - 1)
|
@@ -35,7 +35,7 @@ class TEJFinanceStatementTransformer(BaseTEJTransformer):
|
|
35
35
|
use_cal=True,
|
36
36
|
indexes=None
|
37
37
|
):
|
38
|
-
if (
|
38
|
+
if (not fetched_data):
|
39
39
|
raise NoDataError(f"No data found in collection: TEJ_finance_statement, ticker={self.ticker}")
|
40
40
|
|
41
41
|
target_season = fetched_data[-1]['season']
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: neurostats_API
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.0rc5
|
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.0rc5
|
75
75
|
```
|
76
76
|
|
77
77
|
### 下載舊版
|
@@ -1,4 +1,4 @@
|
|
1
|
-
neurostats_API/__init__.py,sha256=
|
1
|
+
neurostats_API/__init__.py,sha256=i-A81EltAAyWKaO_KUJQwnzwTmMOhUc1XrfLDSG0eAo,675
|
2
2
|
neurostats_API/cli.py,sha256=UJSWLIw03P24p-gkBb6JSEI5dW5U12UvLf1L8HjQD-o,873
|
3
3
|
neurostats_API/main.py,sha256=QcsfmWivg2Dnqw3MTJWiI0QvEiRs0VuH-BjwQHFCv00,677
|
4
4
|
neurostats_API/async_mode/__init__.py,sha256=arSINQm3O3g-IwfOSLsGraEj2icJbkuW0t5HLPQ4Xk8,348
|
@@ -35,7 +35,7 @@ neurostats_API/async_mode/fetchers/cash_flow.py,sha256=uj2JEbilgn595yJcMNvlTZHdk
|
|
35
35
|
neurostats_API/async_mode/fetchers/finance_overview.py,sha256=nBjKPqrzhXrYvBMbhvzCygRpKR2xV3tPvNX5foiuBSY,4570
|
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
|
-
neurostats_API/async_mode/fetchers/tech.py,sha256=
|
38
|
+
neurostats_API/async_mode/fetchers/tech.py,sha256=xj6LRnexMePi4Nc9P0lduAjJwjcVOp1xInIFjrRMrbM,6686
|
39
39
|
neurostats_API/async_mode/fetchers/tej.py,sha256=PfYA0ap7ebWMpffVT9tmLFdwHWETAU7MKLFxAjOlg-E,2802
|
40
40
|
neurostats_API/async_mode/fetchers/twse_institution.py,sha256=DKyecoIa_2-CUfDXKp2dBFJk0lfCBIr2steVVa-jq9o,2055
|
41
41
|
neurostats_API/async_mode/fetchers/twse_margin.py,sha256=wra84uFh9ooCoyFWhRuV4vP3Uhojc13XHx51UD90uYo,3173
|
@@ -66,11 +66,11 @@ neurostats_API/fetchers/tech.py,sha256=TsS8m25Otc3_2jTYITFe-wNHlDWcfWsHIxhOrqL8q
|
|
66
66
|
neurostats_API/fetchers/tej_finance_report.py,sha256=mlIm2Qzs8-Xlzeb8uET8qGPWD3VGUx3g8qFFcY4UbAw,13022
|
67
67
|
neurostats_API/fetchers/value_invest.py,sha256=QxQS2GcoLIU9ZBDEo8iRK2yHd8YLmBS70Bq42F3IsSw,8295
|
68
68
|
neurostats_API/transformers/__init__.py,sha256=AJ0SkJ9P65gbdHPSygYw1X2I-KRJO20q20lLVP-JViE,676
|
69
|
-
neurostats_API/transformers/base.py,sha256=
|
69
|
+
neurostats_API/transformers/base.py,sha256=gFRuLmFzZl0HObEtMr78oscFP3ePBseMW7tB4s51-_c,4795
|
70
70
|
neurostats_API/transformers/balance_sheet/__init__.py,sha256=RCScBsR3zeC5UdyuiHD1CGRQufoFL5LkN8WbtI5JeA4,87
|
71
71
|
neurostats_API/transformers/balance_sheet/base.py,sha256=sEap9uHe-nri8F4gPV_FCVm0Qe6KWgpHt6a2ryAPd_8,1676
|
72
72
|
neurostats_API/transformers/balance_sheet/twse.py,sha256=ghQWvacJvJSEqu7RtNqICE5gK_N_AKWSvpfYv5Eioiw,2800
|
73
|
-
neurostats_API/transformers/balance_sheet/us.py,sha256=
|
73
|
+
neurostats_API/transformers/balance_sheet/us.py,sha256=v1QUsI6bt8_AZV-oB5NEddjJYO3N1hs6zTbi7J3ZGME,1054
|
74
74
|
neurostats_API/transformers/cash_flow/__init__.py,sha256=KJs5kfjRV0ahy842ZVLvQuZS02YxT-w0cMNHfU0ngFE,79
|
75
75
|
neurostats_API/transformers/cash_flow/base.py,sha256=6Lt44O-xg658-jEFYBHOF2cgD0PGiKK43257uQMSetk,4392
|
76
76
|
neurostats_API/transformers/cash_flow/twse.py,sha256=srrmTmFheJig3el5jQIW8YBgpZVUOq-Af2zM4NxLm7s,2432
|
@@ -78,7 +78,7 @@ neurostats_API/transformers/cash_flow/us.py,sha256=nRJajeDz4HNkv42NosoP0Jir4tIA0
|
|
78
78
|
neurostats_API/transformers/daily_chip/__init__.py,sha256=e-yvQ94J3dkzRbhZwOiAkyt_ub9bRQ7pAVDbO-61Grw,43
|
79
79
|
neurostats_API/transformers/daily_chip/base.py,sha256=KBsnpACakJh2W-k4Kvv-dVNnSNbUCGMeqvQsTQkz-aE,184
|
80
80
|
neurostats_API/transformers/daily_chip/tej.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
81
|
-
neurostats_API/transformers/daily_chip/twse_chip.py,sha256=
|
81
|
+
neurostats_API/transformers/daily_chip/twse_chip.py,sha256=miMu5Si0tFndznf7E_T26c1hYtNqwHplbuB3htVzeGQ,14655
|
82
82
|
neurostats_API/transformers/daily_chip/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
83
83
|
neurostats_API/transformers/daily_chip/utils/institution.py,sha256=1Zj9mxIhvwkmA599a1OYmdorPEAN_U3sl8uhvddxUW0,3384
|
84
84
|
neurostats_API/transformers/daily_chip/utils/margin_trading.py,sha256=oVY_OW63pcSc1TyM_jSPNAoj4HLyZCRshkdsHQsnxyk,38
|
@@ -94,18 +94,18 @@ neurostats_API/transformers/finance_overview/base.py,sha256=uksr5sUhbaL12ZBH3cUt
|
|
94
94
|
neurostats_API/transformers/finance_overview/stats_overview.py,sha256=ml-u6BHCSKaTebvDAOBgyJfT6o3LCmluCfneABn1ysw,2884
|
95
95
|
neurostats_API/transformers/month_revenue/__init__.py,sha256=fNj-FNJgl7yhYeswd3UFZEcSNoDF4kL6Mkspjom2cSo,47
|
96
96
|
neurostats_API/transformers/month_revenue/base.py,sha256=cDswLIZ7UBJX3insyI3NPunxOva9Pf-6TEW15tHjn4s,1881
|
97
|
-
neurostats_API/transformers/month_revenue/twse.py,sha256
|
97
|
+
neurostats_API/transformers/month_revenue/twse.py,sha256=BB_6pPnfTW0llud0UjnfmYdLTmjoafHjfInWbeWrebY,5834
|
98
98
|
neurostats_API/transformers/profit_lose/__init__.py,sha256=oOPyakP1wDnmq7bsxgEm4vu1uWtUR34dd3Oegk9kvq0,83
|
99
99
|
neurostats_API/transformers/profit_lose/base.py,sha256=BJZjE1GmWBI3ayjDkzrtQTrn0vjTSVckPbrQ_u6zEl0,3125
|
100
100
|
neurostats_API/transformers/profit_lose/twse.py,sha256=RwAJWQBdsjFaLlW-HL6oUGxLAd8jXPpp6ljVB8uOfhQ,5400
|
101
|
-
neurostats_API/transformers/profit_lose/us.py,sha256=
|
101
|
+
neurostats_API/transformers/profit_lose/us.py,sha256=q7Vbxp_xzB0SUsxIqQYENi3RayfqR6Nfynvt7p-KHlI,847
|
102
102
|
neurostats_API/transformers/tej/__init__.py,sha256=WihARZhphkvApsKr4U0--68m1M-Dc_rpV7xoV2fUV7E,61
|
103
103
|
neurostats_API/transformers/tej/base.py,sha256=YD6M3Iok-KXb5EDhqa_fUzJ-zWXLeoXPsavdDJD-ks4,5436
|
104
|
-
neurostats_API/transformers/tej/finance_statement.py,sha256=
|
104
|
+
neurostats_API/transformers/tej/finance_statement.py,sha256=rE-Kc94hzW8-xcKn6ry8LwwT8dSoGRKGsmvd5W4_SUs,2798
|
105
105
|
neurostats_API/transformers/value/__init__.py,sha256=D8qMk0aLsv7CBBJHo5zsq_UuBKmZYNyqS3s-RWfhvy8,73
|
106
106
|
neurostats_API/transformers/value/base.py,sha256=wR2LDiwGET126mwrPxYoApyl4lwx1MjWxFpOKLso_As,186
|
107
107
|
neurostats_API/transformers/value/tej.py,sha256=csk0kLCrvXN7T_j9KkvXRRJreWZK6t3bYlPEfWcfBTo,244
|
108
|
-
neurostats_API/transformers/value/twse.py,sha256=
|
108
|
+
neurostats_API/transformers/value/twse.py,sha256=uNGLkxCIfQhzRkalSn6o2kgPT-uw41KGTL6s3e7SneI,1429
|
109
109
|
neurostats_API/utils/__init__.py,sha256=ZPLgh-MNOhskDhWzabLXAyZIjwJgX-sE5YlWJHEWfUw,222
|
110
110
|
neurostats_API/utils/calculate_value.py,sha256=ioPV5VWitJ2NylBi5vwfs-payAUYxWhAiS7aaJjzQKQ,4305
|
111
111
|
neurostats_API/utils/data_process.py,sha256=cD1Vzv8oDpsd1Y7qCALTyM-AP1nkwqhfOgDY0KQpXec,10442
|
@@ -113,7 +113,7 @@ neurostats_API/utils/datetime.py,sha256=XJya4G8b_-ZOaBbMXgQjWh2MC4wc-o6goQ7EQJQM
|
|
113
113
|
neurostats_API/utils/db_client.py,sha256=OYe6yazcR4Aa6jYmy47JrryUeh2NnKGqY2K_lSZe6i8,455
|
114
114
|
neurostats_API/utils/exception.py,sha256=yv92GVh5uHV1BgRmO4DwJcX_PtE0-TSgQoo3VnZ5hOQ,277
|
115
115
|
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.
|
116
|
+
neurostats_API-1.0.0rc5.dist-info/METADATA,sha256=6JSpvVQmq9d9DmvuArlutP-T1rH5UkGcpyDtMnejmu0,2964
|
117
|
+
neurostats_API-1.0.0rc5.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
|
118
|
+
neurostats_API-1.0.0rc5.dist-info/top_level.txt,sha256=nSlQPMG0VtXivJyedp4Bkf86EOy2TpW10VGxolXrqnU,15
|
119
|
+
neurostats_API-1.0.0rc5.dist-info/RECORD,,
|
File without changes
|
File without changes
|