support title with details, and only output records which volume ratio greater than huge volume mean value.
This commit is contained in:
parent
38a4465e29
commit
f929ff8a2f
Binary file not shown.
|
|
@ -55,10 +55,13 @@ def create_metrics_report(
|
||||||
f"symbol: {symbol} {bar} window_size: {window_size} date_time: {date_time} 下跌,不发送相关数据"
|
f"symbol: {symbol} {bar} window_size: {window_size} date_time: {date_time} 下跌,不发送相关数据"
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
volume_ratio = round(float(row["volume_ratio"]), 4)
|
||||||
|
change = "涨" if pct_chg > 0 else "跌"
|
||||||
|
brief = f"{symbol} {bar} 量率: {volume_ratio} {change}: {pct_chg}%"
|
||||||
if huge_volume == 1:
|
if huge_volume == 1:
|
||||||
contents.append(f"## 交易巨量报告")
|
contents.append(f"## {brief} 交易巨量报告")
|
||||||
else:
|
else:
|
||||||
contents.append(f"## 交易量报告")
|
contents.append(f"## {brief} 交易量报告")
|
||||||
if now_datetime_str is not None:
|
if now_datetime_str is not None:
|
||||||
contents.append(f"## {symbol} {bar} 滑动窗口: {window_size} 最新数据时间: {now_datetime_str}")
|
contents.append(f"## {symbol} {bar} 滑动窗口: {window_size} 最新数据时间: {now_datetime_str}")
|
||||||
else:
|
else:
|
||||||
|
|
@ -72,7 +75,6 @@ def create_metrics_report(
|
||||||
volume = round(float(row["volume"]), 4)
|
volume = round(float(row["volume"]), 4)
|
||||||
volCcy = round(float(row["volCcy"]), 4)
|
volCcy = round(float(row["volCcy"]), 4)
|
||||||
volCCyQuote = round(float(row["volCCyQuote"]), 4)
|
volCCyQuote = round(float(row["volCCyQuote"]), 4)
|
||||||
volume_ratio = round(float(row["volume_ratio"]), 4)
|
|
||||||
spike_intensity = round(float(row["spike_intensity"]), 4)
|
spike_intensity = round(float(row["spike_intensity"]), 4)
|
||||||
close_80_high = int(row["close_80_high"])
|
close_80_high = int(row["close_80_high"])
|
||||||
close_20_low = int(row["close_20_low"])
|
close_20_low = int(row["close_20_low"])
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,7 @@ class MarketMonitorMain:
|
||||||
symbol: str,
|
symbol: str,
|
||||||
bar: str,
|
bar: str,
|
||||||
only_output_huge_volume: bool = False,
|
only_output_huge_volume: bool = False,
|
||||||
|
only_output_over_mean_volume: bool = False,
|
||||||
only_output_rise: bool = False,
|
only_output_rise: bool = False,
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
|
|
@ -135,6 +136,16 @@ class MarketMonitorMain:
|
||||||
if only_output_huge_volume:
|
if only_output_huge_volume:
|
||||||
if realtime_row["huge_volume"] == 1:
|
if realtime_row["huge_volume"] == 1:
|
||||||
logging.info(f"监控到巨量: {symbol} {bar} 窗口大小: {self.window_size}")
|
logging.info(f"监控到巨量: {symbol} {bar} 窗口大小: {self.window_size}")
|
||||||
|
if only_output_over_mean_volume:
|
||||||
|
# 获得huge_volume==1时的volume_ratio的均量
|
||||||
|
mean_huge_volume_ratio = real_time_data[real_time_data["huge_volume"] == 1]["volume_ratio"].mean()
|
||||||
|
if realtime_row["volume_ratio"] >= mean_huge_volume_ratio:
|
||||||
|
logging.info(f"监控到巨量且超过均量: {symbol} {bar} 窗口大小: {self.window_size}")
|
||||||
|
else:
|
||||||
|
logging.info(
|
||||||
|
f"监控到巨量但未超过均量: {symbol} {bar} 窗口大小: {self.window_size},退出本次监控"
|
||||||
|
)
|
||||||
|
return
|
||||||
else:
|
else:
|
||||||
logging.info(
|
logging.info(
|
||||||
f"监控到非巨量: {symbol} {bar} 窗口大小: {self.window_size},退出本次监控"
|
f"监控到非巨量: {symbol} {bar} 窗口大小: {self.window_size},退出本次监控"
|
||||||
|
|
@ -233,6 +244,7 @@ class MarketMonitorMain:
|
||||||
def batch_monitor_realtime_market(
|
def batch_monitor_realtime_market(
|
||||||
self,
|
self,
|
||||||
only_output_huge_volume: bool = True,
|
only_output_huge_volume: bool = True,
|
||||||
|
only_output_over_mean_volume: bool = True,
|
||||||
only_output_rise: bool = True,
|
only_output_rise: bool = True,
|
||||||
):
|
):
|
||||||
for symbol in self.market_data_main.symbols:
|
for symbol in self.market_data_main.symbols:
|
||||||
|
|
@ -245,6 +257,7 @@ class MarketMonitorMain:
|
||||||
symbol,
|
symbol,
|
||||||
bar,
|
bar,
|
||||||
only_output_huge_volume,
|
only_output_huge_volume,
|
||||||
|
only_output_over_mean_volume,
|
||||||
only_output_rise,
|
only_output_rise,
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ def monitor_schedule():
|
||||||
while True: # 每分钟监控一次
|
while True: # 每分钟监控一次
|
||||||
market_monitor_main.batch_monitor_realtime_market(
|
market_monitor_main.batch_monitor_realtime_market(
|
||||||
only_output_huge_volume=True,
|
only_output_huge_volume=True,
|
||||||
|
only_output_over_mean_volume=True,
|
||||||
only_output_rise=False,
|
only_output_rise=False,
|
||||||
)
|
)
|
||||||
logging.info("本次循环监控结束,等待30秒")
|
logging.info("本次循环监控结束,等待30秒")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue