with one click
live-feed
// Set up real-time indicator computation on live WebSocket market data. Streams LTP/Quote/Depth and computes indicators in real-time with optional Plotly live charting.
// Set up real-time indicator computation on live WebSocket market data. Streams LTP/Quote/Depth and computes indicators in real-time with optional Plotly live charting.
OpenAlgo indicator expert. Use when user asks about technical indicators, charting, plotting indicators, creating custom indicators, building dashboards, real-time feeds, scanning stocks, indicator combinations, or using openalgo.ta. Also triggers for indicator functions (sma, ema, rsi, macd, supertrend, bollinger, atr, adx, ichimoku, stochastic, obv, vwap, crossover, crossunder, exrem).
Build a web dashboard for technical indicator analysis using Plotly Dash or Streamlit. Supports single-symbol, multi-symbol, and multi-timeframe layouts with real-time refresh.
Set up the Python environment for OpenAlgo indicator analysis. Installs openalgo, plotly, dash, streamlit, numba, yfinance, matplotlib, seaborn, and creates the project folder structure.
Create a custom technical indicator using Numba JIT + NumPy. Generates production-grade, O(n) optimized indicator functions with charting and benchmarking.
Chart any technical indicator on a symbol using Plotly. Creates interactive dark-themed charts with candlestick, overlays, and subplots. Supports all 100+ openalgo.ta indicators.
Scan multiple symbols with indicator conditions. Find stocks matching RSI oversold, EMA crossovers, Supertrend signals, and custom filter combinations.
| name | live-feed |
| description | Set up real-time indicator computation on live WebSocket market data. Streams LTP/Quote/Depth and computes indicators in real-time with optional Plotly live charting. |
| argument-hint | [symbol] [exchange] [mode] |
| allowed-tools | Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion |
Create a real-time indicator feed using OpenAlgo WebSocket streaming.
Parse $ARGUMENTS as: symbol exchange mode
$0 = symbol (e.g., SBIN, RELIANCE, NIFTY). Default: SBIN$1 = exchange (e.g., NSE, NSE_INDEX). Default: NSE$2 = mode (e.g., ltp, quote, depth, multi). Default: quoteIf no arguments, ask user for symbol and what data they want.
rules/websocket-feeds.md — WebSocket connection and subscriptionrules/data-fetching.md — Historical data for buffer initializationcharts/live/ directory (on-demand){symbol}_live_feed.pyrules/assets/live_feed/template.pyltp — Last Traded Price + Indicatorsquote — Full Quote + Indicatorsdepth — Market Depth Analysismulti — Multi-Symbol Feed"""
Real-Time Indicator Feed for {SYMBOL}
Mode: {mode}
"""
import os
import time
import numpy as np
from datetime import datetime, timedelta
from dotenv import find_dotenv, load_dotenv
from openalgo import api, ta
load_dotenv(find_dotenv(), override=False)
SYMBOL = "{symbol}"
EXCHANGE = "{exchange}"
client = api(
api_key=os.getenv("OPENALGO_API_KEY"),
host=os.getenv("OPENALGO_HOST", "http://127.0.0.1:5000"),
verbose=1,
)
# Pre-fetch historical data for buffer initialization
df = client.history(
symbol=SYMBOL, exchange=EXCHANGE, interval="1m",
start_date=(datetime.now() - timedelta(days=1)).strftime("%Y-%m-%d"),
end_date=datetime.now().strftime("%Y-%m-%d"),
)
close_buffer = list(df["close"].values[-200:])
instruments = [{"exchange": EXCHANGE, "symbol": SYMBOL}]
def on_data(data):
ltp = data["data"].get("ltp")
if ltp is None:
return
close_buffer.append(float(ltp))
if len(close_buffer) > 200:
close_buffer.pop(0)
if len(close_buffer) >= 20:
arr = np.array(close_buffer, dtype=np.float64)
ema_val = ta.ema(arr, 20)[-1]
rsi_val = ta.rsi(arr, 14)[-1] if len(arr) >= 15 else float("nan")
timestamp = datetime.now().strftime("%H:%M:%S")
print(f"[{timestamp}] {SYMBOL} LTP:{ltp:>10.2f} | "
f"EMA(20):{ema_val:>10.2f} | RSI(14):{rsi_val:>6.2f}")
# Connect and subscribe
client.connect()
client.subscribe_ltp(instruments, on_data_received=on_data)
print(f"Streaming {SYMBOL} on {EXCHANGE} — Press Ctrl+C to stop")
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
print("Stopping feed...")
client.unsubscribe_ltp(instruments)
client.disconnect()
The script must:
Inform user about verbose options:
verbose=0: Silent mode (errors only)verbose=1: Connection and subscription logsverbose=2: All data updates (debug mode)/live-feed SBIN NSE ltp
/live-feed NIFTY NSE_INDEX quote
/live-feed SBIN NSE depth
/live-feed multi NSE