Loading project details...

Home Portfolio Trading Platform

Automated Cryptocurrency Trading Platform

Sophisticated Full-Stack Algorithmic Trading System

Production-Ready 24/7 Automated

Project Overview

A sophisticated, full-stack automated trading system for cryptocurrency markets that combines technical analysis, risk management, and real-time execution. The platform autonomously scans markets for high-probability trading opportunities using trend-following (EMA crossovers) and price action (candlestick patterns), validates them against comprehensive risk parameters, and executes trades on the Kraken exchange.

Technical Analysis Engine

Triple EMA system with 5 candlestick pattern recognition algorithms

Advanced Risk Management

Multi-timeframe limits, position sizing, and emergency controls

Real-Time Execution

Automated order placement with WebSocket live updates

Multi-Channel Alerts

Telegram, Discord, Email, and Pushover notifications

Technical Specifications

Frontend: Next.js 14, React 18, TypeScript 5.3
Backend: Node.js 20+, Express.js 4.18
Database: MongoDB 8.0, Mongoose 8.0
Exchange: Kraken via CCXT 4.2
Real-Time: WebSocket (ws 8.14)
Charts: TradingView lightweight-charts 4.1
Styling: Tailwind CSS 3.3, CVA
Security: JWT, bcrypt, Helmet, Rate limiting

How It Works

Signal Engine

Analyzes price data using multiple technical indicators - specifically 20/50/200-period Exponential Moving Averages for trend detection combined with five candlestick pattern recognition algorithms.

  • Pin Bar, Engulfing, Doji, Hammer, Shooting Star patterns
  • Volume confirmation (1.5x average requirement)
  • Trend strength validation (minimum 2% EMA separation)
  • ATR-based volatility bounds (0.1%-10% range)
  • Quality filters for high-probability setups

Risk Engine

Validates every potential trade against configurable risk parameters to ensure no single trade or series of trades can exceed predefined drawdown thresholds.

  • Per-trade risk limit (default 1% of equity)
  • Daily loss limit (3%), weekly loss limit (10%)
  • Maximum concurrent positions (3)
  • Trade frequency controls (10 trades/day max)
  • ATR-based position sizing with stop losses

Execution Engine

Interfaces with the Kraken exchange via the CCXT library to place market orders with automatically calculated stop-loss and take-profit levels.

  • Market orders with immediate SL/TP attachment
  • Real-time order status monitoring
  • Handles partial fills and network timeouts
  • Retry logic with exponential backoff
  • Live P&L tracking for open positions

Scheduler System

Automatically scans configured trading pairs every 4 hours, generating signals that are evaluated by the risk engine before execution.

  • Node-cron based automation system
  • Configurable scan intervals
  • Unavailable pair retry logic
  • Start/stop controls via API
  • Status indicators and countdown timers

Trade Journal

Tracks all trading activity and calculates comprehensive performance metrics including win rate, average risk-reward ratio, Sharpe ratio, and maximum drawdown.

  • Complete trade lifecycle tracking
  • Win rate and profit factor calculations
  • Sharpe ratio and maximum drawdown metrics
  • Hourly account state snapshots
  • Daily/weekly performance aggregations

Emergency Kill Switch

Immediately cancels all open orders and stops automated trading with a single API call - critical for limiting exposure during extreme market volatility.

  • Single-click emergency stop
  • Cancels all open orders instantly
  • Stops automated trading scheduler
  • Multi-channel alert notifications
  • Accessible via API and dashboard

Multi-Channel Alert System

Alert Channels

Telegram Bot Discord Webhooks Email (SMTP) Pushover Mobile

Notification Features

Telegram Bot Integration:

Instant mobile notifications with HTML formatting for bold headers and structured data. Perfect for on-the-go monitoring with smartphone push notifications.

Discord Webhooks:

Rich embed messages with color-coded alerts (green for profits, red for losses/errors, orange for warnings). Ideal for team monitoring or trading communities.

Email Notifications:

Professional HTML-formatted emails with responsive templates and data tables. Supports Gmail, Outlook, and custom SMTP servers for detailed reports.

Pushover Mobile Alerts:

Native iOS and Android push notifications with priority-based alerting. High-priority escalation for critical events like kill switch activation and significant P&L changes.

Independent Operation:

All channels operate independently via Promise.allSettled(), ensuring that failure in one channel doesn't prevent alerts from reaching others.

Technical Architecture

Frontend Layer

Next.js 14 App Router React 18 TypeScript 5.3 Tailwind CSS TradingView Charts WebSocket Client

Backend Layer

Node.js 20+ Express.js JWT Auth WebSocket Server Winston Logging Helmet Security

Services & Integrations

MongoDB Atlas Kraken Exchange Telegram API Discord Webhooks SMTP Email Pushover API

