Agent Skills

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.

Install

npx skills add https://github.com/marketcalls/openalgo-indicator-skills --skill live-feed
SKILL.md

Create a real-time indicator feed using OpenAlgo WebSocket streaming.

Arguments

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: quote

If no arguments, ask user for symbol and what data they want.

Instructions

  1. Read the indicator-expert rules, especially:
    • rules/websocket-feeds.md — WebSocket connection and subscription
    • rules/data-fetching.md — Historical data for buffer initialization
  2. Create charts/live/ directory (on-demand)
  3. Create {symbol}_live_feed.py
  4. Use the template from rules/assets/live_feed/template.py

Feed Types

ltp — Last Traded Price + Indicators

  • Subscribe to LTP feed
  • Maintain rolling buffer (last 200 ticks)
  • Compute EMA, RSI on buffer
  • Print real-time indicator values

quote — Full Quote + Indicators

  • Subscribe to Quote feed
  • Display OHLC + LTP + Volume
  • Compute indicators on close buffer
  • Color-coded output (bullish/bearish)

depth — Market Depth Analysis

  • Subscribe to Depth feed
  • Display L5 bid/ask book
  • Compute bid-ask spread, order imbalance
  • Show total buy vs sell quantity

multi — Multi-Symbol Feed

  • Subscribe to multiple symbols
  • Display watchlist table with LTP and key indicator
  • Auto-refresh display

Script Structure

"""
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()

Cleanup

The script must:

  • Handle Ctrl+C gracefully
  • Unsubscribe from all feeds
  • Disconnect WebSocket
  • Print summary of session duration and bars processed

Verbose Levels

Inform user about verbose options:

  • verbose=0: Silent mode (errors only)
  • verbose=1: Connection and subscription logs
  • verbose=2: All data updates (debug mode)

Example Usage

/live-feed SBIN NSE ltp /live-feed NIFTY NSE_INDEX quote /live-feed SBIN NSE depth /live-feed multi NSE

Related skills

entra-app-registrationmicrosoft606KGuides Microsoft Entra ID app registration, OAuth 2.0 authentication, and MSAL integration. USE FOR: create app registration, register Azure AD app, configure OAuth, set up authentication, add API permissions, generate service principal, MSAL example, console app auth, Entra ID setup, Azure AD authentication. DO NOT USE FOR: Key Vault secrets (use azure-keyvault-expiration-audit), general Azure resource security guidance.azure-messagingmicrosoft595KTroubleshoot and resolve issues with Azure Messaging SDKs for Event Hubs and Service Bus. Covers connection failures, authentication errors, message processing issues, and SDK configuration problems. WHEN: event hub SDK error, service bus SDK issue, messaging connection failure, AMQP error, event processor host issue, message lock lost, message lock expired, lock renewal, lock renewal batch, send timeout, receiver disconnected, SDK troubleshooting, azure messaging SDK, event hub consumer, servicentra-agent-idmicrosoft328KProvision Microsoft Entra Agent Identity Blueprints, BlueprintPrincipals, and per-instance Agent Identities via Microsoft Graph, and configure OAuth 2.0 token exchange (fmi_path, OBO, cross-tenant) including the Microsoft Entra SDK for AgentID sidecar. USE FOR: Agent Identity Blueprint, BlueprintPrincipal, agent OAuth, fmi_path token exchange, agent OBO, Workload Identity Federation for agents, polyglot agent auth, Microsoft.Identity.Web.AgentIdentities. DO NOT USE FOR: standard Entra app registsupabasesupabase298KUse when doing ANY task involving Supabase. Triggers: Supabase products (Database, Auth, Edge Functions, Realtime, Storage, Vectors, Cron, Queues); client libraries and SSR integrations (supabase-js, @supabase/ssr) in Next.js, React, SvelteKit, Astro, Remix; auth issues (login, logout, sessions, JWT, cookies, getSession, getUser, getClaims, RLS); Supabase CLI or MCP server; schema changes, migrations, declarative schemas, security audits, Postgres extensions (pg_graphql, pg_cron, pg_vector); deb

Search skills and MCP servers

Fuzzy search across 23,137 skills and servers