How to rerun the same US stock bar query from an AI session in a script

TickDB Research ·

How to rerun the same US stock bar query from an AI session in a script

Save the request before passing historical stock data from an AI session to a script. TickDB MCP and CLI 0.2.1 returned five AAPL daily bars with identical timestamps and OHLCV values in this test. Here are the fixed inputs, command and failure checks.

A colleague sends you a table of five AAPL daily bars from an AI session. A few days later, fetching “the last five” gives you a different window. To reproduce the original analysis, keep the symbol, interval, exact date bounds and adjustment mode next to the table.

Pin the request

This test used AAPL.US, stock, daily bars, no adjustment, and a limit of 10. The window runs from midnight October 26 to 23:59:59 on October 30, 2026 in New York. Convert the timezone-aware bounds to Unix milliseconds for both clients.

{"symbol":"AAPL.US","type":"stock","interval":"1d","adjust":"none",
 "start_time":1792987200000,"end_time":1793419199000,"limit":10}

Run the request with the MCP get_kline tool and save its inputs and raw JSON. With credentials already configured, run the matching TickDB CLI 0.2.1 command. TickDB AI Market Data Tools

tickdb kline AAPL.US --type stock --interval 1d --adjust none --from 1792987200000 --to 1793419199000 --limit 10 --json

Compare row keys and values

MCP and CLI matched across all five AAPL daily bars in the same window

Both responses carried business code 0. The timestamp and the open, high, low, close and volume matched across all five rows. Here are the closes for a quick check. Use decimal values for comparison so formatting changes do not create false mismatches.

New York trading dateMCP close (USD)CLI close (USD)
Oct 26343.91343.91
Oct 27347.10347.10
Oct 28343.83343.83
Oct 29348.91348.91
Oct 30344.63344.63

This test verifies reproducibility for one request across two clients of the same service. Repeat the check with your actual symbol, permissions and dates. A successful query can return fewer sessions than expected, so compare the timestamps against the expected trading dates as well.

Preserve the failure path

Changing the interval to 2d in the CLI triggered a validation error and exit code 1. Have your script check the exit code before parsing the business response. Then verify the returned symbol and interval, unique timestamps, expected trading dates and values. Keep both raw responses when a check fails.

Frequently asked questions

Can I use the latest five bars? That will move the window on a later run. Pin both bounds and use completed periods to reproduce an earlier result.

Should I drop fields I don't use? Keep the original response in your internal evidence. You can export only the closing prices you need while keeping the other inputs available to review.

References

  1. TickDB AI Market Data Tools and official CLI 0.2.1 command help.
  2. TickDB Docs, K-line query. Results from two actual AAPL.US requests and the CLI invalid-interval test.

This week’s offer

Official TickDB Black Friday subscription week banner

November 23–29, 2026, through 23:59 Beijing time. Save 15% on six months and get an extra half month, or save 20% on a year and get an extra month. Eligible for new paid subscriptions and renewals.

Category coverage

US stocks
14,809
11/27/2026

Explore related data tools

Related articles

How to reconcile an ex-dividend price change before the dividend arrives

Microsoft closed \$8.69 lower per share on November 20, 2025, its ex-dividend date. For an eligible holder, adding the \$0.91 gross dividend entitlement gives a price-plus-dividend change of −\$7.78. Here is how to reconcile the price, entitlement and eventual cash receipt.

TickDB Research ·

How to Get US Stock After-Hours Data? Market Data API Integration and Quality Verification

After connecting to a US stock market data API, how do you determine whether the returned prices and volume belong to after-hours trading? This article explains after-hours field reading, cross-midnight time attribution, the difference between missing data and zero volume, and provides reproducible request examples and Python validation code using synthetic samples, helping you check the after-hours data quality of your US stock data source.

TickDB Research ·

U.S. Trading Calendar API: How to Schedule After-Close Backfills on Holidays and Early Closes

When scheduling U.S. stock reports or minute-bar backfills, skip confirmed closures, adjust the window on early-close days, and flag failed calendar checks for review. Using an actual calendar response and the 2026 Thanksgiving exchange schedules, we calculate the 210-minute window for November 27 and lay out four scheduling states you can implement.

TickDB Research ·