"Ask your trading system anything about the market. Get answers, not error codes."
For the past three years, building a quant workflow meant writing Python scripts, debugging API integrations, and maintaining data pipelines before you could ask a single question about price action. The barrier was not strategy — it was plumbing. You needed to know how to fetch data before you could use data to think.
That barrier is collapsing.
Modern AI agents, powered by structured Function Calling and extensible SKILL protocols, now allow non-programmers to query live market data, screen assets, and trigger signals — all through natural language. The same architecture that lets a retail trader ask "What's the bid-ask spread on NVDA right now?" also lets a quant researcher prototype a multi-asset momentum screen in three prompts.
This article walks through the full architecture of a natural language market data assistant built on AI Agent + TickDB SKILL. We cover how Function Calling works under the hood, how the SKILL protocol surfaces TickDB's endpoints as callable tools, and how to wire everything together into a production-grade agent that survives rate limits, handles reconnection, and produces answers — not exceptions.
1. The Problem with Direct API Access for Non-Programmers
Before we discuss the solution, it is worth being precise about what we are solving.
Most market data APIs — TickDB included — expose data through RESTful endpoints or WebSocket streams. A typical query for a 15-minute candlestick looks like this:
GET /v1/market/kline?symbol=NVDA.US&interval=15m&limit=100
This is clean, efficient, and well-documented. It is also completely opaque to anyone who has not written HTTP request code in Python, JavaScript, or a similar language.
The friction points are specific:
| Friction point | Impact |
|---|---|
| Parameter naming | interval expects "15m" not "15 minutes" — guessable, but not intuitive |
| Symbol format | "NVDA.US" not "NVIDIA" — requires a lookup step |
| Error handling | code: 2002 means symbol not found — requires error code reference |
| Rate limits | code: 3001 requires reading Retry-After and implementing a backoff loop |
| Authentication | API key in header — cannot be passed as a query parameter |
For a developer, these are minor inconveniences solved by reading the docs once. For a trader, a wealth manager, or a researcher who thinks in terms of strategies rather than endpoints, these friction points are enough to abandon the query entirely.
The AI Agent + SKILL architecture eliminates all of them.
2. How Function Calling Bridges Natural Language and API Calls
2.1 The Core Mechanism
Large language models trained for tool use do not "call APIs" in the human sense. They generate structured JSON payloads that conform to a defined schema — and they do so based on a conversation with the user.
When a user says "Show me the last 30 minutes of BTC/USDT price action", the agent's job is to:
- Recognize that this is a market data query.
- Map the intent to a known tool (e.g.,
tickdb_get_kline). - Translate the natural language into correct parameter values:
symbol = "BTC.USDT",interval = "1m",limit = 30. - Generate a valid JSON payload for that tool.
- Execute the call and return the result in human-readable form.
The schema that makes this possible is called a Function Calling definition. In the TickDB SKILL, it looks like this:
{
"name": "tickdb_get_kline",
"description": "Retrieve OHLCV candlestick data for a given symbol and time interval.",
"parameters": {
"type": "object",
"properties": {
"symbol": {
"type": "string",
"description": "Symbol identifier (e.g., 'BTC.USDT', 'NVDA.US', 'AAPL.US'). Format: Asset.venue for equities and crypto."
},
"interval": {
"type": "string",
"description": "Candlestick interval (e.g., '1m', '5m', '1h', '1d')."
},
"limit": {
"type": "integer",
"description": "Number of candles to retrieve (1–1000)."
}
},
"required": ["symbol", "interval", "limit"]
}
}
The LLM does not know what TickDB is. It knows only that it has a tool with this schema. When the user asks a question that matches the schema's intent, the LLM fills in the parameters and outputs the JSON. A runtime layer parses that JSON, makes the actual HTTP call, and returns the data.
This separation — intent recognition handled by the LLM, data retrieval handled by the SKILL — is what makes the architecture both powerful and maintainable.
2.2 Why SKILL Protocol Matters
The SKILL protocol extends the Function Calling concept by packaging a set of related tools into a versioned, installable module. Think of it as an npm package for AI agent capabilities.
A TickDB SKILL exposes multiple tools:
| Tool name | Function |
|---|---|
tickdb_get_kline |
Historical or current OHLCV candlesticks |
tickdb_get_depth |
Order book depth (up to 10 levels for HK/crypto) |
tickdb_get_ticker |
Real-time price, volume, and 24h change |
tickdb_get_symbols |
Search available symbols by keyword |
Each tool has its own Function Calling schema. The SKILL bundles them, handles authentication under the hood, and exposes them to any AI agent runtime that supports the protocol.
The practical benefit: you install one SKILL, and every AI agent built on a compatible runtime immediately has access to market data queries — without any custom prompt engineering per endpoint.
3. Architecture of a Natural Language Market Assistant
3.1 System Overview
The architecture consists of four layers:
┌─────────────────────────────────────────────┐
│ User Interface Layer │
│ (Chat, CLI, Slack, Web App — any frontend) │
└──────────────────┬──────────────────────────┘
│ Natural language queries
▼
┌─────────────────────────────────────────────┐
│ AI Agent Runtime │
│ (Orchestrates intent, selects tools, │
│ formats responses, manages conversation) │
└──────────────────┬──────────────────────────┘
│ Function Calling (JSON payloads)
▼
┌─────────────────────────────────────────────┐
│ TickDB SKILL Layer │
│ (Tool schemas, auth injection, │
│ rate-limit handling, error normalization) │
└──────────────────┬──────────────────────────┘
│ REST / WebSocket
▼
┌─────────────────────────────────────────────┐
│ TickDB API │
│ (Real-time and historical market data) │
└─────────────────────────────────────────────┘
3.2 Tool Selection Logic
When the agent receives a query, it evaluates which tool — or combination of tools — best answers it. Here is the decision logic the agent follows:
IF query contains "price" OR "candlestick" OR "OHLCV" OR "chart":
→ tickdb_get_kline
IF query contains "depth" OR "order book" OR "bid" OR "ask" OR "spread":
→ tickdb_get_depth
IF query contains "volume" OR "24h change" OR "current price":
→ tickdb_get_ticker
IF query contains "available" OR "list symbols" OR "search for":
→ tickdb_get_symbols
IF query is a compound question:
→ Sequential or parallel calls to relevant tools
→ Synthesize results in a single response
For example, the query "Compare the 1-hour momentum of BTC, ETH, and SOL over the last 24 hours" triggers three parallel tickdb_get_kline calls, followed by the agent computing momentum (percentage change from candle[0] to candle[-1]) and presenting a comparison table.
4. Production-Grade SKILL Integration Code
4.1 SKILL Installation
The following example assumes you are using an AI agent runtime that supports the ClawHub SKILL registry. Installation is a single command:
clawhub skill install tickdb-market-data --version latest
This pulls the SKILL definition, verifies the version, and registers all function schemas with the agent runtime. No manual JSON editing required.
4.2 Agent Configuration
import os
from agent_runtime import Agent
# Load TickDB credentials from environment
# The SKILL handles auth injection — you only need the env var set
agent = Agent(
model="gpt-4o",
skills=["tickdb-market-data"],
system_prompt=(
"You are a market data assistant. Use the tickdb-market-data SKILL "
"to answer questions about prices, order books, and historical data. "
"Always cite the timestamp of the data you retrieve. "
"If a query is ambiguous, ask for clarification before making an API call."
),
# Rate-limit behavior: queue requests if the agent would exceed 60 req/min
rate_limit={
"max_requests_per_minute": 60,
"strategy": "queue", # Queue excess requests, do not drop them
},
)
4.3 Query Execution
# Example 1: Simple price query
response = agent.query("What is the current price of AAPL.US?")
print(response)
# Output: "As of 4:02 PM ET, AAPL.US is trading at $187.43,
# up 1.2% over the past 24 hours. Volume: 52.3M shares."
# Example 2: Historical data with natural language parameters
response = agent.query(
"Show me the last 50 one-hour candles for NVDA.US and "
"tell me what the average true range was during that period."
)
print(response)
# Output: "Here are the last 50 hourly candles for NVDA.US.
# Average True Range (14-period) = $4.28."
# Example 3: Multi-symbol comparison
response = agent.query(
"Screen all available crypto symbols with a 24h volume above 100M "
"and return the top 5 by price change."
)
print(response)
# Output: Table with symbol, price, 24h change, volume for top 5 matches.
4.4 SKILL-Level Error Handling
The SKILL normalizes API errors into agent-readable messages. Below is the internal error mapping the SKILL applies before passing responses back to the agent runtime:
ERROR_CODE_MAP = {
1001: ("auth_error", "Invalid API key. Please check your TICKDB_API_KEY environment variable."),
1002: ("auth_error", "API key missing. Set TICKDB_API_KEY before making requests."),
2002: ("not_found", "Symbol not found. Try a different symbol or use tickdb_get_symbols to search."),
3001: ("rate_limited", "Rate limit reached. Retrying after the recommended backoff interval."),
9999: ("server_error", "TickDB server error. Please try again in a few minutes."),
}
When the agent encounters a rate_limited response, it automatically re-queues the request with exponential backoff — the user sees no error, only a brief "Fetching data, one moment…" message.
5. Built-in Quantitative Analysis Functions
5.1 Beyond Raw Data: Computed Metrics
The SKILL does more than proxy API calls. It includes pre-built analytical functions that the agent can invoke without additional prompting:
| Function | Input | Output |
|---|---|---|
momentum(symbol, interval, periods) |
Symbol, interval, lookback | Percentage change over N periods |
atr(symbol, interval, length) |
Symbol, interval, ATR length | Average True Range value |
pressure_ratio(depth_data) |
Raw depth snapshot | Bid-side volume / Ask-side volume ratio |
volatility(symbol, interval, length) |
Symbol, interval, window | Standard deviation of returns |
These functions are surfaced as additional Function Calling tools. The agent decides when to compute them based on the user's intent:
# Agent runtime interprets this query and selects both the data fetch
# and the computed metric automatically
response = agent.query(
"Is there currently a liquidity imbalance on BTC.USDT? "
"Show me the buy/sell pressure ratio and flag if it exceeds 2.0."
)
# Agent calls: tickdb_get_depth → pressure_ratio → conditional response
5.2 Order Book Pressure Ratio
The pressure ratio is a microstructure signal computed from TickDB's depth channel. It measures the ratio of cumulative bid-side volume to cumulative ask-side volume across the top N levels:
Pressure Ratio = Σ(bid_size[i], i=1 to N) / Σ(ask_size[i], i=1 to N)
- Ratio > 1.0: Buying pressure dominates
- Ratio < 1.0: Selling pressure dominates
- Ratio > 2.0 or < 0.5: Extreme imbalance — potential directional signal
For HK equities and crypto markets, the depth channel provides up to 10 levels of order book data, enabling multi-level pressure analysis. For US equities, L1 data (best bid / best ask) is available.
6. Deployment Guide by User Segment
| User segment | Recommended setup | Free tier compatible? |
|---|---|---|
| Retail trader exploring quant ideas | Chat-based agent (Claude/GPT) + TickDB SKILL | Yes — up to 60 req/min, 1,000 req/day |
| Independent researcher screening multiple symbols | Python agent script + SKILL | Yes — same limits |
| Small fund, team of 2–5 | Shared agent endpoint + SKILL | No — Professional plan required |
| Institutional desk, latency-sensitive | Direct TickDB WebSocket + custom agent | No — Enterprise plan required |
For most individual users, the free tier combined with an AI agent provides sufficient capacity for exploration and prototyping. The critical limit is requests per day, not requests per minute — the agent's queue-based rate limit strategy ensures you never hit the per-minute ceiling under normal usage.
7. Limitations and Honest Scope Boundaries
A natural language market data assistant is powerful for exploration and prototyping. It is not a production trading system. Be clear about where the architecture has limits:
Rate of queries: Even with queue-based throttling, an AI agent adds 200–500 ms of inference latency per turn. This makes it unsuitable for sub-second signal generation.
Execution: The SKILL queries data. It does not place trades. Building a fully autonomous agent that both analyzes and executes requires a separate execution layer with its own risk controls, which is outside the scope of this SKILL.
Historical data depth: TickDB provides 10+ years of cleaned OHLCV data for backtesting, but the agent's context window limits how far back a single query can analyze. For full historical backtests, export data via the REST API and run analysis in a Python notebook.
Symbol coverage: US equity tick-level trades are not supported. For order flow analysis on US equities, use the depth channel (L1) in combination with OHLCV data. HK equity and crypto support full depth (L1–L10) and trade-level data.
8. Closing
Three years ago, the question "Can I do quant trading without writing code?" had one honest answer: not really. You could use a no-code backtesting platform, but you were limited to its pre-built modules. You could hire a developer, but you were limited by their availability and your budget.
That answer is outdated.
The combination of AI agents with structured Function Calling and a well-designed SKILL protocol means that the barrier between idea and market data is now a conversation, not a codebase. The plumber has not disappeared — it has been automated.
Whether you are a trader who wants to test an idea in real time, a researcher who needs a fast data exploration layer, or a developer prototyping a quant strategy before writing production code, the natural language market data assistant is a practical starting point.
Next Steps
If you want to try it without writing any code: Install the tickdb-market-data SKILL in any AI tool that supports ClawHub SKILLs. Start with a question like "What is the bid-ask spread on BTC.USDT right now?"
If you want to build a custom agent script: Sign up at tickdb.ai to get your free API key, then use the Python agent runtime example from this article as your starting template. The SKILL handles auth, rate limits, and error normalization — you focus on the conversation logic.
If you need institutional-grade rate limits and full historical depth: Reach out to enterprise@tickdb.ai for Professional or Enterprise plans.
If you use Claude, GPT, or another LLM-based tool: Search for and install the tickdb-market-data SKILL in your AI tool's marketplace. No credit card required to start.
This article does not constitute investment advice. Markets involve risk; past performance does not guarantee future results. The natural language assistant described is a data query tool, not a trading system.