Workflow code
Copy this code to understand the workflow logic. Replace all API keys and credentials with your own before running.
// Stock monitoring workflow
// Node 1: Schedule (every 15 min, 9am-3:30pm IST weekdays)
// Node 2: HTTP Request → yfinance API for 20 stocks
// Node 3: Function node to check breakouts
// Breakout detection logic:
const stocks = $input.all();
const alerts = [];
for (const stock of stocks) {
const { symbol, price, high52w, low52w, volume, avgVolume } = stock.json;
// Breakout conditions
const nearHigh = price >= high52w * 0.98;
const volumeSpike = volume > avgVolume * 2;
const aboveEma20 = price > stock.json.ema20;
if (nearHigh && volumeSpike) {
alerts.push({
symbol,
type: '🚀 52W HIGH BREAKOUT',
price,
message: `${symbol} at ₹${price} — near 52W high with 2x volume!`
});
}
}
return alerts;
// Node 4: Perplexity API — get news sentiment for each alert stock
// Node 5: Claude — generate buy/hold/watch recommendation
// Node 6: WhatsApp (via Twilio or WATI)
// Node 7: Telegram channel