From 1b49e9a1c5d31a568406a361b883eec211326983 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期五, 07 六月 2024 14:45:03 +0800 Subject: [PATCH] 自由流通量相关测试 --- third_data/history_k_data_util.py | 13 ++++++------- 1 files changed, 6 insertions(+), 7 deletions(-) diff --git a/third_data/history_k_data_util.py b/third_data/history_k_data_util.py index a24fce3..c29f6f7 100644 --- a/third_data/history_k_data_util.py +++ b/third_data/history_k_data_util.py @@ -87,8 +87,6 @@ return cls.__request("get_history_instruments", {"symbols": symbols, "start_date": start_date, "end_date": end_date, "fields": fields}) - - @classmethod def get_previous_trading_date(cls, exchange, date): return cls.__request("get_previous_trading_date", {"exchange": exchange, "date": date}) @@ -155,7 +153,7 @@ return results @classmethod - def get_gp_current_info(cls, codes): + def get_gp_current_info(cls, codes, fields=None): if not codes: return [] symbols = cls.get_juejin_code_list_with_prefix(codes) @@ -165,7 +163,7 @@ data = gmapi.current(symbols=",".join(symbols)) return data else: - data = JueJinHttpApi.current(symbols=",".join(symbols), fields='') + data = JueJinHttpApi.current(symbols=",".join(symbols), fields=fields) return data # 杩斿洖鎸囧畾鏃ユ湡鐨勪笂涓氦鏄撴棩 @@ -189,7 +187,7 @@ account_id, s_id, token = cls.getJueJinAccountInfo() gmapi.set_token(token) return gmapi.get_history_instruments(symbols=symbols, start_date=start_date, end_date=end_date, - fields="symbol,sec_type,sec_id,sec_name,listed_date,sec_level,is_suspended,pre_close") + fields="symbol,sec_type,sec_id,sec_name,listed_date,sec_level,is_suspended,pre_close") else: return JueJinHttpApi.get_history_instruments(symbols, start_date, end_date, fields) @@ -335,11 +333,12 @@ if __name__ == "__main__": now_day = tool.get_now_date_str() - results = JueJinApi.get_history_instruments(JueJinApi.get_juejin_code_list_with_prefix(["600265"]), tool.date_sub(now_day,30), tool.date_sub(now_day,1)) + results = JueJinApi.get_history_instruments(JueJinApi.get_juejin_code_list_with_prefix(["600265"]), + tool.date_sub(now_day, 30), tool.date_sub(now_day, 1)) results = results[-5:] normal = True for r in results: - if r["sec_level"]!=1: + if r["sec_level"] != 1: normal = False break print(normal) -- Gitblit v1.8.0