DEV Community

Алексей Спинов
Алексей Спинов

Posted on

How to Scrape Stock Market Data with Free APIs (Yahoo Finance, Alpha Vantage)

Financial data scraping powers trading bots, dashboards, and research tools.

Yahoo Finance (Unofficial, Free)

async function getStockQuote(symbol) {
  const url = `https://query1.finance.yahoo.com/v8/finance/chart/${symbol}?interval=1d&range=1mo`;
  const res = await fetch(url, { headers: { "User-Agent": "StockBot/1.0" } });
  const data = await res.json();
  const result = data.chart.result[0];
  return {
    symbol,
    currency: result.meta.currency,
    price: result.meta.regularMarketPrice,
    previousClose: result.meta.previousClose,
    timestamps: result.timestamp,
    prices: result.indicators.quote[0].close
  };
}
Enter fullscreen mode Exit fullscreen mode

Alpha Vantage (Free, Key Required)

https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=AAPL&apikey=YOUR_KEY
Enter fullscreen mode Exit fullscreen mode

Free: 25 requests/day.

Other Free Sources

Source Data Key
Yahoo Finance Quotes, charts None
Alpha Vantage Historical, forex Free
Finnhub Real-time Free
IEX Cloud US stocks Free tier
CoinGecko Crypto None

Use Cases

  1. Trading bot data feeds
  2. Portfolio tracking dashboards
  3. Market research reports
  4. Price alert systems
  5. Historical backtesting

Resources


Need financial data extracted? Stock prices, forex, crypto — $20-50. Email: Spinov001@gmail.com | Hire me

Top comments (0)