OpenClawSkills
GitHub

Stock Ticker

Community

Get real-time stock prices for a given symbol using Yahoo Finance API.

Installation

Save as `stock.js`. Usage: `stock <symbol>` (e.g. `stock AAPL`).

Source Code

JavaScript
Tutorial.terminal

// stock.js
// Usage: openclaw run stock --args "AAPL"

module.exports = async function(context) {
    const symbol = context.args[0] || 'AAPL';
    const url = `https://query1.finance.yahoo.com/v8/finance/chart/${symbol}`;
    
    try {
        const res = await fetch(url);
        const data = await res.json();
        
        if (!data.chart || !data.chart.result) {
            return { status: "error", message: "Symbol not found" };
        }
        
        const meta = data.chart.result[0].meta;
        return {
            symbol: meta.symbol,
            price: meta.regularMarketPrice,
            currency: meta.currency,
            time: new Date().toISOString()
        };
    } catch (e) {
        return { status: "error", message: e.message };
    }
}

Live Preview

● Live Demo
Agent Session
Starting session...

How to use

  • Ensure you have the necessary dependencies installed (if any).
  • Place the file in your OpenClaw skills folder (e.g., ~/.openclaw/skills/).
  • Restart your agent or reload configuration.
  • Invoke it using the filename (without extension) as the tool name, or through natural language if the description is clear.