pubnub-live-stock-quote-updates/SKILL.md
Deliver real-time stock quotes and market data with PubNub
npx skillsauth add pubnub/skills pubnub-live-stock-quote-updatesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Canonical owners (link-don't-copy): This vertical relies on cross-cutting skills. Always link to the canonical owner instead of duplicating. Foundations: SDK initialization (
new PubNub(,userId/UUID), pub/sub basics (pubnub.publish(,pubnub.subscribe(,addListener), channel naming, message filters, SDK upgrades, REST API. Environment: keysets, env separation, publish/subscribe/secret keys, key rotation hygiene, demo keys, custom origin. Security: Access Manager /grantToken, AES-256 / message encryption, IP allowlisting, DoS mitigation, compliance / SOC 2 / HIPAA. Real-time features: presence events /withPresence, presence setup / heartbeat, dropped connections, multi-device sync. History: Message Persistence andfetchMessages, offline catch-up, retention. App Context: users / user metadata, channels and memberships, metadata and filtering. Functions: Before/After Publish,request.ok()/request.abort(),require('kvstore')/xhr/vault, chaining (3-hop limit), DB triggers and runtime quirks, common patterns. Reliability: exponential backoff and jitter, idempotent publish / message id, dedup on merge, queue and retry, schema version. Scale: channel groups, wildcard subscribe, Stream Controller, performance tuning, 10K+ live events. Observability: logging correlation (channel + message_id + user_id + timetoken), test pyramid, payload sizing / cost, incident triage runbook, usage metrics / transaction count. Events & Actions: event types, action targets (webhook / SQS / Kafka / Lambda), filters / JSONPath. Illuminate: Business Objects, Metrics, Decisions (4-step workflow), Queries, service integration auth. Chat: Chat SDK setup, message actions / reactions, file sharing /sendFile, threading. Routing: intent-to-tool decision tree (get_sdk_documentation,write_pubnub_app, etc.).
You are a PubNub real-time stock quote specialist. Your role is to help developers build live market data applications that deliver stock quotes, portfolio tracking, price alerts, and financial data streams using PubNub's real-time infrastructure. You ensure low-latency delivery, proper channel architecture for market data, and compliance with financial data distribution requirements.
Invoke this skill when:
| Reference | Purpose | |-----------|---------| | stock-quotes-setup.md | Channel design, SDK initialization, quote broadcasting and ingestion | | stock-quotes-portfolio.md | Watchlist management, portfolio tracking, price alerts | | stock-quotes-patterns.md | Ticker displays, charting, market hours, entitlements, compliance |
import PubNub from 'pubnub';
const pubnub = new PubNub({
publishKey: 'pub-c-...',
subscribeKey: 'sub-c-...',
userId: 'market-data-server'
});
// Publish a full quote update
await pubnub.publish({
channel: 'quotes.AAPL',
message: {
symbol: 'AAPL',
price: 187.44,
bid: 187.42,
ask: 187.46,
volume: 52348120,
change: 2.31,
changePct: 1.25,
timestamp: Date.now()
}
});
// Use signals for high-frequency price-only ticks
await pubnub.signal({
channel: 'quotes.AAPL',
message: { p: 187.44, t: Date.now() }
});
const pubnub = new PubNub({
publishKey: 'pub-c-...',
subscribeKey: 'sub-c-...',
userId: 'user-456'
});
// Add symbols to a channel group for the user's watchlist
await pubnub.channelGroups.addChannels({
channelGroup: 'watchlist_user-456',
channels: ['quotes.AAPL', 'quotes.GOOGL', 'quotes.MSFT', 'quotes.TSLA']
});
// Subscribe to the entire watchlist via one channel group
pubnub.subscribe({ channelGroups: ['watchlist_user-456'] });
pubnub.addListener({
message: (event) => {
const quote = event.message;
updatePortfolioRow(quote.symbol, quote.price, quote.changePct);
},
signal: (event) => {
// Handle high-frequency ticks
const tick = event.message;
updateSparkline(event.channel.replace('quotes.', ''), tick.p);
}
});
// PubNub Function: Before Publish or Fire handler
export default (request) => {
const quote = request.message;
const alertsDb = require('kvstore');
return alertsDb.get(`alerts_${quote.symbol}`).then((alerts) => {
if (!alerts) return request.ok();
const parsed = JSON.parse(alerts);
parsed.forEach((alert) => {
if (alert.direction === 'above' && quote.price >= alert.target) {
pubnub.fire({
channel: `alerts.${alert.userId}`,
message: {
symbol: quote.symbol,
price: quote.price,
target: alert.target,
direction: 'above',
triggeredAt: Date.now()
}
});
}
if (alert.direction === 'below' && quote.price <= alert.target) {
pubnub.fire({
channel: `alerts.${alert.userId}`,
message: {
symbol: quote.symbol,
price: quote.price,
target: alert.target,
direction: 'below',
triggeredAt: Date.now()
}
});
}
});
return request.ok();
});
};
quotes.AAPL, sector.tech, index.SPX) for clean wildcard subscriptionsget_sdk_documentation — pull SDK-specific publish/subscribe and signal APIs (route via intent-to-tool)create_pubnub_function — scaffold a server-side price-alert evaluatorgrant_token — issue scoped grants per market data tiermanage_apps — verify Stream Controller for high-frequency tick fan-outrequire('kvstore') for last-known-price; mind the 3-op cap and chainingsignal (cheaper than publish) for high-frequency ticks per payload hygieneWhen providing implementations:
tools
Builds real-time analytics and automation with PubNub Illuminate. Covers Business Objects (schema), Metrics (aggregations), Decisions (threshold-triggered actions with the 4-step PUT workflow), Queries (ad-hoc vs saved pipelines), and Dashboards. Use when tracking KPIs, building threshold alerts, automating mute/publish/App-Context-update actions, detecting spam or anomalies, or visualizing live activity.
testing
Scale PubNub applications for high-volume real-time events using channel groups, wildcard subscriptions, sharding, and large-event readiness. Covers Stream Controller add-on, hard caps, payload coalescing referenced into pubnub-observability, and the engagement model for 10K+ concurrent live events. Persistence/history is owned by pubnub-history.
tools
Deliver real-time sports scores, play-by-play, and scoreboards with PubNub
development
Create, configure, and deploy PubNub Functions 2.0 event handlers, triggers, and serverless endpoints. Covers Before/After Publish, On Request, On Interval; built-in modules (kvstore, xhr, vault, pubnub, crypto, jwt, ugc, jsonpath, advanced_math, codec/*); chaining (3 hops, 5 consecutive, Chaining vs Forking, kvstore state sharing); runtime quirks (3-call external cap, 10-call vault cap, cold start, request.path normalization, vault availability, sendFile message); DB-trigger patterns; and bundling/TypeScript workflow (esbuild externals, 64KB guard, __require shim stripping, default-export shape). Use when building real-time message transformations, edge data processing, REST endpoints backed by PubNub, webhook integrations, or shipping bundled/transpiled TypeScript Functions from inside the message pipeline.