From 700c6ed1fa71fe5818a21beca8f3d10ddd7ce3be Mon Sep 17 00:00:00 2001 From: Jimmy Situ Date: Sat, 20 Apr 2024 11:26:12 +0800 Subject: [PATCH] Fix qurey database bug --- examples/get_xshg.py | 6 +++++- msfinance/stocks.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/examples/get_xshg.py b/examples/get_xshg.py index a343aca..7652b3d 100755 --- a/examples/get_xshg.py +++ b/examples/get_xshg.py @@ -11,7 +11,11 @@ ) tickers_list = { - '603288', '600519', '688041', + '603288', # Fosha Haitian + '600519', # Kweichow Moutai + '688041', # Hygon + '688047', # Loongson + } for ticker in sorted(tickers_list): diff --git a/msfinance/stocks.py b/msfinance/stocks.py index ed2d969..0038a3e 100644 --- a/msfinance/stocks.py +++ b/msfinance/stocks.py @@ -129,7 +129,7 @@ def _check_database(self, unique_id): ''' if self.db: try: - query = f"SELECT * FROM {unique_id}" + query = f"SELECT * FROM '{unique_id}'" df = pd.read_sql_query(query, self.db) return df except pd.errors.DatabaseError as e: