dc313fda13
Motivation: crypto-strategy 交易信号采用 envelope 外壳与字符串化/嵌套的 payload,原有 trade_signal 格式化器无法解析,需要独立的转换逻辑以生成通知文本和事件数据。 Changes: * 新增 crypto_strategy 消息转换器,解析 envelope 及嵌套、字符串化、扁平三种 payload 形态 * 根据平仓/止盈/卖出等标志推断交易动作,生成对应事件类型与中文通知文本 * 提取订单号、策略代码、价格、杠杆等字段用于通知数据 * 将消息转换器抽象为接口,订阅器按 formatter 配置选择对应实现 * 更新配置校验以支持 crypto_strategy 格式化器,并补充单元测试
70 lines
1.8 KiB
YAML
70 lines
1.8 KiB
YAML
server:
|
|
port: 8080
|
|
admin_key: "admin-sk-change-me"
|
|
|
|
database:
|
|
host: "mysql"
|
|
port: 3306
|
|
user: "root"
|
|
password: "${DB_PASSWORD:-notify}"
|
|
database: "notification"
|
|
|
|
redis:
|
|
host: "redis"
|
|
port: 6379
|
|
password: "XBAG3pjZbYxZpTWA"
|
|
db: 0
|
|
|
|
smtp:
|
|
host: "smtp.mailersend.net"
|
|
port: 587
|
|
user: "MS_hqXDZ6@516886.xyz"
|
|
password: "${SMTP_PASSWORD:-}"
|
|
# MailerSend 要求 from 域名已验证;未验证 516886.xyz 前先用试用域名
|
|
from: "Notification Service <MS_hqXDZ6@516886.xyz>"
|
|
|
|
rate_limit:
|
|
default: 100
|
|
# 钉钉自定义机器人官方上限 20/分钟,超限封 10 分钟;本地默认 18 留余量
|
|
dingtalk_per_min: 18
|
|
|
|
logbull:
|
|
host: "https://log.516886.xyz"
|
|
project_id: "42a3fef0-2fd6-4ce4-80c5-f6bb6ecc2013"
|
|
api_key: "lb_60701971723797ed0374aa3896078fe5"
|
|
log_level: "INFO"
|
|
|
|
# 多队列重复消息按 body SHA-256 去重;有 Redis 时跨进程共享
|
|
subscription_dedup_ttl: 1h
|
|
|
|
subscriptions:
|
|
- name: trade-signal
|
|
url: "${RABBITMQ_URL}"
|
|
queue: trade.signal.notify.queue
|
|
dead_letter_queue: trade.signal.notify.dlq
|
|
exchange: trade.signal.executor.queue
|
|
exchange_type: fanout
|
|
routing_key: ""
|
|
max_retry: 3
|
|
source: trade-signal
|
|
formatter: trade_signal
|
|
strategy_overrides:
|
|
BLONG:
|
|
quantity_multipliers:
|
|
open: 100
|
|
add: 100
|
|
reduce: 100
|
|
close: 100
|
|
leverage: 100
|
|
- name: crypto-strategy
|
|
url: "${RABBITMQ_URL}"
|
|
# 独立队列,不订 executor 队列,避免和 consumer.strategy 抢消息
|
|
queue: crypto.strategy.signal.notify.queue
|
|
dead_letter_queue: crypto.strategy.signal.notify.dlq
|
|
exchange: crypto.strategy.topic
|
|
exchange_type: topic
|
|
routing_key: strategy.signal
|
|
max_retry: 3
|
|
source: crypto-strategy
|
|
formatter: crypto_strategy
|