Market dataAPI designDevelopersAgentic trading

How one API normalizes market data for trading agents

A single API unifies market data from five market types into one normalized pipeline so trading agents can read prices and depth without venue-specific code.

By the Felix team10 min read
Key takeaways
  • 01A single API normalizes prices, order books, and timestamps from five market types into one uniform schema so agents parse data without venue-specific code.
  • 02Normalized data reduces misinterpretation risks because the agent always sees prices in US dollars, quantities in consistent units, and timestamps in UTC.
  • 03The pipeline abstracts stocks, crypto, perps, options, and prediction markets into common instrument objects while preserving type-specific metadata in predictable sub-fields.
  • 04Agents must handle data staleness and upstream outages gracefully because the unified layer can only forward what the venues provide.
  • 05Scoped API keys let developers grant read-only data access separately from trading permissions, keeping the agent's data consumption compartmentalized from its execution paths.

A single API can present market data from stocks, crypto, perpetual futures, options, and prediction markets in one uniform format. Trading agents read prices, order books, and trade history through this pipeline without writing venue-specific parsers for each source. The API translates contract sizes, tick conventions, and timestamp formats into a common schema so the agent consumes clean inputs and emits orders in plain US dollars. This removes the need for the agent to understand whether it is looking at a stock split, a perp funding rate, or a prediction market probability.

What does a market data pipeline actually do?

A market data pipeline is the path that information travels from the original venue to the agent. It collects prices, order book depth, recent trades, and metadata such as trading hours or settlement details. The pipeline then validates, transforms, and delivers this information through a single interface that the agent queries. Think of it as a translation layer that sits between the raw feeds of a stock broker, a crypto exchange, a perps venue, an options venue, and a prediction market on one side, and the agent's logic on the other.

The pipeline does not execute trades. It is strictly a read-only layer that feeds the agent's decision engine. When the agent decides to act, it sends orders through a separate execution path that is governed by the same API but protected by scoped keys and budget caps. Because the data layer is separate from the execution layer, a bug in the agent's parsing logic cannot accidentally trigger an order. The pipeline simply provides the current state of each market so the agent can evaluate conditions.

At its core, the pipeline performs three tasks.

  • ·It ingests raw feeds in whatever format the venue publishes.
  • ·It normalizes those feeds into a common schema.
  • ·It serves the normalized data to the agent through REST endpoints or MCP tools.

The agent receives a snapshot or stream that looks identical regardless of whether the underlying asset is a share of stock or a perpetual futures contract.

Why do agents need normalized data instead of raw feeds?

Raw market feeds are not designed for consumption by automated agents. A stock broker might report prices in dollars and cents with timestamps in Eastern Time. A crypto venue might report prices in satoshis or wei with millisecond Unix timestamps. A perps venue might include funding rates, mark prices, and index prices in a nested JSON object. An options venue might return full chains with delta, gamma, theta, and implied volatility. A prediction market might express prices as decimal probabilities, percentages, or even share prices that map to payout structures.

If an agent had to parse each of these formats natively, its prompt context or code base would balloon with edge cases. Worse, the agent could misinterpret a field. For example, an agent might confuse a perp funding rate with a spot price, or misread an option strike because the venue formats it as a string instead of a number. These mistakes are not theoretical. How AI agents misread order books step by step explains how subtle formatting differences lead agents to trade on stale or inverted prices.

Normalization solves this by forcing every feed into the same shape. Price is always a number in US dollars. Quantity is always a number of contracts or shares, but the API handles the conversion so the agent thinks in dollars. Timestamps are always in UTC. Order book depth is always an array of price and size tuples. The agent does not need to know that one venue inverts base and quote currencies, or that another venue uses half-tick spacing after 4:00 p.m. It sees a market, a bid, an ask, and a timestamp.

This consistency is especially important for multi-market strategies. An agent that rebalances between stocks and prediction markets, or between crypto and options, cannot afford to pause and reformat data for every leg. Normalization lets the agent treat every market as a row in the same table.

How does one API handle five different market types?

The API abstracts each market type into a common instrument object. Every instrument has a symbol, a market type tag, a current price, a bid-ask spread, a 24-hour volume figure, and an order book depth array. Beyond these basics, the API attaches type-specific metadata in a predictable sub-object so the agent can access specialized fields when needed without losing the common wrapper.

For stocks, the pipeline handles splits, dividends, and market hours. The agent sees a price per share and a flag indicating whether the market is currently open. For crypto, the pipeline handles base and quote pairs, decimal precision, and network confirmations. The agent sees a single price and a unified volume figure. For perpetual futures, the pipeline attaches funding rates, mark prices, and leverage limits as metadata. The agent can read these to adjust its model, but the primary price field is still the mark price in dollars.

For options, the pipeline flattens complex chains into individual strike-expiry instruments. Each option leg has a strike price, an expiry date, an option type flag, and Greek values. The agent can scan the chain as if it were a table, filtering by maturity or moneyness without parsing nested expiration trees. For prediction markets, the pipeline converts whatever odds format the venue uses into a straightforward probability price between zero and one, or into a dollar payout price, depending on the contract structure. The resolution date and liquidity pool depth are included as metadata.

Orders are sized in plain US dollars across all five types. The agent does not calculate how many shares, satoshis, or contracts equal one hundred dollars. The API normalizes venue-specific contract math on both the data and execution sides. This means the agent can compare a stock position, a crypto position, and a prediction market position using the same unit of account. How to trade every market through one API with hard limits the agent cannot cross covers how those same normalization rules apply when the agent moves from reading data to placing orders.

What are the practical limits of a unified data layer?

