Trading Signals Ws
Scanned@Sunnyztj
npx machina-cli add skill @Sunnyztj/trading-signals-ws --openclawTrading Signals WebSocket
Real-time signal generator: WebSocket price feed → strategy engine → Telegram alerts.
Quick Start
pip install websockets ccxt requests
cp scripts/config_template.py config.py # Edit with your keys
python scripts/signal_bot.py
How It Works
Bybit WebSocket ──→ Price Updates ──→ SL/TP Check (every tick)
──→ Kline Close ──→ Strategy Signal ──→ Telegram Alert
- Connects to exchange WebSocket (public, no API key needed)
- Subscribes to ticker (real-time prices) + kline (candle data)
- On each tick: checks stop-loss/take-profit for open signals
- On candle close: runs strategy indicators, generates buy/sell signals
- Sends formatted alerts to Telegram with entry/SL/TP levels
Configuration
Edit config.py:
SYMBOLS = ["ETH/USDT:USDT", "SOL/USDT:USDT", "BTC/USDT:USDT"]
STRATEGIES = {
"ETHUSDT": {"type": "ema", "fast": 12, "slow": 26},
"SOLUSDT": {"type": "rsi", "period": 14, "oversold": 30, "overbought": 70},
"BTCUSDT": {"type": "macd", "fast": 12, "slow": 26, "signal": 9},
}
TG_BOT_TOKEN = "your-bot-token"
TG_CHAT_ID = "your-chat-id"
Features
- Multi-symbol: Monitor unlimited pairs simultaneously
- Multi-strategy: Different strategy per symbol
- Auto-reconnect: 5s retry on disconnect
- State persistence: Saves every 5 minutes, survives restarts
- Cooldown: Configurable signal cooldown to avoid spam
- Telegram formatting: Rich HTML messages with emoji
Deployment
# systemd service
sudo tee /etc/systemd/system/signal-bot.service << 'EOF'
[Unit]
Description=Trading Signal Bot
After=network.target
[Service]
Type=simple
WorkingDirectory=/root/signals
ExecStart=/usr/bin/python3 signal_bot.py
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl enable --now signal-bot
Live Signal API (Optional)
Don't want to run your own bot? Subscribe to our hosted signal service:
# Free tier (15-min delayed)
curl https://api.tinyore.com/signals/free
# Get API key (7-day free trial)
curl -X POST https://api.tinyore.com/subscribe -H "Content-Type: application/json" -d '{"email":"you@example.com"}'
# Pro tier (real-time, $5/mo)
curl https://api.tinyore.com/signals/live -H "X-API-Key: YOUR_KEY"
# Market status
curl https://api.tinyore.com/status
Strategies: ETH EMA(12/26) + SOL RSI(14,30/70) on 1h timeframe. Top performers: HYPE RSI 73% win rate, PEPE RSI 53% win rate (90-day backtest). Contact @SunnyZhou on Telegram to upgrade to Pro.
Files
scripts/signal_bot.py— Main WebSocket signal botscripts/config_template.py— Configuration templatereferences/telegram_setup.md— How to create a Telegram bot and get chat ID
Overview
Trading Signals WS is a real-time signal generator that consumes WebSocket price feeds from Bybit or other exchanges and runs configurable strategies on live candle data to generate buy/sell signals. It pushes formatted Telegram alerts and supports multi-symbol and multi-strategy setups with auto-reconnect and state persistence.
How This Skill Works
The bot connects to the exchange WebSocket (public, no API key needed) and subscribes to ticker and kline data. On every tick it checks stop-loss and take-profit for open signals; on candle close it evaluates strategy indicators and emits Telegram alerts with entry, SL, and TP. Each symbol can have its own strategy configuration, and the system supports auto-reconnect and state persistence.
When to Use It
- When you need a real-time trading signal bot powered by live WebSocket data
- When you want price alerts for multiple symbols based on configurable strategies
- When you want Telegram notifications for entry/SL/TP signals
- When you need a WebSocket-based market monitor across multiple pairs
- When you want a production-ready setup with auto-reconnect and state persistence
Quick Start
- Step 1: pip install websockets ccxt requests
- Step 2: cp scripts/config_template.py config.py # Edit with your keys, symbols and strategies
- Step 3: python scripts/signal_bot.py
Best Practices
- Test with public WebSocket feeds first to verify data reliability and latency
- Tune per-symbol strategies (types and parameters) and backtest where possible
- Enable a signal cooldown to prevent alert spam
- Use state persistence (saves every 5 minutes) to survive restarts
- Secure Telegram tokens and exchange keys; store credentials outside code
Example Use Cases
- Monitor ETH/USDT and SOL/USDT using EMA(12/26) and RSI(14,30/70) on a 1h timeframe with Telegram alerts
- Run BTC/USDT MACD-based signals and push real-time Telegram notifications
- Multi-symbol setup: ETH/USDT, SOL/USDT, BTC/USDT with per-symbol strategies and alerts
- Deploy as a systemd service for production use with auto-reconnect and persistence
- Optionally connect to the Live Signal API for hosted real-time signals