Generate price ticks, order book depth and OHLCV candles for equity, forex and crypto. No API keys. No rate limits. Plug into any WebSocket server.
const { MarketFeed } = require('trade-data-generator') const feed = new MarketFeed({ type: 'crypto', pairs: [ { symbol: 'BTC/USDT', startPrice: 45000, volatility: 0.004 }, { symbol: 'ETH/USDT', startPrice: 2800, volatility: 0.005 }, ] }) feed.on('tick', (data) => /* → your WebSocket server */) feed.on('candle', (data) => /* → OHLCV complete candle */) feed.on('depth', (data) => /* → order book snapshot */) 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.
Full .d.ts definitions included. All event payloads typed. All config options typed. IDE autocomplete works out of the box.
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.