TradingView Webhook 配置
- 在 app.panshi.io 组合详情页 → Webhook 面板生成 URL
- TradingView Alert → Webhook URL 粘贴上述 URL
- Alert message 用 JSON 模板(详见 Alert 模板)
- 策略触发 → TV 打过来 → panshi-sim 下单(模拟 / 实盘镜像)
生成 Webhook URL
Section titled “生成 Webhook URL”- 组合详情页 → Webhook 面板 → “生成 Webhook URL”
- 系统返回形如:
https://api.panshi.io/webhook/tv/<webhook_token>- 面板同时展示 curl 示例 + TradingView message 模板,一键复制
- token 只展示这一次,关闭对话框后只能吊销重建
TradingView Alert 配置
Section titled “TradingView Alert 配置”- Condition:你的 Pine 策略 / 指标
- Alert actions:勾 “Webhook URL”
- Webhook URL:粘贴上面生成的 URL
- Message:参照 Alert 模板 填 JSON
靠 URL path 里的 <webhook_token>(TV 不能加 HTTP header)。token 一旦泄漏立即吊销,吊销后历史订单不受影响,只是新信号不再接受。
同一 Alert 重复触发不会重复下单。幂等 key:
newClientOrderId = 'p_' + sha256(source + symbol + action + floor(ts/60000)).slice(0, 32)同一信号 1 分钟内重试视为同一笔,Binance 端也会自动去重。
| 症状 | 原因 | 解法 |
|---|---|---|
401 unauthorized | token 错 / 已吊销 | 重新生成 |
400 bad_request | JSON 格式错 | 参照 Alert 模板 |
429 rate_limited | 单 token 频率超限 | 合并 alert 或开多个 token 分流 |
451 geo_blocked | TV 服务器出口 IP 被判中国大陆 | 使用 api.panshi.io(CF 接入层) |