CryptoDash Server is a Node.js backend that fetches cryptocurrency market data from Binance, stores it in a database, computes technical indicators, and exposes a REST API for visualization clients.
This server is designed to be indicator-first: all heavy calculations (ATR, Supertrend, etc.) are done server-side.
- Automated candle fetching from Binance
- OHLCV data storage (per symbol & timeframe)
- ATR (Wilder) calculation
- Supertrend indicator calculation
- Incremental updates (no refetching full history)
- Cron-based scheduler aligned with candle closes
- REST API for frontend dashboards
- Node.js
- Prisma ORM
- PostgreSQL (or SQLite for local testing)
- Binance REST API
- node-cron
src/
├─ api/
│ └─ candles.js
├─ services/
│ ├─ binance.js
│ ├─ candleStore.js
│ └─ indicators.js
├─ cron/
│ └─ scheduler.js
├─ config/
│ └─ market.js
├─ prisma/
│ └─ schema.prisma
└─ index.js
npm installCreate .env file:
DATABASE_URL=postgresql://user:password@localhost:5432/cryptodash
BINANCE_API_KEY=
BINANCE_API_SECRET=
PORT=4000npx prisma migrate devnpm run devServer runs at:
http://localhost:4000
The server runs scheduled jobs aligned with Binance candle closes:
- 5m → every 30 seconds (forming candle updates)
- 15m → every 5 minutes
- 1h → hourly
- 4h → every 4 hours
- 1d → daily
Each job:
- Fetches latest candles
- Stores / updates last candle
- Recalculates ATR
- Recalculates Supertrend
GET /api/candles?symbol=BTCUSDT&tf=1h&limit=200
{
"candles": [
{
"openTime": "2024-01-01T00:00:00.000Z",
"open": 42000,
"high": 42500,
"low": 41800,
"close": 42350,
"volume": 1234,
"takerBuyVolume": 650,
"atr": 320,
"supertrend": 41750,
"supertrendDir": 1
}
]
}- True Range calculation
- Wilder smoothing
- Stored per candle
- Uses HL2 ± ATR × multiplier
- Sticky bands
- Direction state persisted
- Stored directly in candle records
- Indicators depend on historical continuity
- Deleting candles may break indicator state
- Cron jobs should not overlap
- SQLite is fine for local testing, PostgreSQL recommended for real usage
This project is for educational and research purposes only.
It is not financial advice.
VanHes1ng
Crypto systems & market analytics