BTC/USDT45,016.14+0.04%
ETH/USDT2,814.83+0.53%
AAPL175.62-0.18%
EUR/USD1.08452+0.02%
v2.0.0 — Zero Dependencies

Realistic market data
for trading UIs

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.

Get started → Live Demo ↗ View on GitHub
index.js
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()
83+
Monthly downloads
0
Dependencies
3
Market types
7
Candle intervals

Everything you need to
build a trading UI

Real data feeds cost thousands per month. Free APIs rate-limit you. We generate realistic data locally — no external calls, ever.

📈

Realistic Price Engine

Random walk with mean reversion, volatility and trend bias. Box-Muller normal distribution — small moves most of the time, occasional spikes.

📊

Order Book Depth

Accurate bid/ask depth — best bid always below ask. Volume tapers with depth. Spread configurable per symbol. No crossed books ever.

🕯

OHLCV Candles

Multiple intervals simultaneously. 1s, 1m, 5m, 15m, 1h, 4h, 1d. Accurate open/high/low/close. Closed candle emitted exactly once.

🕐

Market Hours

Equity and forex respect real open/close times. IANA timezone support. onOpen and onClose events fired automatically. Crypto is always open.

EventEmitter API

No WebSocket bundled in the library. Plug into Socket.io, ws, Pusher, Ably or any server. You own the transport layer.

🔷

TypeScript Support

Full .d.ts definitions included. All event payloads typed. All config options typed. IDE autocomplete works out of the box.

Wire into your stack
in minutes

01

Install the package

Zero dependencies. Nothing extra installs. Works with Node.js 14+.

02

Configure your pairs

Pass symbol, start price, volatility and precision. Each pair is independent.

03

Listen to events

Subscribe to tick, candle, depth, open and closed events via EventEmitter.

04

Broadcast to clients

Pipe events into your own WebSocket server. Works with any transport layer.

server.js
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()

Equity, forex and crypto

CRYPTO

Always open

24/7/365. No market hours needed. Configure volatility per pair for realistic crypto behavior.

BTC/USDT ETH/USDT SOL/USDT BNB/USDT
EQUITY

Market hours

Respects open/close times and timezone. onOpen and onClose events. Weekday filtering built in.

AAPL GOOGL TSLA MSFT
FOREX

Pip precision

5 decimal place precision. Tight spreads. Correct tick sizes for FX pairs. Mon–Fri 24 hour sessions.

EUR/USD GBP/USD USD/JPY AUD/USD

Start in 30 seconds

Zero config. Zero API keys. Zero dependencies.

$ npm install trade-data-generator