AgentSkillsCN

stock-prices

使用股票价格API查询实时股价与市场数据。在获取股票报价、分析市场数据,或处理AAPL、NVDA、GOOGL等股票代码,或任意证券代码时使用此功能。

SKILL.md
--- frontmatter
name: stock-prices
description: Query real-time stock prices and market data using the Stock Prices API. Use when fetching stock quotes, analyzing market data, or working with symbols like AAPL, NVDA, GOOGL, or any ticker symbols.

Stock Prices API Skill

This skill helps you work with the Stock Prices API to fetch real-time market data and stock quotes.

API Endpoint

Base URL: https://stock-prices.on99.app

Primary Endpoint: /quotes?symbols={SYMBOLS}

Quick Start

Fetch stock quotes for one or more symbols:

bash
curl "https://stock-prices.on99.app/quotes?symbols=NVDA"
curl "https://stock-prices.on99.app/quotes?symbols=AAPL,GOOGL,MSFT"

Response Format

The API returns JSON with the following structure:

json
{
    "quotes": [
        {
            "symbol": "NVDA",
            "currentPrice": 188.54,
            "change": -1.5,
            "percentChange": -0.789308,
            "highPrice": 192.48,
            "lowPrice": 188.12,
            "openPrice": 191.405,
            "previousClosePrice": 190.04,
            "preMarketPrice": 191.8799,
            "preMarketChange": 3.3399048,
            "preMarketTime": "2026-02-11T13:49:16.000Z",
            "preMarketChangePercent": 1.771457
        }
    ]
}

Available Data Fields

FieldTypeDescription
symbolstringStock ticker symbol
currentPricenumberCurrent trading price
changenumberPrice change from previous close
percentChangenumberPercentage change from previous close
highPricenumberDay's high price
lowPricenumberDay's low price
openPricenumberOpening price
previousClosePricenumberPrevious day's closing price
preMarketPricenumberPre-market trading price
preMarketChangenumberPre-market price change
preMarketTimestring (ISO 8601)Pre-market data timestamp
preMarketChangePercentnumberPre-market percentage change

Usage Guidelines

Multiple Symbols

Query multiple stocks by separating symbols with commas (max 50):

bash
curl "https://stock-prices.on99.app/quotes?symbols=AAPL,GOOGL,MSFT,TSLA,AMZN"

Error Handling

Always check for valid responses:

typescript
const response = await fetch("https://stock-prices.on99.app/quotes?symbols=NVDA");
const data = await response.json();

if (data.quotes && data.quotes.length > 0) {
    const quote = data.quotes[0];
    console.log(`${quote.symbol}: $${quote.currentPrice}`);
}

Price Analysis

Calculate common metrics:

typescript
// 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

1. Price Monitoring

typescript
async function checkPrice(symbol: string) {
    const res = await fetch(`https://stock-prices.on99.app/quotes?symbols=${symbol}`);
    const data = await res.json();
    const quote = data.quotes[0];

    return {
        price: quote.currentPrice,
        change: quote.change,
        changePercent: quote.percentChange,
    };
}

2. Portfolio Tracking

typescript
async function getPortfolio(symbols: string[]) {
    const symbolString = symbols.join(",");
    const res = await fetch(`https://stock-prices.on99.app/quotes?symbols=${symbolString}`);
    const data = await res.json();

    return data.quotes.map(q => ({
        symbol: q.symbol,
        value: q.currentPrice,
        dailyChange: q.percentChange,
    }));
}

3. Market Summary

typescript
async function marketSummary(symbols: string[]) {
    const res = await fetch(`https://stock-prices.on99.app/quotes?symbols=${symbols.join(",")}`);
    const data = await res.json();

    const gainers = data.quotes.filter(q => q.change > 0);
    const losers = data.quotes.filter(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 - Apple
  • GOOGL - Alphabet (Google)
  • META - Meta (Facebook)
  • AMZN - Amazon
  • NFLX - Netflix
  • MSFT - Microsoft

High-Profile Stocks

  • NVDA - NVIDIA
  • TSLA - Tesla
  • AMD - Advanced Micro Devices
  • INTC - Intel
  • ORCL - Oracle

Indices

  • ^GSPC - S&P 500
  • ^DJI - Dow Jones
  • ^IXIC - NASDAQ

Notes

  • All prices are in USD
  • Data updates in real-time during market hours
  • Pre-market and after-hours data is available
  • Timestamps are in ISO 8601 format (UTC)
  • Maximum 50 symbols per request