neurostats-API 0.0.4__py3-none-any.whl → 0.0.5__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/base.py +2 -5
- neurostats_API/fetchers/finance_overview.py +2 -2
- neurostats_API/fetchers/tech.py +2 -3
- neurostats_API/fetchers/value_invest.py +2 -2
- neurostats_API/utils/__init__.py +1 -1
- neurostats_API/utils/db_client.py +11 -5
- neurostats_API/utils/fetcher.py +2 -3
- {neurostats_API-0.0.4.dist-info → neurostats_API-0.0.5.dist-info}/METADATA +2 -2
- {neurostats_API-0.0.4.dist-info → neurostats_API-0.0.5.dist-info}/RECORD +12 -12
- {neurostats_API-0.0.4.dist-info → neurostats_API-0.0.5.dist-info}/WHEEL +1 -1
- {neurostats_API-0.0.4.dist-info → neurostats_API-0.0.5.dist-info}/top_level.txt +0 -0
neurostats_API/__init__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__='0.0.
|
1
|
+
__version__='0.0.5'
|
neurostats_API/fetchers/base.py
CHANGED
@@ -5,14 +5,11 @@ import pytz
|
|
5
5
|
from datetime import datetime, timedelta, date
|
6
6
|
from ..utils import StatsDateTime, StatsProcessor
|
7
7
|
import yaml
|
8
|
-
from ..utils import shared_client
|
9
|
-
|
10
8
|
|
11
9
|
class StatsFetcher:
|
12
|
-
|
13
|
-
def __init__(self, ticker):
|
10
|
+
def __init__(self, ticker, db_client):
|
14
11
|
self.ticker = ticker
|
15
|
-
self.db =
|
12
|
+
self.db = db_client[
|
16
13
|
"company"] # Replace with your database name
|
17
14
|
self.collection = self.db["twse_stats"]
|
18
15
|
|
@@ -11,8 +11,8 @@ class FinanceOverviewFetcher(StatsFetcher):
|
|
11
11
|
對應iFa.ai -> 財務分析 -> 重要指標(finance_overview)
|
12
12
|
"""
|
13
13
|
|
14
|
-
def __init__(self, ticker):
|
15
|
-
super().__init__(ticker)
|
14
|
+
def __init__(self, ticker, db_client):
|
15
|
+
super().__init__(ticker, db_client)
|
16
16
|
|
17
17
|
self.target_fields = StatsProcessor.load_yaml("finance_overview_dict.yaml")
|
18
18
|
self.inverse_dict = StatsProcessor.load_txt("seasonal_data_field_dict.txt", json_load=True)
|
neurostats_API/fetchers/tech.py
CHANGED
@@ -3,9 +3,8 @@ import pandas as pd
|
|
3
3
|
|
4
4
|
class TechFetcher(StatsFetcher):
|
5
5
|
|
6
|
-
def __init__(self, ticker:str):
|
7
|
-
super().__init__()
|
8
|
-
self.ticker = ticker
|
6
|
+
def __init__(self, ticker:str, db_client):
|
7
|
+
super().__init__(ticker, db_client)
|
9
8
|
self.full_ohlcv = self._get_ohlcv()
|
10
9
|
self.basic_indexes = ['SMA5', 'SMA20', 'SMA60', 'EMA5', 'EMA20',
|
11
10
|
'EMA40', 'EMA12', 'EMA26', 'RSI7', 'RSI14',
|
@@ -6,8 +6,8 @@ from ..utils import StatsDateTime, StatsProcessor
|
|
6
6
|
|
7
7
|
class ValueFetcher(StatsFetcher):
|
8
8
|
|
9
|
-
def __init__(self, ticker: str):
|
10
|
-
super().__init__(ticker)
|
9
|
+
def __init__(self, ticker: str, db_client):
|
10
|
+
super().__init__(ticker, db_client)
|
11
11
|
|
12
12
|
def prepare_query(self, start_date, end_date):
|
13
13
|
pipeline = super().prepare_query()
|
neurostats_API/utils/__init__.py
CHANGED
@@ -2,9 +2,15 @@ import os
|
|
2
2
|
from pymongo import MongoClient
|
3
3
|
from dotenv import load_dotenv
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
class DBClient:
|
6
|
+
def __init__(self, mongo_uri):
|
7
|
+
"""初始化時接收 MongoDB 連接 URI"""
|
8
|
+
self.client = MongoClient(mongo_uri)
|
9
|
+
self.db = self.client["twse_company"]
|
10
|
+
|
11
|
+
def get_client(self):
|
12
|
+
return self.client
|
7
13
|
|
8
|
-
|
9
|
-
|
10
|
-
|
14
|
+
def get_collection(self, collection_name):
|
15
|
+
"""返回指定名稱的集合"""
|
16
|
+
return self.db[collection_name]
|
neurostats_API/utils/fetcher.py
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
from .db_client import shared_client
|
2
1
|
import pandas as pd
|
3
2
|
import json
|
4
3
|
import pytz
|
@@ -9,8 +8,8 @@ import yaml
|
|
9
8
|
|
10
9
|
class StatsFetcher:
|
11
10
|
|
12
|
-
def __init__(self):
|
13
|
-
self.db =
|
11
|
+
def __init__(self, db_client):
|
12
|
+
self.db = db_client["company"] # Replace with your database name
|
14
13
|
self.collection = self.db["twse_stats"]
|
15
14
|
|
16
15
|
self.timezone = pytz.timezone("Asia/Taipei")
|
@@ -1,23 +1,23 @@
|
|
1
|
-
neurostats_API/__init__.py,sha256=
|
1
|
+
neurostats_API/__init__.py,sha256=OLrZC7ZCn3Aj62X2Z9b8AcBIkT2ggdm7W7clZYbvlR4,19
|
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/fetchers/__init__.py,sha256=k-pPWen3gQNr6d6DPFEXP1Q6SPC6TGIuIFf8w6r75YQ,137
|
5
5
|
neurostats_API/fetchers/balance_sheet.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
|
-
neurostats_API/fetchers/base.py,sha256=
|
7
|
-
neurostats_API/fetchers/finance_overview.py,sha256=
|
6
|
+
neurostats_API/fetchers/base.py,sha256=NW2SFzrimyAIrdJx1LVmTazelyZOAtcj54kJKHc4Vaw,1662
|
7
|
+
neurostats_API/fetchers/finance_overview.py,sha256=_w5OzFQpzC7eL_S5iMtgrIhx5gcov9gKzc6XzFutEFU,18309
|
8
8
|
neurostats_API/fetchers/month_revenue.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
9
|
neurostats_API/fetchers/profit_lose.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
|
-
neurostats_API/fetchers/tech.py,sha256=
|
11
|
-
neurostats_API/fetchers/value_invest.py,sha256=
|
10
|
+
neurostats_API/fetchers/tech.py,sha256=wH1kkqiETQhF0HAhk-UIiucnZ3EiL85Q-yMWCcVOiFM,11395
|
11
|
+
neurostats_API/fetchers/value_invest.py,sha256=tg8yELbVnTFTEclrwgXnCRW377KkcoLiP-Gk2pyM-9Y,2886
|
12
12
|
neurostats_API/tools/finance_overview_dict.yaml,sha256=Vvf8bv23NwJP8Yyw8DPS8c0_jjT_Wctnnz51SHS4AeI,2335
|
13
13
|
neurostats_API/tools/profit_lose.yaml,sha256=f8balMTcK9elMW0k1PtbZ_6kEobTQ51fcBzqpbMObkk,2086
|
14
14
|
neurostats_API/tools/seasonal_data_field_dict.txt,sha256=KlIIdTTdbvUd9TSDE9-gpzk2jt2ck_LdisX8cnrWMD4,7869
|
15
|
-
neurostats_API/utils/__init__.py,sha256=
|
15
|
+
neurostats_API/utils/__init__.py,sha256=FTYKRFzW2XVXdnSHXnS3mQQaHlKF9xGqrMsgZZ2kroc,142
|
16
16
|
neurostats_API/utils/data_process.py,sha256=AeDWS9eHlHRqzfDKph-14GXERtHLSMKijsIrzZ0pPPo,595
|
17
17
|
neurostats_API/utils/datetime.py,sha256=I9CIgZdE5OMzUciOS5wvapOVEIrXG_0Qb6iDKfIod6c,574
|
18
|
-
neurostats_API/utils/db_client.py,sha256=
|
19
|
-
neurostats_API/utils/fetcher.py,sha256=
|
20
|
-
neurostats_API-0.0.
|
21
|
-
neurostats_API-0.0.
|
22
|
-
neurostats_API-0.0.
|
23
|
-
neurostats_API-0.0.
|
18
|
+
neurostats_API/utils/db_client.py,sha256=OYe6yazcR4Aa6jYmy47JrryUeh2NnKGqY2K_lSZe6i8,455
|
19
|
+
neurostats_API/utils/fetcher.py,sha256=VbrUhjA-GG5AyjPX2SHtFIbZM4dm3jo0RgZzuCbb_Io,40927
|
20
|
+
neurostats_API-0.0.5.dist-info/METADATA,sha256=guhWMAkycV7L2qCsCyBjfZzB8zDP9eF21_R_96dMrkw,20285
|
21
|
+
neurostats_API-0.0.5.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
|
22
|
+
neurostats_API-0.0.5.dist-info/top_level.txt,sha256=nSlQPMG0VtXivJyedp4Bkf86EOy2TpW10VGxolXrqnU,15
|
23
|
+
neurostats_API-0.0.5.dist-info/RECORD,,
|
File without changes
|