| | |
| | | f"【{k_line_data[0]['sec_name']}】--------------------------------------------------------------------------------------------------------[有强度视界]") |
| | | logger_info( |
| | | f"【无概念 有强度】出现在板块强度大于2的列表中!瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%,最新价: {current_price},瞬时涨幅:{round(tick_growth, 2)}%,当日当时涨幅:{today_growth}%,当前时间:{current_created_at}。") |
| | | logger_info( |
| | | f"【强度数据】 == {data_cache.market_sift_plate_stock_dict}") |
| | | # logger_info( |
| | | # f"【强度数据】 == {data_cache.market_sift_plate_stock_dict}") |
| | | strength_plate_set = set(strength_plate) |
| | | intersection_plate = bought_plate_set.intersection(strength_plate_set) |
| | | if len(intersection_plate) > 0: |
| | |
| | | # 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): |
| | |
| | | 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]}, |
| | |
| | | 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" |
| | |
| | | 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}") |
| | | |