From ab510f72fafc82d1a55680f5c9fcf93752c59bd6 Mon Sep 17 00:00:00 2001 From: admin <admin@example.com> Date: 星期二, 22 四月 2025 14:35:48 +0800 Subject: [PATCH] 总手涨跌分布数据分析 分布轴线方向修改 --- strategy/market_sentiment_analysis.py | 20 +++++++++----------- 1 files changed, 9 insertions(+), 11 deletions(-) diff --git a/strategy/market_sentiment_analysis.py b/strategy/market_sentiment_analysis.py index 83a1ad7..47eec14 100644 --- a/strategy/market_sentiment_analysis.py +++ b/strategy/market_sentiment_analysis.py @@ -435,13 +435,10 @@ # 1. 娓呮礂骞惰浆鎹㈠師濮嬫暟鎹负鏁存暟鍒楄〃 counts = [int(x) for x in zszdfb_str.strip(',').split(',') if x] - # 2. 瀹氫箟鍖洪棿鍒掑垎锛堝亣璁句粠-10%鍒�+8%锛�1%闂撮殧锛� + # 2. 瀹氫箟鍖洪棿鍒掑垎锛堝亣璁句粠-9%鍒�+9%锛�1%闂撮殧锛� bins = [ - "[-10%, -9%)", "[-9%, -8%)", "[-8%, -7%)", "[-7%, -6%)", "[-6%, -5%)", - "[-5%, -4%)", "[-4%, -3%)", "[-3%, -2%)", "[-2%, -1%)", "[-1%, 0%)", - "[0%, 1%)", "[1%, 2%)", "[2%, 3%)", "[3%, 4%)", "[4%, 5%)", - "[5%, 6%)", "[6%, 7%)", "[7%, 8%)" - ] + "[+9%, +8%)", "[+8%, +7%)", "[+7%, +6%)", "[+6%, +5%)", "[+5%, +4%)", "[+4%, +3%)", "[+3%, +2%)", "[+2%, +1%)", "[+1%, 0%)", "[0%, -1%)", "[-1%, -2%)", "[-2%, -3%)", "[-3%, -4%)", "[-4%, -5%)", "[-5%, -6%)", "[-6%, -7%)", "[-7%, -8%)", "[ -8%, -9%)" + ] # 3. 楠岃瘉鏁版嵁闀垮害 if len(counts) != len(bins): @@ -589,7 +586,7 @@ sorted_items = sorted(factors['rise_vs_fall']['percentages'].items(), key=lambda item: item[1], reverse=True) top_three_items = sorted_items[:3] - # 鏋勫缓鏂扮殑瀛楀吀 + # 鍒嗗竷鏁伴噺鍓嶄笁鐨勭殑鎸箙鍖洪棿 factors['top_three'] = { 'top1': {'key': top_three_items[0][0], 'value': top_three_items[0][1]}, 'top2': {'key': top_three_items[1][0], 'value': top_three_items[1][1]}, @@ -706,6 +703,7 @@ logger.info(f"鎬昏偂绁ㄦ暟: {factors['total_stocks']}\n" f"娑ㄨ穼姣�(BDR): {factors['rise_vs_fall']['rise_vs_fall_ratio']:.2f}\n" f"鏋佺娉㈠姩姣斾緥: {factors['sentiment']['extreme_ratio']:.2%}\n" + f"涔版柟璧勯噾鍑�娴佸叆{factors['capital_flow']['buy']},鍗栨柟璧勯噾鍑�娴佸嚭{factors['capital_flow']['sell']}" f"璧勯噾鍑�娴佸叆(鍏�): {round(factors['capital_flow']['net'] / 10000, 2)}涓嘰n" f"娑ㄥ仠鑲″崰姣�: {factors['sentiment']['zt_ratio']:.2%}\n" f"甯傚満鎯呯华閲忓寲: {'绉瀬' if factors['sentiment']['sign'] else '璋ㄦ厧'}\n" @@ -714,13 +712,13 @@ f"鑱氶泦鍖哄煙锛歿factors['rise_vs_fall']['gather_area']}锛岃仛闆嗗尯鍩熺殑姣斾緥鍊硷細{factors['rise_vs_fall']['percentages'].get(factors['rise_vs_fall']['gather_area'])}%\n" f"闆舵暎鍖哄煙锛歿factors['rise_vs_fall']['scattered_area']}锛岃仛闆嗗尯鍩熺殑姣斾緥鍊硷細{factors['rise_vs_fall']['percentages'].get(factors['rise_vs_fall']['scattered_area'])}%\n" f"娑ㄨ穼鍥犲瓙瀛楀吀={factors['rise_vs_fall']}\n") - logger.info("\n========== 鎬绘墜娑ㄨ穼鍒嗗竷 ==========") + logger.info("========== 鎬绘墜娑ㄨ穼鍒嗗竷 ==========") # 鎵撳嵃缁撴灉锛堢編鍖栬緭鍑猴級 for item in factors['rise_vs_fall']['parsed_data']["鍖洪棿鍒嗗竷"]: logger.info(f"{item['鍖洪棿']}: {item['鎴愪氦閲�(鎵�)']}鎵�") - logger.info(f"\n鎬绘垚浜ら噺: {factors['rise_vs_fall']['parsed_data']['鎬绘垚浜ら噺(鎵�)']}鎵�") - logger.info(f"\n璇存槑: {factors['rise_vs_fall']['parsed_data']['璇存槑']}") - logger.info("\n========== 绛栫暐淇″彿 ==========") + logger.info(f"鎬绘垚浜ら噺: {factors['rise_vs_fall']['parsed_data']['鎬绘垚浜ら噺(鎵�)']}鎵媆n") + logger.info(f"璇存槑: {factors['rise_vs_fall']['parsed_data']['璇存槑']}\n") + logger.info("========== 绛栫暐淇″彿 ==========") for i, signal in enumerate(signals, 1): logger.info(f"淇″彿{i}: {signal}") -- Gitblit v1.8.0