Skip to content

Commit 7f0a37e

Browse files
committed
Use data_source to select fetcher
1 parent 39dc8e3 commit 7f0a37e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

twstock/stock.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@ def purify(self, original_data):
154154
class Stock(analytics.Analytics):
155155
def __init__(self, sid: str, initial_fetch: bool = True):
156156
self.sid = sid
157-
self.fetcher = TWSEFetcher() if codes[sid].market == "上市" else TPEXFetcher()
157+
self.fetcher = (
158+
TWSEFetcher() if codes[sid].data_source == "twse" else TPEXFetcher()
159+
)
158160
self.raw_data = []
159161
self.data = []
160162

0 commit comments

Comments
 (0)