update
This commit is contained in:
parent
10bf82fb63
commit
9368acb0a5
@ -33,7 +33,7 @@ class TechnicalIndicatorsMonitor:
|
|||||||
binance_symbols = self.binance_api.get_all_symbols()
|
binance_symbols = self.binance_api.get_all_symbols()
|
||||||
|
|
||||||
# 计算开始时间
|
# 计算开始时间
|
||||||
start_time = datetime.now() - timedelta(days=1) # 3天前
|
start_time = datetime.now() - timedelta(days=30)
|
||||||
start_str = start_time.strftime("%Y-%m-%d")
|
start_str = start_time.strftime("%Y-%m-%d")
|
||||||
|
|
||||||
# 获取所有symbol的klines 数据
|
# 获取所有symbol的klines 数据
|
||||||
@ -49,9 +49,6 @@ class TechnicalIndicatorsMonitor:
|
|||||||
# 布林带
|
# 布林带
|
||||||
self.monitor_bollinger(processed_data, symbol, time_interval)
|
self.monitor_bollinger(processed_data, symbol, time_interval)
|
||||||
|
|
||||||
# # MACD
|
|
||||||
# self.monitor_macd(processed_data, symbol, time_interval)
|
|
||||||
|
|
||||||
|
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
@ -106,33 +103,6 @@ class TechnicalIndicatorsMonitor:
|
|||||||
|
|
||||||
**结果**: **{result}**
|
**结果**: **{result}**
|
||||||
|
|
||||||
**时间**: `{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}`
|
|
||||||
"""
|
|
||||||
self.discord_bot.send_message(message)
|
|
||||||
|
|
||||||
def monitor_macd(self, processed_data: pd.DataFrame, symbol: str, time_interval: str):
|
|
||||||
# MACD 金叉死叉
|
|
||||||
signal = processed_data['MACD_Signal'].iloc[-1]
|
|
||||||
notify = False
|
|
||||||
|
|
||||||
if signal > 0:
|
|
||||||
result = "MACD金叉"
|
|
||||||
notify = True
|
|
||||||
elif signal < 0:
|
|
||||||
result = "MACD死叉"
|
|
||||||
notify = True
|
|
||||||
else:
|
|
||||||
result = "正常"
|
|
||||||
|
|
||||||
if notify:
|
|
||||||
# 构建技术指标提醒消息
|
|
||||||
message = f"""## 🚨 【{symbol}】MACD指标提醒
|
|
||||||
|
|
||||||
**周期**: `{time_interval}`
|
|
||||||
**MACD**: `{signal:.2f}`
|
|
||||||
|
|
||||||
**结果**: **{result}**
|
|
||||||
|
|
||||||
**时间**: `{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}`
|
**时间**: `{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}`
|
||||||
"""
|
"""
|
||||||
self.discord_bot.send_message(message)
|
self.discord_bot.send_message(message)
|
||||||
|
|||||||
@ -58,7 +58,7 @@ class VolumeGrowupMonitor:
|
|||||||
print(f"{symbol} 过去 30 根 K 线的平均交易量为 {average_volume:.2f},当前交易量为 {processed_data['volume'].iloc[-1]:.2f},增长率为 {volume_growth:.2%}")
|
print(f"{symbol} 过去 30 根 K 线的平均交易量为 {average_volume:.2f},当前交易量为 {processed_data['volume'].iloc[-1]:.2f},增长率为 {volume_growth:.2%}")
|
||||||
|
|
||||||
# 如果增加 10倍以上,则发送消息
|
# 如果增加 10倍以上,则发送消息
|
||||||
if volume_growth >= 10:
|
if volume_growth >= 10 and current_amount > 1000000:
|
||||||
# markdown 格式,带上emoji
|
# markdown 格式,带上emoji
|
||||||
message = f"""## 🚨 交易量暴涨提醒 - {symbol}
|
message = f"""## 🚨 交易量暴涨提醒 - {symbol}
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,7 @@ services:
|
|||||||
cryptoai-monitor:
|
cryptoai-monitor:
|
||||||
build: .
|
build: .
|
||||||
container_name: cryptoai-monitor
|
container_name: cryptoai-monitor
|
||||||
image: cryptoai-monitor:0.0.8
|
image: cryptoai-monitor:0.0.9
|
||||||
restart: always
|
restart: always
|
||||||
command: python run_monitor.py
|
command: python run_monitor.py
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
4
run.py
4
run.py
@ -8,6 +8,10 @@ CryptoAI 启动脚本
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
from cryptoai.task_endpoint import task_start
|
from cryptoai.task_endpoint import task_start
|
||||||
|
import logging
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
logger.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
logger.info("启动加密货币任务程序...")
|
||||||
sys.exit(task_start())
|
sys.exit(task_start())
|
||||||
@ -1,6 +1,11 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from cryptoai.monitor_endpoint import run_monitor
|
from cryptoai.monitor_endpoint import run_monitor
|
||||||
|
import logging
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
logger.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
logger.info("启动加密货币监控程序...")
|
||||||
|
|
||||||
run_monitor()
|
run_monitor()
|
||||||
Loading…
Reference in New Issue
Block a user