2.3.5.1 Market Data Flow

1. Ingest: A Node.js service polls or subscribes to exchange APIs (e.g., Binance WebSocket).

2. Cache: The latest price data can be stored in Redis.

3. Broadcast: The Node.js service emits marketUpdate events via Socket.io to all connected clients.

// backend/src/socket/marketSocket.js
module.exports = (io) => {
  setInterval(async () => {
    // Pseudo-code: fetch data from Binance or CoinGecko
    const prices = await getPrices(['DOGE', 'SHIB']);
    // Broadcast to clients
    io.emit('marketUpdate', prices);
  }, 1000);
};

Last updated