Connect a Stock Quote API to AI and Show the Right Quote Time on a Global Watchlist

TickDB Research ·

Connect a Stock Quote API to AI and Show the Right Quote Time on a Global Watchlist

The same lookup can return Monday quotes in China and Hong Kong, a Friday US regular quote, and a Monday US premarket quote. Use real REST and MCP payloads to decide which price to show and how to preserve its market time.

On Monday evening in Beijing, asking an assistant for Apple's current price can surface both $342.56 and $347.66. In a November 23 sample, the first was the main quote from Friday at 16:00:00 Eastern. The second was Monday premarket at 06:59:43. The user's wording determines which object to show. Include its quote time and session so the price can be interpreted. [1]

Decide what price the question calls for

A previous-close question needs the relevant regular-session data. A premarket question needs the premarket object. A general “now” question requires a display policy that accounts for the market session and tells the user what was actually returned. Preserving each price object lets one watchlist answer all three questions.

Observation from one lookupPriceMarket-local source time
Kweichow Moutai, mainCNY 1,439Nov 23 15:00:02 Shanghai
Tencent, mainHKD 344Nov 23 16:08:22 Hong Kong
AAPL, mainUSD 342.56Nov 20 16:00:00 New York
AAPL, premarketUSD 347.66Nov 23 06:59:43 New York

These four observations come from one November 23 MCP response. They share a retrieval event; every quote has its own source time. [1]

A report date cannot substitute for a quote timestamp

Giving every row the query date can turn the Friday main quote into a Monday quote. Picking the newest object can turn a premarket value into an answer about the prior regular close. Store each price with its own source timestamp. Keep retrieval time separately for tracing when the system acquired the snapshot.

We ran two actual payloads through the same converter. In an October 22 REST archive, the AAPL main quote used a local UTC offset of -04:00; in a November 23 MCP capture it was -05:00. A fixed five-hour offset would mislabel the October observation by an hour. Use a named timezone such as America/New_York and apply it to each timestamp. The captures were on different dates and test the same structure and conversion. [1, 2]

REST and MCP share a field design that preserves request and quote times separately

Figure 1. Keep retrieval time on the snapshot and a source time on each quote object.

Apply three checks before passing quotes to the assistant

  1. Use complete symbols. A scheduled application can request GET /v1/market/ticker from the TickDB Stock Market Data API. An assistant can query through a connected MCP market-data tool. Join by full symbols such as 600519.SH, 700.HK and AAPL.US. Check the business status and returned symbols. [2, 3]
  2. Keep main last_price and timestamp together. When extended-session objects are present, take last_done and timestamp from each object. Save symbol, quote object, currency, raw timestamp and market-local time. Maintain the currency from verified instrument metadata; this quote capture does not supply a currency field. Keep snapshot acquisition time separately. [2]
  3. Test missing data before launch. If a symbol is absent, return an explicit missing state. If a premarket object is absent, report it. A main-quote fallback should retain its own source date and session.

This is the actual source-time conversion for the November 23 premarket observation.

from datetime import datetime, timezone
from zoneinfo import ZoneInfo

stamp = 1795435183000
source = datetime.fromtimestamp(stamp / 1000, timezone.utc)
market = ZoneInfo("America/New_York")
print(source.astimezone(market).isoformat())

The output is 2026-11-23T06:59:43-05:00. To verify the full path, ask the assistant for the previous regular close and premarket quote separately. Run the question again with the premarket object removed. The response should identify it as unavailable and label the remaining quote by its actual session.

FAQ

When should an old quote be labelled stale? Set the threshold for the display and market session. Outside market hours, check whether you have the latest eligible session first. Use a calendar or market status when identifying closures, delays or trading halts.

References

  1. TickDB REST three-market snapshot archive, October 22, 2026, and MCP response for the same three symbols, November 23, 2026.
  2. TickDB Docs, Market Ticker, for quote objects and timestamps.
  3. TickDB Unified Realtime Market Data API, official GitHub repository.

7 markets · 42,688 symbols

US stocks
14,386
Hong Kong market
3,354
China stocks, ETFs & bonds
7,576
Forex & metals
1,228
Indices
13,960
Futures
1,172
Crypto
1,012
11/24/2026

Related articles

Did Your Watchlist Follow the Index? A Midday Review with a Real-Time China A-Share Stock API

On November 23, the ChiNext Index opened lower and was up 1.22% by midday. Yet 209 stocks in our example watchlist were still below their previous close. Use opening prices, previous closes, and midday quotes from a real-time China A-share stock API to see which stocks rebounded, which turned positive, and whether your watchlist still warrants a risk flag.

TickDB Research ·

Moving a Hong Kong stock data API into Docker? Check the first quote after restart

Before moving a Hong Kong stock dashboard, alerting service, or risk monitor to Docker, what should count as recovery? In our local Tencent test, the first quote request returned HTTP 403. A later run returned a valid snapshot. The controlled restart command returned after 0.223 seconds, and the first quote passed validation after 1.580 seconds. It was still the previous session's quote. This article shows what to check on a weekend and what to verify again during trading.

TickDB Research ·