Architecture Highlights

Three-Engine Architecture:

Modular design with separate Signal, Risk, and Execution engines, each with single responsibility and clean interfaces for testability.

Real-Time Communication:

WebSocket-based bidirectional communication for live updates of trades, signals, and account changes with auto-reconnection and health monitoring.

Database Design:

MongoDB with Mongoose ODM featuring Trade, Signal, Snapshot, and Config models with schema validation and indexing for performance.

Security First:

JWT authentication, bcrypt password hashing, Helmet security headers, rate limiting, and input validation across all endpoints.

Monorepo Structure:

Organized using npm workspaces with clear separation of frontend and backend concerns, shared types, and unified dependency management.

Key Features & Capabilities

Automated Trading Strategy

  • Triple EMA System: 20/50/200 period for trend identification
  • Five candlestick patterns with quality filters
  • Volume confirmation and trend strength validation
  • Minimum 1.5:1 risk-reward ratio enforcement
  • ATR-based stop placement and profit targets

Risk Management

  • Fixed fractional position sizing (1% per trade)
  • Daily (3%) and weekly (10%) loss limits
  • Maximum 3 concurrent positions
  • Trade frequency controls (10/day max)
  • Persistent state tracking across restarts

Performance Analytics

  • Win rate and profit factor calculations
  • Sharpe ratio and maximum drawdown tracking
  • Hourly account state snapshots
  • Daily/weekly performance aggregations
  • Complete trade history with filtering

Real-Time Dashboard

  • Account balance and equity chart
  • Open positions with live P&L updates
  • Recent trades and system status
  • Signal feed with approval/rejection status
  • Automation controls and scheduler management

Configuration Management

  • Runtime strategy parameter updates
  • Database-backed configuration persistence
  • Environment variable security
  • Trading pair and pattern toggles
  • Risk limit adjustments without restart

Testing & Validation

  • Jest unit tests for trading engines
  • Supertest integration tests for APIs
  • Testnet mode on Kraken sandbox
  • Paper trading for strategy validation
  • Comprehensive error handling and logging

Development Challenges & Solutions

Technical Analysis Algorithm Design

Challenge: Implementing accurate EMA calculations and candlestick pattern recognition with configurable sensitivity while avoiding false signals.

Solution: Built custom calculation engines with quality filters including volume confirmation, trend strength validation, and ATR-based volatility bounds. Implemented pattern-specific thresholds for body ratios and wick lengths.

Risk Management System

Challenge: Ensuring no scenario could exceed risk limits while maintaining database persistence and handling edge cases like server restarts.

Solution: Implemented database-backed risk state tracking with MongoDB, daily/weekly P&L aggregations, and comprehensive validation before every trade execution. Added grace period handling for time-based resets.

Real-Time WebSocket Communication

Challenge: Maintaining stable bidirectional communication for live updates while handling disconnections, reconnections, and state synchronization.

Solution: Implemented auto-reconnection with exponential backoff, ping/pong health monitoring, optimistic UI updates with server reconciliation, and event-based message routing.

Exchange Integration & Order Management

Challenge: Handling Kraken API rate limits, nonce synchronization, partial fills, network timeouts, and conditional order placement.

Solution: Built CCXT wrapper service with rate limiting, retry logic with exponential backoff, order status monitoring, and automatic SL/TP attachment using Kraken's conditional order types.

Complete Technology Stack

Backend Technologies

  • Node.js 20+ with ES6+ support
  • Express.js 4.18 web framework
  • WebSocket (ws 8.14) for real-time updates
  • MongoDB 8.0 with Mongoose 8.0 ODM
  • CCXT 4.2 for exchange integration
  • JWT and bcrypt for authentication
  • Winston 3.11 for structured logging
  • Jest 29.7 and Supertest 6.3 for testing

Frontend Technologies

  • Next.js 14.0 with App Router
  • React 18.2 with hooks and concurrent features
  • TypeScript 5.3 for type safety
  • Tailwind CSS 3.3 utility framework
  • TradingView lightweight-charts 4.1
  • Lucide-react 0.294 icon system
  • Axios 1.6 for HTTP requests
  • Class-variance-authority for components

Notification Systems

  • Telegram Bot API for mobile alerts
  • Discord Webhooks for team monitoring
  • Nodemailer 6.9 for email notifications
  • Pushover API for iOS/Android push
  • Priority-based alert routing
  • HTML formatting and rich embeds
  • Independent multi-channel operation

DevOps & Tools

  • npm Workspaces for monorepo management
  • Nodemon 3.0 for development auto-reload
  • Concurrently 9.2 for parallel scripts
  • ESLint 8.55 for code quality
  • dotenv 16.3 for environment management
  • Git with semantic commits
  • Helmet 7.1 for security headers