From a9768674e4ef88f3e72b200c7cf35a0b8735d6f3 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期四, 28 十二月 2023 16:34:28 +0800 Subject: [PATCH] 开盘啦原因输出 --- utils/buy_condition_util.py | 13 +++++++++++++ third_data/feed_analysis.py | 37 +++++++++++++++++++++++++++++++++++++ l2/l2_data_manager_new.py | 2 +- 3 files changed, 51 insertions(+), 1 deletions(-) diff --git a/l2/l2_data_manager_new.py b/l2/l2_data_manager_new.py index b78f2a0..faefdb7 100644 --- a/l2/l2_data_manager_new.py +++ b/l2/l2_data_manager_new.py @@ -679,7 +679,7 @@ if not can_buy_result[0] and can_buy_result[1]: info.set_kpl_match_blocks(["鐙嫍"]) elif not can_buy_result[0] and not can_buy_result[1]: - info.set_kpl_match_blocks("闈炵嫭鑻椾笉婊¤冻韬綅") + info.set_kpl_match_blocks(["闈炵嫭鑻椾笉婊¤冻韬綅"]) else: info.set_kpl_match_blocks(can_buy_result[0]) trade_record_log_util.add_place_order_log(code, info) diff --git a/third_data/feed_analysis.py b/third_data/feed_analysis.py new file mode 100644 index 0000000..f73d966 --- /dev/null +++ b/third_data/feed_analysis.py @@ -0,0 +1,37 @@ +# 鑾峰彇棣栨澘婧环鐜� +import json + +from third_data import kpl_api, kpl_util +from third_data.history_k_data_util import HistoryKDatasUtils +from utils import tool + + +def getFirstLimitUpPremium(day): + results = kpl_api.getHistoryLimitUpInfo(day) + # 鑾峰彇涓嬩竴涓氦鏄撴棩 + next_day = HistoryKDatasUtils.get_next_trading_date(day) + result_list = kpl_util.parseDaBanData(json.dumps({"list": results, "errcode": 0}), kpl_util.DABAN_TYPE_LIMIT_UP) + target_codes = set() + for result in result_list: + if not tool.is_shsz_code(result[0]): + continue + if result[4] != '棣栨澘': + continue + target_codes.add(result[0]) + # TODO 鑾峰彇娑ㄥ仠鏃ョ殑鏀剁洏浠� + + # 鑾峰彇k绾� + open_price = None + high_price = None + if tool.get_now_date_str() == next_day: + records = HistoryKDatasUtils.get_gp_current_info([result[0]]) + print(records) + else: + records = HistoryKDatasUtils.get_history_tick_n(result[0], 15) + for record in records: + print(record) + + + +if __name__ == "__main__": + getFirstLimitUpPremium("2023-12-26") diff --git a/utils/buy_condition_util.py b/utils/buy_condition_util.py new file mode 100644 index 0000000..b3f130d --- /dev/null +++ b/utils/buy_condition_util.py @@ -0,0 +1,13 @@ +""" +涔板叆鏉′欢宸ュ叿 +""" +# 鑾峰彇鑷敱娴侀�氬競鍊奸檺鍒� +# 杩斿洖:锛堟渶澶т拱鍏�,鏈�浼樿嚜鐢辨祦閫氭渶灏�,鏈�浼樿嚜鐢辨祦閫氭渶澶э級 +from trade.trade_manager import MarketSituationManager + + +def get_zyltgb_threshold(market_sitation: int): + if market_sitation == MarketSituationManager.SITUATION_GOOD: + return 100 * 100000000, 20 * 100000000, 60 * 100000000 + + return 40 * 100000000, 10 * 100000000, 20 * 100000000 -- Gitblit v1.8.0