Live stock price candlestick chart representing a real-time stock quote API

Blog ·

Real-Time Stock Price API: How to Get Live Stock Quotes in Your App

A real-time stock price API lets your application show live share prices, update portfolios and react to market moves as they happen. The hard parts are not the request itself but freshness, market hours and scale. This guide covers all three.

Live stock quotes with one request

curl -H "Authorization: Bearer $API_KEY" "https://api.marketapi.app/v1/prices/latest?symbols=AAPL.US,MSFT.US,TSLA.US"

Each quote carries the bid, the ask, the time of the last update and a status: LIVE while the stock trades, MARKET_CLOSED outside trading hours. Your interface can show "closed" instead of a misleading stale price.

Python example

import os, requests

r = requests.get("https://api.marketapi.app/v1/prices/latest",
                 params={"symbols": "AAPL.US,NVDA.US"},
                 headers={"Authorization": f"Bearer {os.environ['API_KEY']}"}, timeout=10)
for q in r.json()["data"]:
    print(q["symbol"], q["bid"], q["ask"], q["status"], q["time"])

Why freshness matters

"Real time" only helps if you can prove a price is current. Every quote includes its source timestamp, so you can reject anything older than your tolerance. Symbols your users actively watch are refreshed about every second.

Streaming stock prices

For live tickers and trading screens, use the WebSocket stream: subscribe once and receive each change instantly, instead of polling.

Market hours and weekends

US stocks trade on exchange hours; outside them the last price stays available with the MARKET_CLOSED status. Read how to handle market hours in your data.

FAQ

Can I get historical stock prices too?

Yes, as OHLC candles in 21 timeframes and as ticks. See historical OHLC data.

How is usage billed?

Designing a fast stock ticker

Load the user's watchlist with one batched latest-price request, render it immediately, then switch to the WebSocket stream for updates. Show the time of the last update next to each price and grey out symbols whose market is closed. This combination feels instant and never displays a stale number as if it were live.

Common pitfalls

  • Polling every symbol every second: wasteful; stream instead, or poll only what is on screen.
  • Hiding the timestamp: users trust prices more when they can see how fresh they are.
  • Forgetting corporate events: splits and dividends change the price series; use adjusted analysis where needed.

Which stocks are available?

Major US and international stocks as CFD price series, listed with their symbols in the ticker CSV. Each symbol shows its digits, trading hours and category.

Can I use the data in a commercial app?

Yes, within the terms of your plan; display the data with attribution where required.

In credits per symbol returned, from a prepaid balance or a monthly plan. Free credits are included when you sign up.

Try the market price API

1000 free credits after sign-up.

Get a free API key

More articles