INNER CODE UNIT · JavaScript

broadcast

dearvn/tradovate-trading-bot · agents/config/index.js:37

  const broadcast = async () => {
    try {
      const row = await postgres.findOne(logger, 'trailing_trade_common', { key: 'configuration' });
      const globalConfiguration = row || {};

      const hash = JSON.stringify(globalConfiguration);
      if (hash === lastHash) return;
      lastHash = hash;

      await pub.publish(CH.EVT_CONFIG_CHANGED, { globalConfiguration });
      logger.info('Configuration broadcast sent');
    } catch (err) {
      logger.error({ err }, 'ConfigAgent: failed to read/broadcast configuration');
    }
  };

  // Initial broadcast
  await broadcast();

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…