添加裸K形态,前端添加KLC显示
This commit is contained in:
+26
@@ -1167,6 +1167,18 @@ def analyze():
|
||||
# 添加主周期分析结果到返回数据
|
||||
result.update({
|
||||
'kline_data': clean_dataframe_for_json(df).to_dict('records'),
|
||||
'klc_list': [{
|
||||
'date': klc.end_time if isinstance(klc.end_time, str) else klc.end_time.astimezone(client_tz).isoformat(),
|
||||
'open': float(klc.open),
|
||||
'high': float(klc.high),
|
||||
'low': float(klc.low),
|
||||
'close': float(klc.close),
|
||||
'volume': float(klc.volume) if hasattr(klc, 'volume') else 0,
|
||||
'direction': str(klc.dir).replace('Chan_KLINE_DIR.', ''),
|
||||
'fx_type': str(klc.fx).replace('Chan_FX_TYPE.', ''),
|
||||
'klc_fx_type': str(klc.klc_fx_type).replace('Chan_KLC_FX.', ''),
|
||||
'trend': str(klc.trend).replace('Chan_PRICE_TREND.', '')
|
||||
} for klc in analysis_result['klc_list'] if hasattr(klc, 'end_time') and klc.end_time],
|
||||
'bi_list': [{
|
||||
'start_time': bi.start_klc.end_time if isinstance(bi.start_klc.end_time, str) else bi.start_klc.end_time.astimezone(client_tz).isoformat(),
|
||||
'end_time': (bi.end_klc.end_time if isinstance(bi.end_klc.end_time, str) else bi.end_klc.end_time.astimezone(client_tz).isoformat()) if bi.end_klc else None,
|
||||
@@ -1354,6 +1366,20 @@ def analyze():
|
||||
# 添加小周期K线数据
|
||||
result['element_kline_data'] = clean_dataframe_for_json(element_df).to_dict('records')
|
||||
|
||||
# 添加小周期KLC列表
|
||||
result['element_klc_list'] = [{
|
||||
'date': klc.end_time if isinstance(klc.end_time, str) else klc.end_time.astimezone(client_tz).isoformat(),
|
||||
'open': float(klc.open),
|
||||
'high': float(klc.high),
|
||||
'low': float(klc.low),
|
||||
'close': float(klc.close),
|
||||
'volume': float(klc.volume) if hasattr(klc, 'volume') else 0,
|
||||
'direction': str(klc.dir).replace('Chan_KLINE_DIR.', ''),
|
||||
'fx_type': str(klc.fx).replace('Chan_FX_TYPE.', ''),
|
||||
'klc_fx_type': str(klc.klc_fx_type).replace('Chan_KLC_FX.', ''),
|
||||
'trend': str(klc.trend).replace('Chan_PRICE_TREND.', '')
|
||||
} for klc in element_analysis['klc_list'] if hasattr(klc, 'end_time') and klc.end_time]
|
||||
|
||||
result['element_seg_list'] = [{
|
||||
'start_time': seg.start_bi.start_klc.end_time if isinstance(seg.start_bi.start_klc.end_time, str) else seg.start_bi.start_klc.end_time.astimezone(client_tz).isoformat(),
|
||||
'end_time': (seg.end_bi.end_klc.end_time if isinstance(seg.end_bi.end_klc.end_time, str) else seg.end_bi.end_klc.end_time.astimezone(client_tz).isoformat()) if seg.end_bi else None,
|
||||
|
||||
Reference in New Issue
Block a user