Public
Binance Futures Testnet bot with CCXT and Telegram
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data β all from the browser, and deployed in milliseconds.
Automated trading bot for Binance Futures Testnet using CCXT, with hidden divergence detection, liquidity sweep validation, order book analysis, dynamic risk management, and Telegram reporting.
Rendering mermaid diagram...
Go to Val Town Settings β Environment Variables and add:
| Variable | Description |
|---|---|
BINANCE_API_KEY | Binance Futures Testnet API key |
BINANCE_SECRET_KEY | Binance Futures Testnet secret key |
TELEGRAM_TOKEN | Telegram bot token from @BotFather |
TELEGRAM_CHAT_ID | Your Telegram chat ID |
PROXY_URL | (Optional) HTTP proxy for geo-blocked regions, e.g. http://user:pass@host:port |
Set main.ts to run every 15 minutes via Val Town's interval settings.
- Go to Binance Futures Testnet
- Log in and create API keys
- Fund your testnet account with test USDT
- Hidden Divergence Detected (trend continuation):
- Hidden Bullish: Price makes Higher Low + RSI makes Lower Low β LONG
- Hidden Bearish: Price makes Lower High + RSI makes Higher High β SHORT
- Liquidity Sweep Confirmed: Price wicked into a key S/R zone and rejected
- Order Book Imbalance: Bid/Ask volume ratio confirms the direction
- Signal Strength β₯ 30/100: Combined RSI depth + OB imbalance score
- 10% account allocation per trade
- Dynamic leverage: 10xβ20x based on signal strength (linear scale 50β80%)
- Max 4 concurrent positions
- 1:1.5 Risk-to-Reward ratio (ATR-based SL/TP)
- Trailing Stop Loss & Take Profit: Locks profits as trade moves favorably
The bot supports HTTP/HTTPS proxy configuration via PROXY_URL env var. This routes all exchange API requests through the proxy to bypass Error 451 (Restricted Location). You must supply your own working proxy β free public proxies are unreliable.
| File | Purpose |
|---|---|
main.ts | Interval trigger (entry point) |
bot.ts | Core bot engine: scan, analyze, trade, report |
exchange.ts | CCXT exchange setup with proxy, order book, positions |
indicators.ts | RSI, swing detection, hidden divergence, liquidity sweep |
risk.ts | Leverage calc, position sizing, SL/TP, trailing logic |
storage.ts | Trade state persistence via Val Town Blob |
telegram.ts | Telegram messaging and report formatting |
dashboard.tsx | HTTP dashboard for monitoring |
config.ts | All configurable parameters |
This bot is for Testnet only. Never use real funds without extensive backtesting and risk assessment. Trading cryptocurrency futures carries significant risk of loss.