neurostats-API 0.0.8__tar.gz → 0.0.9__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.
- {neurostats_API-0.0.8 → neurostats_API-0.0.9}/PKG-INFO +2 -2
- {neurostats_API-0.0.8 → neurostats_API-0.0.9}/README.md +1 -1
- {neurostats_API-0.0.8 → neurostats_API-0.0.9}/neurostats_API/fetchers/balance_sheet.py +9 -3
- {neurostats_API-0.0.8 → neurostats_API-0.0.9}/neurostats_API/fetchers/cash_flow.py +8 -3
- {neurostats_API-0.0.8 → neurostats_API-0.0.9}/neurostats_API/fetchers/finance_overview.py +12 -4
- {neurostats_API-0.0.8 → neurostats_API-0.0.9}/neurostats_API/fetchers/month_revenue.py +9 -3
- {neurostats_API-0.0.8 → neurostats_API-0.0.9}/neurostats_API/fetchers/profit_lose.py +9 -4
- {neurostats_API-0.0.8 → neurostats_API-0.0.9}/neurostats_API/fetchers/value_invest.py +14 -5
- {neurostats_API-0.0.8 → neurostats_API-0.0.9}/neurostats_API/utils/datetime.py +8 -0
- {neurostats_API-0.0.8 → neurostats_API-0.0.9}/neurostats_API.egg-info/PKG-INFO +2 -2
- {neurostats_API-0.0.8 → neurostats_API-0.0.9}/setup.py +1 -1
- {neurostats_API-0.0.8 → neurostats_API-0.0.9}/MANIFEST.in +0 -0
- {neurostats_API-0.0.8 → neurostats_API-0.0.9}/neurostats_API/__init__.py +0 -0
- {neurostats_API-0.0.8 → neurostats_API-0.0.9}/neurostats_API/cli.py +0 -0
- {neurostats_API-0.0.8 → neurostats_API-0.0.9}/neurostats_API/fetchers/__init__.py +0 -0
- {neurostats_API-0.0.8 → neurostats_API-0.0.9}/neurostats_API/fetchers/base.py +0 -0
- {neurostats_API-0.0.8 → neurostats_API-0.0.9}/neurostats_API/fetchers/tech.py +0 -0
- {neurostats_API-0.0.8 → neurostats_API-0.0.9}/neurostats_API/main.py +0 -0
- {neurostats_API-0.0.8 → neurostats_API-0.0.9}/neurostats_API/tools/balance_sheet.yaml +0 -0
- {neurostats_API-0.0.8 → neurostats_API-0.0.9}/neurostats_API/tools/cash_flow_percentage.yaml +0 -0
- {neurostats_API-0.0.8 → neurostats_API-0.0.9}/neurostats_API/tools/finance_overview_dict.yaml +0 -0
- {neurostats_API-0.0.8 → neurostats_API-0.0.9}/neurostats_API/tools/profit_lose.yaml +0 -0
- {neurostats_API-0.0.8 → neurostats_API-0.0.9}/neurostats_API/tools/seasonal_data_field_dict.txt +0 -0
- {neurostats_API-0.0.8 → neurostats_API-0.0.9}/neurostats_API/utils/__init__.py +0 -0
- {neurostats_API-0.0.8 → neurostats_API-0.0.9}/neurostats_API/utils/data_process.py +0 -0
- {neurostats_API-0.0.8 → neurostats_API-0.0.9}/neurostats_API/utils/db_client.py +0 -0
- {neurostats_API-0.0.8 → neurostats_API-0.0.9}/neurostats_API/utils/fetcher.py +0 -0
- {neurostats_API-0.0.8 → neurostats_API-0.0.9}/neurostats_API.egg-info/SOURCES.txt +0 -0
- {neurostats_API-0.0.8 → neurostats_API-0.0.9}/neurostats_API.egg-info/dependency_links.txt +0 -0
- {neurostats_API-0.0.8 → neurostats_API-0.0.9}/neurostats_API.egg-info/top_level.txt +0 -0
- {neurostats_API-0.0.8 → neurostats_API-0.0.9}/setup.cfg +0 -0
- {neurostats_API-0.0.8 → neurostats_API-0.0.9}/test/test_fetchers.py +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.9
|
4
4
|
Summary: The service of NeuroStats website
|
5
5
|
Home-page: https://github.com/NeurowattStats/NeuroStats_API.git
|
6
6
|
Author: JasonWang@Neurowatt
|
@@ -78,7 +78,7 @@ pip install neurostats-API
|
|
78
78
|
```Python
|
79
79
|
>>> import neurostats_API
|
80
80
|
>>> print(neurostats_API.__version__)
|
81
|
-
0.0.
|
81
|
+
0.0.9
|
82
82
|
```
|
83
83
|
|
84
84
|
### 得到最新一期的評價資料與歷年評價
|
@@ -75,10 +75,16 @@ class BalanceSheetFetcher(StatsFetcher):
|
|
75
75
|
return fetched_data[-1]
|
76
76
|
|
77
77
|
def query_data(self):
|
78
|
-
|
78
|
+
try:
|
79
|
+
latest_time = StatsDateTime.get_latest_time(
|
80
|
+
self.ticker, self.collection)['last_update_time']
|
81
|
+
year = latest_time['seasonal_data']['latest_year']
|
82
|
+
season = latest_time['seasonal_data']['latest_season']
|
83
|
+
except Exception as e:
|
84
|
+
today = StatsDateTime.get_today()
|
85
|
+
year = today.year - 1 if (today.season == 1) else today.year
|
86
|
+
season = 4 if (today.season == 1) else today.season - 1
|
79
87
|
|
80
|
-
year = today.year - 1 if (today.season == 1) else today.year
|
81
|
-
season = 4 if (today.season == 1) else today.season - 2
|
82
88
|
fetched_data = self.collect_data(year, season)
|
83
89
|
|
84
90
|
return self.process_data(season, fetched_data)
|
@@ -65,9 +65,14 @@ class CashFlowFetcher(StatsFetcher):
|
|
65
65
|
return list(fetched_data)[0]
|
66
66
|
|
67
67
|
def query_data(self):
|
68
|
-
|
69
|
-
|
70
|
-
|
68
|
+
|
69
|
+
try:
|
70
|
+
latest_time = StatsDateTime.get_latest_time(self.ticker, self.collection)['last_update_time']
|
71
|
+
target_season = latest_time['seasonal_data']['latest_season']
|
72
|
+
|
73
|
+
except:
|
74
|
+
today = StatsDateTime.get_today()
|
75
|
+
target_season = today.season - 1 if (today.season > 1) else 4
|
71
76
|
|
72
77
|
fetched_data = self.collect_data(target_season)
|
73
78
|
|
@@ -83,10 +83,17 @@ class FinanceOverviewFetcher(StatsFetcher):
|
|
83
83
|
return fetched_data[0]
|
84
84
|
|
85
85
|
def query_data(self):
|
86
|
-
today = StatsDateTime.get_today()
|
87
86
|
|
88
|
-
|
89
|
-
|
87
|
+
try:
|
88
|
+
latest_time = StatsDateTime.get_latest_time(
|
89
|
+
self.ticker, self.collection)['last_update_time']
|
90
|
+
year = latest_time['seasonal_data']['latest_year']
|
91
|
+
season = latest_time['seasonal_data']['latest_season']
|
92
|
+
except Exception as e:
|
93
|
+
today = StatsDateTime.get_today()
|
94
|
+
year = today.year - 1 if (today.season == 1) else today.year
|
95
|
+
season = 4 if (today.season == 1) else today.season - 1
|
96
|
+
|
90
97
|
fetched_data = self.collect_data(year, season)
|
91
98
|
finance_dict = fetched_data['seasonal_data'][0]
|
92
99
|
FinanceOverviewProcessor.process_rate(finance_dict)
|
@@ -142,7 +149,8 @@ class FinanceOverviewProcessor(StatsProcessor):
|
|
142
149
|
"""
|
143
150
|
try:
|
144
151
|
EBIT = (finance_dict['revenue'] - finance_dict['operating_cost'] -
|
145
|
-
finance_dict['operating_expenses'] -
|
152
|
+
finance_dict['operating_expenses'] -
|
153
|
+
finance_dict['tax_fee'])
|
146
154
|
finance_dict['EBIT'] = StatsProcessor.cal_non_percentage(EBIT)
|
147
155
|
except (KeyError, ZeroDivisionError, TypeError) as e:
|
148
156
|
finance_dict['EBIT'] = None
|
@@ -46,9 +46,15 @@ class MonthRevenueFetcher(StatsFetcher):
|
|
46
46
|
return fetched_data[-1]
|
47
47
|
|
48
48
|
def query_data(self):
|
49
|
-
|
50
|
-
|
51
|
-
|
49
|
+
try:
|
50
|
+
latest_time = StatsDateTime.get_latest_time(
|
51
|
+
self.ticker, self.collection)['last_update_time']
|
52
|
+
target_year = latest_time['monthly_data']['latest_year']
|
53
|
+
target_month = latest_time['monthly_data']['latest_month']
|
54
|
+
except Exception as e:
|
55
|
+
today = StatsDateTime.get_today()
|
56
|
+
target_month = today.month
|
57
|
+
target_year = today.year
|
52
58
|
|
53
59
|
# Query data
|
54
60
|
fetched_data = self.collect_data(target_year, target_month)
|
@@ -75,10 +75,15 @@ class ProfitLoseFetcher(StatsFetcher):
|
|
75
75
|
return list(fetched_data)[-1]
|
76
76
|
|
77
77
|
def query_data(self):
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
78
|
+
try:
|
79
|
+
latest_time = StatsDateTime.get_latest_time(
|
80
|
+
self.ticker, self.collection)['last_update_time']
|
81
|
+
target_season = latest_time['seasonal_data']['latest_season']
|
82
|
+
except Exception as e:
|
83
|
+
today = StatsDateTime.get_today()
|
84
|
+
|
85
|
+
target_season = today.season
|
86
|
+
target_season = target_season - 1 if target_season > 1 else 4
|
82
87
|
|
83
88
|
fetched_data = self.collect_data(target_season)
|
84
89
|
|
@@ -54,11 +54,20 @@ class ValueFetcher(StatsFetcher):
|
|
54
54
|
return pipeline
|
55
55
|
|
56
56
|
def query_data(self):
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
57
|
+
try:
|
58
|
+
latest_time = StatsDateTime.get_latest_time(
|
59
|
+
self.ticker, self.collection)['last_update_time']
|
60
|
+
target_year = latest_time['daily_data']['last_update'].year
|
61
|
+
start_date = latest_time['daily_data']['last_update'] - timedelta(days=31)
|
62
|
+
end_date = latest_time['daily_data']['last_update']
|
63
|
+
|
64
|
+
except Exception as e:
|
65
|
+
today = StatsDateTime.get_today()
|
66
|
+
target_year = today.year
|
67
|
+
start_date = (today.date - timedelta(days=31))
|
68
|
+
end_date = today.date
|
69
|
+
|
70
|
+
this_year = target_year - 1911
|
62
71
|
|
63
72
|
fetched_data = self.collect_data(start_date, end_date)
|
64
73
|
|
@@ -19,3 +19,11 @@ class StatsDateTime():
|
|
19
19
|
|
20
20
|
return StatsDateTime(today, this_year, this_month, this_day,
|
21
21
|
this_season)
|
22
|
+
|
23
|
+
@classmethod
|
24
|
+
def get_latest_time(cls, ticker, collection):
|
25
|
+
return collection.find_one(
|
26
|
+
{ "ticker" : ticker },
|
27
|
+
{ "_id": 0, "last_update_time": 1 }
|
28
|
+
)
|
29
|
+
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: neurostats-API
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.9
|
4
4
|
Summary: The service of NeuroStats website
|
5
5
|
Home-page: https://github.com/NeurowattStats/NeuroStats_API.git
|
6
6
|
Author: JasonWang@Neurowatt
|
@@ -78,7 +78,7 @@ pip install neurostats-API
|
|
78
78
|
```Python
|
79
79
|
>>> import neurostats_API
|
80
80
|
>>> print(neurostats_API.__version__)
|
81
|
-
0.0.
|
81
|
+
0.0.9
|
82
82
|
```
|
83
83
|
|
84
84
|
### 得到最新一期的評價資料與歷年評價
|
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.8 → neurostats_API-0.0.9}/neurostats_API/tools/cash_flow_percentage.yaml
RENAMED
File without changes
|
{neurostats_API-0.0.8 → neurostats_API-0.0.9}/neurostats_API/tools/finance_overview_dict.yaml
RENAMED
File without changes
|
File without changes
|
{neurostats_API-0.0.8 → neurostats_API-0.0.9}/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
|
File without changes
|
File without changes
|
File without changes
|