add fx strentth

This commit is contained in:
jackyu66git
2025-05-23 21:19:50 +08:00
parent a1e033432b
commit a9d24233b0
14 changed files with 2067 additions and 399 deletions
+19 -5
View File
@@ -220,11 +220,19 @@ def analyze_chan(df):
klc_fx_info = []
for klc in klc_list:
if hasattr(klc, 'klc_fx_type') and klc.klc_fx_type != Chan_KLC_FX.UNKNOWN:
# 计算分型强度
fx_strength = klc.calculate_fx_strength()
fx_strength_level = klc.get_fx_strength_level()
is_strong_fx = klc.is_strong_fx()
klc_fx_info.append({
'time': klc.end_time,
'price': klc.low if klc.fx == Chan_FX_TYPE.BOTTOM else klc.high,
'fx_type': str(klc.klc_fx_type).replace("Chan_KLC_FX.", ""),
'is_bottom': klc.fx == Chan_FX_TYPE.BOTTOM
'is_bottom': klc.fx == Chan_FX_TYPE.BOTTOM,
'fx_strength': fx_strength, # 分型强度分数 (0-100)
'fx_strength_level': fx_strength_level, # 分型强度等级 (极强/强/中等/弱/极弱)
'is_strong_fx': is_strong_fx # 是否为强分型
})
return {
@@ -479,9 +487,12 @@ def analyze():
# 添加K线分型信息
'klc_fx_info': [{
'time': format_time_safely(point['time'], client_tz),
'price': point['price'],
'price': float(point['price']),
'fx_type': point['fx_type'],
'is_bottom': point['is_bottom']
'is_bottom': bool(point['is_bottom']),
'fx_strength': float(point['fx_strength']), # 分型强度分数
'fx_strength_level': str(point['fx_strength_level']), # 分型强度等级
'is_strong_fx': bool(point['is_strong_fx']) # 是否为强分型
} for point in analysis_result['klc_fx_info']]
})
else:
@@ -546,9 +557,12 @@ def analyze():
# 添加小周期分型信息
result['element_klc_fx_info'] = [{
'time': format_time_safely(point['time'], client_tz),
'price': point['price'],
'price': float(point['price']),
'fx_type': point['fx_type'],
'is_bottom': point['is_bottom']
'is_bottom': bool(point['is_bottom']),
'fx_strength': float(point['fx_strength']), # 分型强度分数
'fx_strength_level': str(point['fx_strength_level']), # 分型强度等级
'is_strong_fx': bool(point['is_strong_fx']) # 是否为强分型
} for point in element_analysis['klc_fx_info']]
print(f"小周期分析完成: {element_timeframe}, 笔数量: {len(result['element_bi_list'])}, {'仅元素数据' if elements_only else '包含主周期数据'}")