Normalization is powerful, but it is not magic. The pipeline can only serve data as fast as the slowest upstream source, and it can only expose fields that exist in the raw feeds. If a stock broker updates its quote feed every second while a crypto venue streams milliseconds, the unified API must either poll the stock feed at a reasonable rate or present a mixed latency profile. Agents should not assume that a timestamp on a stock quote and a timestamp on a perp quote were generated at the same instant.

There are also fields that the pipeline deliberately omits or simplifies. Some venues offer exotic order book metrics, custom liquidity scores, or proprietary volatility surfaces. The unified API focuses on the fields that are common across most venues and most strategies: price, depth, volume, and basic metadata. If an agent needs a venue-specific advanced metric, it may need to query that venue directly, though this breaks the normalization benefit.

Data availability follows the health of the upstream venue. If a perps venue experiences an API outage, the pipeline cannot fabricate prices. The API will return an error, a stale flag, or omit that instrument from the snapshot. Agents must handle missing data gracefully rather than trading on the last known price. This is why the pipeline includes status flags and timestamps so the agent can judge whether a quote is fresh enough to act upon.

Finally, the unified layer adds a small amount of processing time. For most agents making decisions on a human or near-human timescale, this latency is negligible. For agents pursuing sub-second arbitrage, the extra hop may be material. Those agents typically need co-located direct feeds rather than a normalized API. The unified pipeline is designed for strategy portability, not for latency-minimal HFT.

How should developers think about latency and consistency?

Different market types operate on different clocks. Stocks have pre-market, regular, and after-hours sessions with scheduled halts. Crypto trades continuously. Prediction markets may pause near resolution or during low-liquidity periods. Options have their own market hours and can experience volatility skew that updates faster than the underlying. An agent consuming a unified feed must respect these rhythms rather than treating all markets as always-on, always-liquid.

Developers should use the timestamp provided by the API, not the agent's local system clock, to measure data age. The pipeline normalizes all timestamps to UTC, but the actual measurement of staleness depends on the market type. A ten-second delay is routine for a prediction market quote during a quiet afternoon. A ten-second delay for a crypto perp quote during a volatile event might signal a feed problem.

Consistency across related markets is another concern. An options price is derived from the underlying stock or crypto price. If the pipeline polls the underlying every five seconds but the option chain every ten seconds, the agent might see an option price that implies a volatility surface inconsistent with the latest underlying print. The pipeline does not guarantee cross-instrument synchronization. Agents that trade spreads or hedges must either tolerate small misalignments or implement their own cross-checking logic.

For streaming, the API supports both REST snapshots and MCP tool calls. REST is suitable for agents that check conditions periodically. MCP tools allow Claude, Cursor, or other clients to pull data as part of a reasoning loop. Neither method guarantees websocket-level push latency, but both provide structured data that fits naturally into an agent's context window. What changes when you take your first AI trading agent live discusses why live data behavior often diverges from backtest expectations once these real-world timing quirks appear.

How do you connect an agent to the normalized pipeline?

Agents connect through MCP tools or the REST API. The exact request schema is in the docs at /docs; the shape looks like this.

{
  "symbol": "EXAMPLE_SYMBOL",
  "market_type": "stock",
  "price": 150.00,
  "currency": "USD",
  "bid": 149.95,
  "ask": 150.05,
  "timestamp": "2026-08-19T14:30:00Z",
  "volume_24h": 1200000,
  "order_book": {
    "bids": [[149.95, 100], [149.90, 200]],
    "asks": [[150.05, 150], [150.10, 300]]
  }
}

The API is non-custodial by construction: funds sit in a wallet the owner controls, and the agent can spend within limits but can never withdraw to itself or steal. The API key used for data access can be scoped independently from trading keys. You can grant an agent read-only access to market data while requiring a separate, more restricted key for order execution. This separation is part of the broader safety model where scoped keys, budget caps, and kill switches protect live accounts. How to secure an AI trading agent without giving up custody covers the full key scoping strategy.

When building an agent, start with paper trading to test how the agent interprets normalized fields. The data pipeline serves paper and live environments with the same schema, though paper prices may be delayed or synthetic depending on the venue. The goal is to verify that the agent's logic handles the unified format correctly before it ever sees a real balance. Trading can lose money, including everything, and clean data does not change the risk of the positions an agent takes.

Frequently asked questions

Frequently asked questions

Does the API provide real-time or delayed data?

The API provides data as close to real-time as the upstream venues allow. Some feeds are true streaming, while others are near-real-time snapshots. The timestamp and a freshness flag on each response tell the agent exactly how old the data is.

Can the agent trade directly through the same API that provides data?

Yes. The same API serves both normalized market data and order execution. However, you should use separate scoped keys for reading data and placing trades. This limits the blast radius if an agent key is compromised or misused.

What happens if one venue's feed goes down?

The pipeline marks that instrument as stale or returns an error for the specific venue. Other markets continue to update normally. The agent should check status flags before trading rather than falling back to cached prices.

Does normalization change the actual prices or quantities?

No. Normalization changes the format and unit of presentation, not the underlying value. A price of one hundred fifty dollars is still one hundred fifty dollars. The API handles contract math and precision so the agent sees consistent numbers.

How does the API handle prediction market odds formats?

The API converts whatever format the venue uses into a straightforward probability or dollar payout price. The agent receives a number between zero and one, or a dollar amount, plus metadata about the resolution date and liquidity.

Is historical data available through the same pipeline?

The primary pipeline focuses on current market data and recent snapshots. Historical bars and trade history are available through related endpoints, but the exact coverage and granularity depend on the venue. Check the docs for historical schema details.

Give your agent a key.

One key to trade stocks, crypto, perps, options, and prediction markets. Live after owner authorization.

Keep reading

Not a brokerage, exchange, or investment adviser. Not investment advice. Trading involves risk, including total loss.