Simulation for development. Real exchange data for production. Same API. Same format. One library.
const { MarketFeed } = require('trade-data-generator') // Development — fake data const feed = new MarketFeed({ source: 'simulation', type: 'crypto', pairs: [{ symbol: 'BTC/USDT', startPrice: 45000 }] }) // Production — real Binance data (one line change) const feed = new MarketFeed({ source: 'binance', type: 'crypto', pairs: [{ symbol: 'BTC/USDT' }] }) feed.on('tick', (data) => { /* your WebSocket */ }) feed.on('candle', (data) => { /* OHLCV candle */ }) feed.on('depth', (data) => { /* order book */ }) feed.start()
Real data feeds cost thousands per month. Free APIs rate-limit you. We generate realistic data locally — no external calls, ever.
Random walk with mean reversion, volatility and trend bias. Box-Muller normal distribution — small moves most of the time, occasional spikes.
Accurate bid/ask depth — best bid always below ask. Volume tapers with depth. Spread configurable per symbol. No crossed books ever.
Multiple intervals simultaneously. 1s, 1m, 5m, 15m, 1h, 4h, 1d. Accurate open/high/low/close. Closed candle emitted exactly once.
Equity and forex respect real open/close times. IANA timezone support. onOpen and onClose events fired automatically. Crypto is always open.
No WebSocket bundled in the library. Plug into Socket.io, ws, Pusher, Ably or any server. You own the transport layer.
Connect to real exchanges with one config change. Binance built-in with no API key. Build custom connectors for any data source.
Zero dependencies. Nothing extra installs. Works with Node.js 14+.
Pass symbol, start price, volatility and precision. Each pair is independent.
Subscribe to tick, candle, depth, open and closed events via EventEmitter.
Pipe events into your own WebSocket server. Works with any transport layer.
const { MarketFeed } = require('trade-data-generator') const { Server } = require('socket.io') const feed = new MarketFeed({ type: 'equity', marketHours: { open: '09:30', close: '16:00', timezone: 'America/New_York' }, pairs: [{ symbol: 'AAPL', startPrice: 175.50 }] }) feed.on('tick', d => io.emit('ticker', d)) feed.on('depth', d => io.emit('book', d)) feed.on('open', () => io.emit('market_open')) feed.start()
24/7/365. No market hours needed. Configure volatility per pair for realistic crypto behavior.
Respects open/close times and timezone. onOpen and onClose events. Weekday filtering built in.
5 decimal place precision. Tight spreads. Correct tick sizes for FX pairs. Mon–Fri 24 hour sessions.
Zero config. Zero API keys. Zero dependencies.