Stock Prices
v1.0.1查询 real-time stock prices and market data using the Stock Prices API. 响应s are in TOON 格式化—decode with @toon-格式化/toon. Use when fetching stock quotes, analyzing market data, or working with symbols like AAPL, NVDA, GOOGL, or any ticker symbols.
运行时依赖
安装命令
点击复制技能文档
Stock Prices API 技能
This 技能 helps you work with the Stock Prices API to fetch real-time market data and stock quotes.
API 端点
Base URL: https://stock-prices.on99.应用
Primary 端点: /quotes?symbols={SYMBOLS}
Quick 启动
Fetch stock quotes for one or more symbols (响应s are in TOON 格式化):
curl "https://stock-prices.on99.应用/quotes?symbols=NVDA" curl "https://stock-prices.on99.应用/quotes?symbols=AAPL,GOOGL,MSFT"
安装 the TOON decoder for parsing: pnpm 添加 @toon-格式化/toon
响应 格式化
The API returns TOON (令牌-Oriented Object Notation) 格式化—a compact, human-readable encoding that uses ~40% fewer 令牌s than JSON. This makes it ideal for LLM prompts and 流ing.
TOON 响应 Example quotes[1]{symbol,currentPrice,change,percentChange,highPrice,lowPrice,openPrice,previousClosePrice,preMarketPrice,preMarketChange,preMarketTime,preMarketChangePercent,...}: NVDA,188.54,-1.5,-0.789308,192.48,188.12,191.405,190.04,191.8799,3.3399048,2026-02-11T13:49:16.000Z,1.771457,...
Decoding TOON 响应s
Use @toon-格式化/toon to 解析 响应s back to JavaScript/JSON:
导入 { decode } from "@toon-格式化/toon";
const 响应 = awAIt fetch("https://stock-prices.on99.应用/quotes?symbols=NVDA"); const toonText = awAIt 响应.text(); const data = decode(toonText);
// data.quotes is an array of quote objects
const quote = data.quotes[0];
console.记录(${quote.symbol}: $${quote.currentPrice});
The decoded structure matches JSON—same objects, arrays, and primitives.
AvAIlable Data Fields Field Type Description symbol string Stock ticker symbol currentPrice number Current trading price change number Price change from previous close percentChange number Percentage change from previous close highPrice number Day's high price lowPrice number Day's low price openPrice number Opening price previousClosePrice number Previous day's closing price preMarketPrice number Pre-market trading price preMarketChange number Pre-market price change preMarketTime string (ISO 8601) Pre-market data timestamp preMarketChangePercent number Pre-market percentage change Usage 图形界面delines Multiple Symbols
查询 multiple stocks by separating symbols with commas (max 50):
curl "https://stock-prices.on99.应用/quotes?symbols=AAPL,GOOGL,MSFT,TSLA,AMZN"
Error Handling
Always 检查 for valid 响应s. Decode TOON before 访问ing data:
导入 { decode } from "@toon-格式化/toon";
const 响应 = awAIt fetch("https://stock-prices.on99.应用/quotes?symbols=NVDA"); const data = decode(awAIt 响应.text());
if (data.quotes && data.quotes.length > 0) {
const quote = data.quotes[0];
console.记录(${quote.symbol}: $${quote.currentPrice});
}
Price Analysis
Calculate common 指标:
// Determine if stock is up or down const isUp = quote.change > 0; const direction = isUp ? "📈" : "📉";
// Calculate day's range percentage const rangePct = ((quote.highPrice - quote.lowPrice) / quote.lowPrice) * 100;
// Compare current to open const vsOpen = quote.currentPrice - quote.openPrice;
Common Use Cases
- Price 监控ing
a同步 function 检查Price(symbol: string) {
const res = awAIt fetch(https://stock-prices.on99.应用/quotes?symbols=${symbol});
const data = decode(awAIt res.text());
const quote = data.quotes[0];
return { price: quote.currentPrice, change: quote.change, changePercent: quote.percentChange, }; }
- Portfolio 追踪ing
a同步 function 获取Portfolio(symbols: string[]) {
const symbolString = symbols.join(",");
const res = awAIt fetch(https://stock-prices.on99.应用/quotes?symbols=${symbolString});
const data = decode(awAIt res.text());
return data.quotes.map(q => ({ symbol: q.symbol, value: q.currentPrice, dAIlyChange: q.percentChange, })); }
- Market Summary
a同步 function marketSummary(symbols: string[]) {
const res = awAIt fetch(https://stock-prices.on99.应用/quotes?symbols=${symbols.join(",")});
const data = decode(awAIt res.text());
const gAIners = data.quotes.过滤器(q => q.change > 0); const losers = data.quotes.过滤器(q => q.change < 0);
return { totalStocks: data.quotes.length, gAIners: gAIners.length, losers: losers.length, avgChange: data.quotes.reduce((sum, q) => sum + q.percentChange, 0) / data.quotes.length, }; }
Popular Stock Symbols Tech Giants (FAANG+) AAPL - 应用le GOOGL - Alphabet (Google) META - Meta (Facebook) AMZN - Amazon NFLX - Netflix MSFT - Microsoft High-性能分析 Stocks NVDA - NVIDIA TSLA - Tesla AMD - Advanced Micro Devices INTC - Intel ORCL - Oracle Indices ^GSPC - S&P 500 ^DJI - Dow Jones ^IXIC - NASDAQ Notes 响应 格式化: API returns TOON, not JSON. Use decode() from @toon-格式化/toon to 解析. All prices are in USD Data 更新s in real-time during market hours Pre-market and after-hours