Skip to content
DDataNest

Finance · 4 min read

How to use the Stock Market API in Python & JavaScript

Real-time stock market data is hard to source and harder to keep reliable. Instead of stitching together feeds, you can pull it from one endpoint.

By DataNest · Published May 2026

What the Stock Market API does

A clean, fast stock market API covering 50,000+ tickers with real-time quotes, analyst consensus, price targets, earnings calendars, news, and daily market movers. Responses are JSON, the API runs behind the RapidAPI gateway for auth and rate limiting, and there's a free tier for prototyping.

When to use it

portfolio trackers
financial dashboards
trading tools

The example request

GET https://stock-market-by-datanest.p.rapidapi.com/quote/AAPL?symbol=AAPL

Example JSON response

An illustrative response body — run the live demo for the real thing.

{
  "symbol": "AAPL",
  "price": 229.87,
  "changePercent": 1.14,
  "marketCap": 3480000000000,
  "peRatio": 35.2,
  "week52": {
    "high": 237.23,
    "low": 164.08
  },
  "analystRating": "Buy",
  "nextEarnings": "2026-07-31"
}

Step by step

1. Subscribe and get your key

Open the Stock Market API on RapidAPI, subscribe to the free BASIC plan, and copy your X-RapidAPI-Key.

2. Call the endpoint

The example call for this API is shown above. The quick-start snippets below send exactly that request in cURL, Python and Node so you get a real response on the first try.

3. Try it without code first

The Stock Market page has a live "Try it" panel — change the input, run it, and inspect the real JSON before you integrate.

4. Integrate and cache

Call it from your backend and cache responses where it makes sense. For fast-moving data, a short TTL keeps it fresh without hammering the API.

Quick-start code

curl --request GET \
  --url 'https://stock-market-by-datanest.p.rapidapi.com/movers' \
  --header 'x-rapidapi-host: stock-market-by-datanest.p.rapidapi.com' \
  --header 'x-rapidapi-key: YOUR_RAPIDAPI_KEY'

What you can build

Live portfolio tracker

Refresh each ticker every few minutes to show real-time position values.

Stock screener

Filter the 50,000+ ticker universe by P/E, market cap and analyst rating.

Earnings calendar

Surface upcoming earnings dates so users never miss a report for a stock they hold.

Wrapping up

If your project needs portfolio trackers, the Stock Market API removes the part nobody enjoys building. It's one of 23 in the DataNest collection — grab a free key and make your first call.

Stock Market updates

New Stock Market guides and endpoint updates, occasionally.