Freqtrade + pushplus:交易信号推到微信
效果:开仓、平仓或机器人状态变化时,微信收到一条摘要。不要把每笔 ticker 都推出去。
前置条件
- 一个 pushplus token(官网扫码获取)
- 可改
config.json或策略文件的 Freqtrade
Freqtrade 默认 Webhook 报文 不会自动映射为 title / content,必须按下面字段自己组 JSON。
配置步骤
方式一:Webhook(类似内置通知)
在 config.json 启用 webhook,把各事件 body 写成 pushplus 字段。占位符以当前文档为准({pair}、{open_rate}、{profit_amount} 等):
"webhook": {
"enabled": true,
"url": "https://www.pushplus.plus/send",
"format": "json",
"webhookentry": {
"token": "你的token",
"title": "Freqtrade 开仓 {pair}",
"content": "价格 {open_rate} 策略 {strategy}",
"template": "markdown"
},
"webhookexit": {
"token": "你的token",
"title": "Freqtrade 平仓 {pair}",
"content": "盈亏 {profit_amount}",
"template": "markdown"
}
}
旧版键名可能是 webhookbuy / webhooksell。token 用环境变量注入,不要提交到 git。平仓、状态事件按同样结构加 webhookstatus 即可。
方式二:策略里 curl / requests
只在关键信号处通知时,在策略或自定义代码里:
curl -s -X POST "https://www.pushplus.plus/send" \
-H "Content-Type: application/json" \
-d '{"token":"你的token","title":"策略信号","content":"请打开 Freqtrade 查看","template":"markdown"}'
完整参数见 消息接口文档。
验证
curl -X POST "https://www.pushplus.plus/send" \
-H "Content-Type: application/json" \
-d '{"token":"你的token","title":"Freqtrade 配置测试","content":"token 可用","template":"markdown"}'
返回 code 为 200 后,用 dry-run 或手动触发一条 status webhook。
常见问题
收到空消息或接口报错? content 必填;确认 webhook format 为 json,且字段名是 token / title / content。
通知太勤? 只配 entry / exit / 异常状态,不要对心跳开火。见 接口限制。
收不到消息见 排查说明。