support send btc-usdt isolately
This commit is contained in:
parent
ff2c35e1b3
commit
7b132cddb2
|
|
@ -126,6 +126,9 @@ MYSQL_CONFIG = {
|
|||
"database": "okx",
|
||||
}
|
||||
|
||||
WECHAT_CONFIG = {"key": "11e6f7ac-efa9-418a-904c-9325a9f5d324"}
|
||||
WECHAT_CONFIG = {
|
||||
"general_key": "11e6f7ac-efa9-418a-904c-9325a9f5d324",
|
||||
"btc_key": "529e135d-843b-43dc-8aca-677a860f4b4b",
|
||||
}
|
||||
|
||||
ITICK_API_KEY = "dfd4bc0caed148d6bc03b960224754ffb5356349e389431f828702b3a27e8a2b"
|
||||
|
|
|
|||
|
|
@ -6,15 +6,14 @@
|
|||
"""
|
||||
import core.logger as logging
|
||||
import requests
|
||||
from config import WECHAT_CONFIG
|
||||
|
||||
logger = logging.logger
|
||||
|
||||
class Wechat:
|
||||
def __init__(self):
|
||||
def __init__(self, key: str):
|
||||
# 虽然config在根目录,但是取决于调用代码在哪
|
||||
# 只要启动代码文件在根目录,config就能找到
|
||||
self.key = WECHAT_CONFIG["key"]
|
||||
self.key = key
|
||||
self.url = f"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key={self.key}"
|
||||
|
||||
def send_text(self, text: str):
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ class HugeVolumeMain:
|
|||
f"开始处理巨量交易数据: {symbol} {bar} 窗口大小: {window_size} 从 {start} 到 {end}"
|
||||
)
|
||||
data = self.db_market_data.query_market_data_by_symbol_bar(
|
||||
symbol, bar, start, end
|
||||
symbol=symbol, bar=bar, start=start, end=end
|
||||
)
|
||||
if data is None:
|
||||
logger.warning(
|
||||
|
|
@ -697,8 +697,8 @@ def test_send_huge_volume_data_to_wechat():
|
|||
|
||||
if __name__ == "__main__":
|
||||
# test_import_binance_data_by_csv()
|
||||
batch_import_binance_data_by_csv()
|
||||
# batch_update_volume_spike(threshold=2.0, is_us_stock=True)
|
||||
# batch_import_binance_data_by_csv()
|
||||
batch_update_volume_spike(threshold=2.0, is_us_stock=False)
|
||||
# test_send_huge_volume_data_to_wechat()
|
||||
# batch_initial_detect_volume_spike(threshold=2.0)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ from huge_volume_main import HugeVolumeMain
|
|||
from core.biz.market_monitor import create_metrics_report
|
||||
from core.db.db_market_monitor import DBMarketMonitor
|
||||
from core.wechat import Wechat
|
||||
from config import OKX_MONITOR_CONFIG, MYSQL_CONFIG
|
||||
from config import OKX_MONITOR_CONFIG, MYSQL_CONFIG, WECHAT_CONFIG
|
||||
from core.utils import timestamp_to_datetime, transform_date_time_to_timestamp
|
||||
import core.logger as logging
|
||||
|
||||
|
|
@ -20,7 +20,6 @@ class MarketMonitorMain:
|
|||
def __init__(self):
|
||||
self.market_data_main = MarketDataMain()
|
||||
self.huge_volume_main = HugeVolumeMain()
|
||||
self.wechat = Wechat()
|
||||
self.monitor_config = OKX_MONITOR_CONFIG
|
||||
self.window_size = 100
|
||||
self.start_date = OKX_MONITOR_CONFIG.get("volume_monitor", {}).get(
|
||||
|
|
@ -179,7 +178,11 @@ class MarketMonitorMain:
|
|||
text_length = len(report.encode("utf-8"))
|
||||
|
||||
logger.info(f"发送报告到企业微信,字节数: {text_length}")
|
||||
self.wechat.send_markdown(report)
|
||||
if symbol == "BTC-USDT":
|
||||
wechat = Wechat(WECHAT_CONFIG["btc_key"])
|
||||
else:
|
||||
wechat = Wechat(WECHAT_CONFIG["general_key"])
|
||||
wechat.send_markdown(report)
|
||||
|
||||
# remove punction in latest_reatime_datetime
|
||||
file_datetime = re.sub(r"[\:\-\s]", "", latest_reatime_datetime)
|
||||
|
|
@ -287,7 +290,7 @@ class MarketMonitorMain:
|
|||
if __name__ == "__main__":
|
||||
market_monitor_main = MarketMonitorMain()
|
||||
market_monitor_main.monitor_realtime_market(
|
||||
symbol="PUMP-USDT",
|
||||
symbol="BTC-USDT",
|
||||
bar="5m",
|
||||
only_output_huge_volume=False,
|
||||
only_output_rise=False,
|
||||
|
|
|
|||
Loading…
Reference in New Issue