Fire callbacks when Stock Token prices cross thresholds. Wraps streamPrices; tracks the last price per symbol and emits a CrossEvent each time a configured threshold is crossed.
const triggers = createPriceTriggers(hood)triggers.onCross('AAPL', 250, 'up', (e) => console.log('AAPL broke $250', e.price))// later: triggers.stop() Copy
const triggers = createPriceTriggers(hood)triggers.onCross('AAPL', 250, 'up', (e) => console.log('AAPL broke $250', e.price))// later: triggers.stop()
Register a threshold crossing callback. Returns an unsubscribe fn.
Stop the underlying price stream and clear all triggers.
Fire callbacks when Stock Token prices cross thresholds. Wraps streamPrices; tracks the last price per symbol and emits a CrossEvent each time a configured threshold is crossed.
Example