A sophisticated full-stack cryptocurrency trading platform featuring real-time market analysis, AI-powered signal generation, automated trading strategies, and comprehensive backtesting capabilities.
Scanstream is a modern, production-ready trading platform designed for cryptocurrency markets. It combines advanced technical analysis, machine learning-driven signals, and automated execution with a focus on risk management and performance optimization.
- Real-time Market Data: Live price feeds, order book analysis, and market microstructure monitoring
- AI-Powered Signals: 13 specialized trading agents providing consensus-based signal generation
- Automated Trading: Strategy execution with configurable risk management and position sizing
- Comprehensive Backtesting: Historical performance analysis across multiple timeframes and assets
- Advanced Analytics: Performance metrics, drawdown analysis, and optimization tools
- Multi-Asset Support: Cryptocurrency, forex, and traditional assets with unified data handling
Scanstream is more than a signal engine β it is the perceptual layer for a self-improving trading intelligence. The platform is designed to learn from every trade, adapt its strategy weights, and evolve toward minimal human intervention as part of a broader autonomous agent architecture.
This vision includes:
- Persistent learning from trade outcomes, market conditions, and agent consensus
- Adaptive intelligence with dynamic weight tuning across signal sources and agents
- Clustering insights to understand market behaviour, regime transitions, and structural patterns
- Asset velocity modeling to capture momentum, flow, and liquidity strength across markets
- Asset graph analysis to map relationships, cross-asset influence, and propagation of market moves
- Autonomous perception as the foundation for future self-managing trading agents
The goal is for Scanstream to become the observability layer that feeds larger autonomous systems with market awareness, signal quality, and confidence metrics β not just a single execution pipeline.
graph TB
subgraph "Frontend Layer"
UI[React Dashboard]
Charts[Trading Charts]
Signals[Signal Display]
end
subgraph "API Layer"
REST[REST API]
WS[WebSocket Server]
Auth[Authentication]
end
subgraph "Core Services"
Agents[13 Trading Agents]
Engine[Trading Engine]
Backtest[Backtesting Engine]
Risk[Risk Management]
end
subgraph "Data Layer"
Cache[In-Memory Cache]
DB[(PostgreSQL)]
Feeds[Market Data Feeds]
end
UI --> REST
Charts --> WS
Signals --> WS
REST --> Agents
WS --> Engine
Agents --> Engine
Engine --> Risk
Engine --> Backtest
Risk --> DB
Backtest --> DB
Cache --> DB
Feeds --> Cache
graph LR
subgraph "Trading Agents"
VFMD[VFMD Physics Agent]
Flow[Flow Field Agent]
UT_BOT[UT Bot Agent]
Structure[Structure Agent]
ML[ML Prediction Agent]
Pattern[Pattern Detection Agent]
Volume[Volume Metrics Agent]
end
subgraph "Signal Processing"
Aggregator[Signal Aggregator]
Router[Regime Router]
Sizer[Position Sizer]
end
subgraph "Execution"
Orders[Order Manager]
Positions[Position Tracker]
P&L[P&L Calculator]
end
VFMD --> Aggregator
Flow --> Aggregator
UT_BOT --> Aggregator
Structure --> Aggregator
ML --> Aggregator
Pattern --> Aggregator
Volume --> Aggregator
Aggregator --> Router
Router --> Sizer
Sizer --> Orders
Orders --> Positions
Positions --> P&L
sequenceDiagram
participant Market
participant Feed
participant Cache
participant Agents
participant Engine
participant UI
Market->>Feed: Price Updates
Feed->>Cache: Store Data
Cache->>Agents: Market Data
Agents->>Engine: Signals
Engine->>UI: Trading Signals
UI->>Engine: Trade Orders
Engine->>Market: Execute Orders
- Multi-Agent Signal Generation: 13 specialized agents providing diverse trading perspectives
- Regime-Aware Trading: Automatic adaptation to trending, sideways, and volatile market conditions
- Dynamic Position Sizing: Kelly Criterion-based sizing with risk-adjusted multipliers
- Advanced Risk Management: Stop-loss, take-profit, and drawdown controls
- Real-time Execution: WebSocket-based order execution with slippage monitoring
- Comprehensive Backtesting: Historical performance analysis with walk-forward validation
- Performance Analytics: Sharpe ratio, Sortino ratio, Calmar ratio, and custom metrics
- Strategy Optimization: Parameter sweeps and genetic algorithm optimization
- Paper Trading: Risk-free strategy testing with realistic market simulation
- Multi-Source Data Feeds: CCXT, Polygon.io, CoinGecko, and Yahoo Finance integration
- Real-time WebSocket Streams: Live price updates and order book data
- Database Persistence: PostgreSQL with Drizzle ORM for reliable data storage
- API-First Design: RESTful APIs for all platform functionality
- Modern React Dashboard: Intuitive trading interface with real-time updates
- Advanced Charting: Technical analysis charts with custom indicators
- Signal Visualization: Agent consensus display with confidence scoring
- Portfolio Management: Position tracking and performance monitoring
- React 18 - Modern React with hooks and concurrent features
- TypeScript - Type-safe development across the entire application
- Vite - Fast build tool and development server
- TailwindCSS - Utility-first CSS framework
- shadcn/ui - High-quality component library
- TanStack Query - Powerful data fetching and caching
- Recharts - Composable charting library
- Wouter - Lightweight routing library
- Node.js - Server-side JavaScript runtime
- Express.js - Fast, unopinionated web framework
- TypeScript - Type safety for backend code
- WebSocket - Real-time bidirectional communication
- Drizzle ORM - Type-safe database toolkit
- PostgreSQL - Robust relational database
- Neon Database - Serverless PostgreSQL provider
- Custom Signal Pipeline - Multi-agent signal aggregation
- Technical Analysis Library - Comprehensive indicator calculations
- Risk Management Engine - Advanced position and portfolio risk controls
- Backtesting Framework - Historical simulation and optimization
- ESLint - Code linting and formatting
- Prettier - Code formatting
- Husky - Git hooks for quality assurance
- Jest - Testing framework
- Docker - Containerization for deployment
- Node.js 18+ and npm
- PostgreSQL database (or Neon account)
- Git
-
Clone the repository
git clone https://github.com/yourusername/scanstream.git cd scanstream -
Install dependencies
npm install
-
Set up environment variables
cp .env.example .env # Edit .env with your database URL and API keys -
Set up the database
npm run db:generate npm run db:migrate npm run db:seed
-
Start the development server
npm run dev
-
Open your browser
http://localhost:5173
# Build and run with Docker
docker build -t scanstream .
docker run -p 3000:3000 -p 5000:5000 scanstream-
Market Analysis
- View real-time price charts with technical indicators
- Monitor agent consensus signals
- Analyze market regime and volatility
-
Strategy Configuration
- Select trading strategies from the strategy library
- Configure risk parameters and position sizing
- Set up entry and exit conditions
-
Backtesting
- Run historical simulations on selected strategies
- Analyze performance metrics and drawdown
- Optimize parameters for better results
-
Live Trading
- Enable automated execution with risk controls
- Monitor positions and P&L in real-time
- Receive alerts for significant market events
// Generate trading signals
const signals = await fetch('/api/signals/generate', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
symbol: 'BTC/USDT',
timeframe: '1h',
accountBalance: 10000
})
});
// Execute a trade
const trade = await fetch('/api/trades/execute', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
symbol: 'BTC/USDT',
side: 'BUY',
quantity: 0.01,
price: 45000
})
});GET /api/market/prices- Get current market pricesGET /api/market/orderbook/:symbol- Get order book dataGET /api/market/history/:symbol- Get historical price data
POST /api/signals/generate- Generate trading signalsGET /api/signals/history- Get signal historyGET /api/signals/consensus- Get agent consensus
POST /api/trades/execute- Execute a tradeGET /api/trades/positions- Get current positionsGET /api/trades/history- Get trade history
POST /api/backtest/run- Run a backtestGET /api/backtest/results/:id- Get backtest resultsGET /api/backtest/strategies- List available strategies
// Connect to WebSocket
const ws = new WebSocket('ws://localhost:5000');
// Subscribe to market data
ws.send(JSON.stringify({
type: 'subscribe',
channels: ['prices', 'signals']
}));
// Handle incoming messages
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
if (data.type === 'price_update') {
// Handle price update
} else if (data.type === 'signal_update') {
// Handle signal update
}
};# Database
DATABASE_URL=postgresql://user:password@localhost:5432/scanstream
# API Keys
POLYGON_API_KEY=your_polygon_key
COINGECKO_API_KEY=your_coingecko_key
# Trading
MAX_POSITION_SIZE=0.05
MAX_DRAWDOWN=0.15
DEFAULT_LEVERAGE=1
# Server
PORT=5000
NODE_ENV=development{
"strategies": {
"momentum": {
"enabled": true,
"parameters": {
"lookback": 20,
"threshold": 0.02
}
},
"mean_reversion": {
"enabled": false,
"parameters": {
"deviation": 2.0,
"hold_time": 24
}
}
},
"risk_management": {
"max_drawdown": 0.15,
"max_position_size": 0.05,
"stop_loss_multiplier": 1.5
}
}# Run all tests
npm test
# Run specific test suite
npm test -- --testPathPattern=trading-engine
# Run with coverage
npm run test:coverage# Run backtest for a strategy
npm run backtest -- --strategy=momentum --symbol=BTC/USDT --start=2023-01-01 --end=2024-01-01
# Run optimization
npm run optimize -- --strategy=momentum --parameters=lookback,threshold| Metric | Value | Target |
|---|---|---|
| Signal Generation Latency | <50ms | <100ms |
| WebSocket Message Throughput | 1000+ msg/s | 500+ msg/s |
| Backtest Execution Time | <30s for 1 year | <60s for 1 year |
| Memory Usage | <200MB | <500MB |
| API Response Time | <200ms | <500ms |
- Concurrent Users: Supports 100+ simultaneous connections
- Data Processing: Handles 1000+ symbols with real-time updates
- Backtesting: Processes 10+ years of historical data efficiently
- Database: Optimized queries with proper indexing
- Fork the repository
- Create a feature branch
git checkout -b feature/your-feature-name
- Make your changes
- Run tests and linting
npm run test npm run lint - Commit your changes
git commit -m "feat: add your feature description" - Push to your branch
git push origin feature/your-feature-name
- Create a Pull Request
- TypeScript: Strict type checking enabled
- ESLint: Airbnb configuration with React rules
- Prettier: Consistent code formatting
- Testing: Minimum 80% code coverage
- Documentation: JSDoc comments for public APIs
type(scope): description
Types:
- feat: new feature
- fix: bug fix
- docs: documentation
- style: formatting
- refactor: code restructuring
- test: testing
- chore: maintenance
This project is licensed under the MIT License - see the LICENSE file for details.
- CCXT - Cryptocurrency exchange library
- Technical Analysis Libraries - Indicator calculations
- Open Source Community - Various dependencies and inspiration
- Documentation: docs/ directory
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Built with β€οΈ for the cryptocurrency trading community