Introduction
TraderK is an autonomous multi-strategy crypto trading bot running on Node.js. It trades BTC, ETH and SOL simultaneously using three complementary strategies, filtered by institutional-grade signals from real Kraken market data.
What it does
Every 5 seconds the bot polls live prices for all three assets. Every 60 seconds it fetches hourly OHLCV candles and the top-10 order book. From this data it calculates:
- 24h VWAP — weighted average price over the last 24 hourly candles
- Hourly RSI(14) — Wilder-smoothed RSI on 1h closes (not noisy 5s ticks)
- ATR(14) — Average True Range for dynamic stop-loss and take-profit sizing
- Order Book Imbalance — bid vs ask volume ratio in the top 10 price levels
System Overview
Architecture
TraderK is a single Node.js process serving a WebSocket-connected dashboard. The bot runs an internal tick loop — no external schedulers required.
┌─────────────────────────────────────────────────────┐
│ TraderK Bot (Node.js · port 4001) │
│ │
│ Fast tick (5s) ─── kraken ticker ──→ prices │
│ Slow tick (60s) ─── kraken ohlc ──→ RSI/ATR/VWAP│
│ └── kraken orderbook ─→ OB imbal. │
│ │
│ Strategy engine ─── paper buy/sell ──→ Kraken CLI │
│ Socket.io ─────────────────────────→ Dashboard │
│ Express routes ──────────────────────→ API + Auth │
└─────────────────────────────────────────────────────┘
Assets traded
| Symbol | Pair | Color |
|---|---|---|
| Bitcoin | BTCUSD | Amber |
| Ethereum | ETHUSD | Blue |
| Solana | SOLUSD | Violet |
Dashboard Guide
Visit /dashboard (requires login) to see the live trading dashboard.
Header
- Start / Stop — Start or pause trading. On start, the paper account resets to $10,000.
- ⚙ Settings — Opens the settings drawer to edit strategy parameters live.
- ⏻ Sign out — Ends your session.
- Uptime — Time since the bot was last started.
Portfolio hero cards
Six cards across the top show the portfolio P&L, live price for each asset with hourly RSI, trade counts, and open lot count.
Asset tabs (BTC / ETH / SOL)
Each tab shows an 8-column stat row, live price chart with VWAP line, RSI chart, grid level panel, and open positions table.
Stat cards
| Card | What it shows |
|---|---|
| RSI 1h | Hourly RSI(14) — green <30, red >70 |
| Dip from Peak | % below high-watermark — triggers at –1.5% |
| OB Bids | Order book bid %. Green ≥55% (buys allowed), red <45% |
| VWAP Dist. | % above/below 24h VWAP. Green = below VWAP (value zone) |
Dip-Buy Strategy
How it works
The bot tracks a high-watermark per asset — the highest price seen since the last buy. When price drops more than DIP_PCT below that watermark AND all filters pass, it places a $DIP_USD market buy.
After the buy, the watermark resets to the buy price, requiring a fresh DIP_PCT drop before the next buy on that asset.
Sell condition
Each dip lot has a fixed take-profit target of DIP_PROFIT above the fill price (or ATR × ATR_TP_MULT if larger). It sells automatically when price reaches this level.
Filters
- VWAP filter: price must be ≤ VWAP × (1 +
VWAP_BAND) - Order book filter: bid % ≥
OB_IMBALANCE_MIN - RSI filter: hourly RSI must be < 58 (not overbought)
- Lot cap: maximum
MAX_DIP_LOTSdip positions open per asset
RSI Reversal Strategy
How it works
Uses hourly RSI(14) computed from the Kraken OHLCV API — not the noisy 5-second tick RSI. When hourly RSI drops to or below RSI_BUY_LVL (30) AND order book confirms buy pressure, places a $RSI_USD buy.
Sell conditions
An RSI lot sells when either:
- Price reaches the take-profit target (default +3%, or ATR × 2.5)
- Hourly RSI rises above
RSI_SELL_LVL(70) AND the position is ≥RSI_MIN_PROFIT(0.5%) in profit — the profit gate prevents selling at a loss on RSI divergence
RSI_COOLDOWN) prevents multiple RSI buys on the same asset during a single oversold episode.Grid Strategy
How it works
On first price observation, the bot builds a grid of GRID_N (5) buy levels spaced GRID_STEP (0.8%) apart below the current price. When price falls to a level it places a $GRID_USD ($50) buy. The take-profit is two levels above the buy price (1.6% gain).
Grid rebuild
The grid rebuilds when price rises more than 5% above the current center. Old grid lots already in the book remain active until they hit their targets.
VWAP Anchor
The 24-hour VWAP is calculated from the last 24 hourly candles using Kraken's per-candle VWAP (index 5 of the OHLCV array) weighted by volume:
VWAP = Σ(candle_vwap × volume) / Σ(volume) [last 24 hourly candles]
The VWAP Dist. stat card shows how far the current price is above or below this level. Green = below VWAP (buying at better-than-average price).
Order Book Imbalance
Every 60 seconds the bot fetches the top-10 bid and ask levels. It calculates:
imbalance = bid_volume / (bid_volume + ask_volume)
A value above OB_IMBALANCE_MIN (default 55%) means more buyers than sellers in the current order flow. Any buy signal is blocked when this threshold is not met.
ATR Volatility
ATR(14) is computed from hourly OHLCV candles using Wilder's smoothing. It represents the average price range over the last 14 hours and is used to set dynamic stop-loss and take-profit levels:
stop_loss = max(SL_PCT, ATR% × ATR_SL_MULT)
take_profit = max(default, ATR% × ATR_TP_MULT)
In high-volatility conditions, stops are wider (avoids premature stop-outs). In calm conditions, stops are tighter.
All Settings
All settings are editable live from the Dashboard → ⚙ Settings drawer. Changes take effect on the next trade decision and are persisted to settings.json.
Dip-Buy
| Setting | Default | Description |
|---|---|---|
DIP_PCT | 1.5% | Required % drop below watermark to trigger a buy |
DIP_PROFIT | 2.0% | Take-profit target above fill price (minimum) |
DIP_USD | $100 | Dollar amount per dip buy |
MAX_DIP_LOTS | 3 | Maximum simultaneous dip lots per asset |
RSI
| Setting | Default | Description |
|---|---|---|
RSI_BUY_LVL | 30 | Hourly RSI level that triggers a buy (oversold) |
RSI_SELL_LVL | 70 | Hourly RSI level that triggers a sell (overbought) |
RSI_USD | $150 | Dollar amount per RSI buy |
RSI_COOLDOWN_MIN | 5 min | Minimum time between RSI buys on the same asset |
RSI_MIN_PROFIT | 0.5% | Minimum profit before overbought-sell fires |
Grid
| Setting | Default | Description |
|---|---|---|
GRID_N | 5 | Number of grid buy levels |
GRID_STEP | 0.8% | Price gap between grid levels |
GRID_USD | $50 | Dollar amount per grid level |
Filters
| Setting | Default | Description |
|---|---|---|
OB_IMBALANCE_MIN | 55% | Minimum bid% in top-10 order book to allow buys |
VWAP_BAND | 2.0% | Max % above 24h VWAP for dip-buy entry |
Risk Management
| Setting | Default | Description |
|---|---|---|
MAX_ASSET_USD | $400 | Maximum total deployed per asset at any time |
SL_PCT | 3.0% | Base stop-loss floor (overridden by ATR when larger) |
ATR_SL_MULT | 1.5× | Stop-loss = hourly ATR × this multiplier |
ATR_TP_MULT | 2.5× | Take-profit = hourly ATR × this multiplier |
SL_MIN_AGE | 30 min | Stop-loss only activates after holding this long (fixed) |
ATR_SL_MULT to 2.0 in high-volatility markets so normal swings don't trigger your stop. Decrease to 1.0 for tighter risk control.API Endpoints
All API routes require an authenticated session (login first).
| Method | Path | Description |
|---|---|---|
GET | /api/settings | Returns current strategy config as JSON |
POST | /api/settings | Update and persist strategy config (JSON body) |
GET | /api/profile | Returns username and avatar status |
POST | /api/profile/username | Change username |
POST | /api/profile/password | Change password (requires current password) |
POST | /api/avatar | Upload avatar image (multipart/form-data) |
WS | /socket.io | Real-time bot state updates (authenticated) |
Security
- bcrypt (cost 12) — Passwords hashed, never stored in plaintext
- express-session — HTTP-only, SameSite=Strict, Secure cookies (24h expiry)
- Rate limiting — 5 failed login attempts per IP per 15 minutes
- Session regeneration — New session ID on every successful login
- Security headers — X-Frame-Options: DENY, X-Content-Type-Options: nosniff
- Socket.io auth — Unauthenticated WebSocket connections rejected
- Auth file permissions —
.auth.jsonwritten with mode 0600