From 8535f56dbf6e410b4a09f02f95d4d49bcc8753f2 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期一, 27 三月 2023 18:58:54 +0800 Subject: [PATCH] 看盘页面数据调整 --- juejin.py | 48 +++++++++++++++++++++++++++++++----------------- 1 files changed, 31 insertions(+), 17 deletions(-) diff --git a/juejin.py b/juejin.py index 0740ea7..b9230f4 100644 --- a/juejin.py +++ b/juejin.py @@ -592,23 +592,37 @@ # 瑙f瀽鏈�澶ч噺 -def parse_max_volume(datas): +def parse_max_volume(datas, is_new_top=False): max_volume = 0 - for i in range(len(datas)): - # 鏌ヨ娑ㄥ仠 - item = datas[i] - volume = item["volume"] - if max_volume < volume: - max_volume = volume - # 鏄惁鏈夋定鍋� - limit_up_price = float(gpcode_manager.get_limit_up_price_by_preprice(item["pre_close"])) - if abs(limit_up_price - item["high"]) < 0.01: - next_volume = 0 - if i > 0: - next_volume = datas[i - 1]["volume"] - volume = max(volume, next_volume) - return (volume, volume) - return (max_volume, max_volume) + + max_volume_date = None + if is_new_top: + # 濡傛灉鏄獊鐮村墠楂樺氨鍙栨渶澶ч噺 + for item in datas: + if max_volume < item["volume"]: + max_volume = item["volume"] + max_volume_date = item["bob"] + else: + date = None + for i in range(len(datas)): + # 鏌ヨ娑ㄥ仠 + item = datas[i] + volume = item["volume"] + if max_volume < volume: + max_volume = volume + max_volume_date = item['bob'] + # 鏄惁鏈夋定鍋� + limit_up_price = float(gpcode_manager.get_limit_up_price_by_preprice(item["pre_close"])) + if abs(limit_up_price - item["high"]) < 0.01: + next_volume = 0 + if i > 0: + next_volume = datas[i - 1]["volume"] + date = datas[i]["bob"] + if volume < next_volume: + volume = next_volume + date = datas[i - 1]["bob"] + return volume, volume, date.strftime("%Y-%m-%d") + return max_volume, max_volume, max_volume_date.strftime("%Y-%m-%d") # 鏄惁鏈夋定鍋� @@ -654,6 +668,6 @@ if __name__ == '__main__': - datas=(get_volumns_by_code("603083", 150)) + datas = (get_volumns_by_code("603083", 150)) print(datas) print(get_limit_up_money_percent(datas)) -- Gitblit v1.8.0