_Backtesting_

# Backtesting & Strategy Simulation With Historical Stock Market Data

A backtest is only as realistic as the data behind it. OHLCV can show where prices opened, traded, and closed, but it compresses the activity that happened within each period.

FinFeedAPI provides T+1 historical OHLCV and market metadata across 40+ exchanges, with detailed Native IEX historical microstructure data for supported symbols and dates. Researchers can use supported Native IEX trades, quotes, order book events, and exchange-level context to evaluate strategies beyond simplified candle-based assumptions.

- [Explore Stock API](/products/stock-api)
- [View Stock API Documentation](/products/stock-api/docs)

## Most Backtests Simplify the Market

A strategy can perform well against historical candles and behave very differently when liquidity, spreads, order flow, trading sessions, and market events are considered.

Simplified historical datasets remove many of these conditions. As a result, assumptions about when a strategy could trade, what liquidity was visible, and what was happening around a signal may be more optimistic than the historical market activity supports.

## Biggest Pain Points

### Backtests rely on oversimplified price data

OHLCV compresses many individual market events into a small number of values. Intraperiod activity disappears.

### Order execution is assumed

Simple simulations often assume that a trade could execute at the observed price without examining the bid, ask, displayed liquidity, or order book conditions.

### Liquidity changes are difficult to model

Volume alone cannot show where displayed liquidity was available or how it changed across price levels.

### Market timing can be inaccurate

Session boundaries and changes in market state can affect when a strategy should be evaluated or allowed to act.

### Trade conditions are ignored

Odd lots, extended-hours trades, trade breaks, crosses, and other conditions may need to be identified rather than treated as equivalent observations.

## A Candle Shows the Outcome. Not the Market Conditions Behind It.

Suppose a strategy generates a buy signal during a historical session.

OHLCV may tell you the price range and trading activity within that period. But depending on the strategy, that may not be enough to evaluate what happened next.

A more detailed backtest may need to investigate:

- What was the best bid and ask?
- How wide was the spread?
- How much displayed liquidity was available?
- How was liquidity distributed across price levels?
- How did the order book change around the signal?
- What trades occurred during that period?
- Was the exchange within regular market hours?
- Was the symbol affected by a halt, auction, or status change?

Historical microstructure data does not guarantee that a hypothetical order would have received a particular fill. It does, however, provide substantially more information about the historical conditions surrounding the strategy.

## How Does FinFeedAPI Solve It?

### Test Beyond OHLCV

FinFeedAPI provides T+1 historical OHLCV through a standardized interface across 40+ exchanges. For workflows requiring deeper exchange-level analysis, supported Native IEX historical datasets add trades, Level 1 quotes, Level 2 price levels, Level 3 order book events, system events, and administrative messages.

### Add Historical Liquidity Context

Native IEX Level 1 data provides best bid and ask information, while Level 2 provides displayed liquidity across price levels. Strategies that depend on spreads or available depth can incorporate this historical context rather than relying only on price and volume proxies.

### Examine Order Book Activity

Native IEX Level 3 data provides individual order book events, including supported additions, modifications, deletions, executions, and book-clearing events. This enables more detailed research into how the observed book evolved around strategy signals and historical trades.

### Align Backtests With Exchange Timing

Native IEX system events provide context such as start and end of messages, system hours, regular market hours, and session-state transitions. Administrative messages separately provide symbol-level information including trading status, auctions, operational halts, official prices, and other relevant events.

### Identify Different Trade Conditions

Native IEX historical trades include flags for conditions such as odd lots, extended hours, intermarket sweeps, trade breaks, trade-through exemptions, and single-price crosses. Backtesting pipelines can use these fields to filter, label, or separately analyze different types of historical trades.

### Build Repeatable Historical Data Workflows

REST and JSON-RPC provide structured access to historical Stock API resources. Instead of building each strategy test around differently formatted source data, teams can create repeatable retrieval and preprocessing workflows using standardized FinFeedAPI resources.

## What Can You Test With Historical Stock Market Data?

### Test Signals Against Historical Spreads

A strategy may generate a profitable signal based on historical prices while the observed bid-ask spread makes the opportunity less attractive. Native IEX Level 1 data allows researchers to examine spread conditions around historical signals.

### Analyze Available Market Depth

For strategies sensitive to liquidity, Native IEX Level 2 data can be used to examine displayed size across multiple price levels. Researchers can investigate whether the historical book was deep or thin around the periods when a strategy wanted to trade.

### Study Order Book Changes Around Signals

Native IEX Level 3 events can be used to analyze how individual orders and the displayed book changed before and after a strategy signal. This is particularly useful for research where order flow and short-term liquidity behavior matter.

### Separate Regular and Extended-Hours Activity

Trade-condition information and exchange-session context can help researchers distinguish different trading periods rather than automatically treating all observations as equivalent.

### Account for Halts and Auctions

Administrative messages can identify historical trading-status changes, auctions, and operational halts. A backtest can use this context when determining whether unusual historical periods should be treated differently.

### Compare Simple and Microstructure-Aware Tests

Teams can run a strategy using OHLCV and then perform deeper analysis on supported Native IEX periods using trades, quotes, and order book information. Differences between the two can reveal where simplified assumptions have the greatest effect on the strategy.

## Choose the Historical Detail Your Strategy Needs

Not every strategy requires order-level data. FinFeedAPI allows teams to work with different levels of historical detail depending on what they are testing.

| Data | What It Provides | How It Helps Backtesting |
| --- | --- | --- |
| OHLCV | T+1 historical price and volume series across 40+ exchanges | Signal generation, historical analysis, traditional backtesting |
| Market Metadata | Exchange and symbol information | Dataset discovery and consistent instrument identification |
| Trades | Individual historical trades and supported condition flags | Trade-level analysis and filtering |
| Level 1 | Best bid, best ask, and associated sizes | Historical spread and top-of-book analysis |
| Level 2 | Displayed liquidity across price levels | Depth and liquidity analysis |
| Level 3 | Individual order book lifecycle events | Detailed order-flow and book-evolution research |
| System Events | System hours, regular market hours, message boundaries, and session-state transitions | Aligning tests with exchange-session context |
| Administrative Messages | Trading status, auctions, operational halts, official prices, and other symbol-level information | Adding context around interruptions and unusual periods |

OHLCV and market metadata extend across broad Stock API coverage. The detailed trades, Level 1, Level 2, Level 3, system events, and administrative messages described here are Native IEX historical microstructure datasets for supported symbols and dates.

## From Price-Based Backtests to Deeper Historical Simulation

| What the Workflow Needs | Before | With FinFeedAPI |
| --- | --- | --- |
| Historical price data | OHLCV from separate or inconsistent sources | Standardized T+1 historical OHLCV across 40+ exchanges |
| Intraperiod activity | Hidden inside aggregated candles | Native IEX trades and quotes provide additional event-level context |
| Spread conditions | Spread may be ignored or estimated | Native IEX Level 1 provides historical bid/ask observations |
| Liquidity awareness | Liquidity inferred mainly from price and volume | Native IEX Level 2 provides displayed liquidity across price levels |
| Order book behavior | Not represented in candle-based tests | Native IEX Level 3 provides individual order book events |
| Market sessions | Session timing may require separate logic or data | Native IEX system events provide exchange-session context |
| Special trades | Trades may be treated as equivalent | Trade-condition flags allow supported trade types to be identified and filtered |
| Market interruptions | Unusual periods may appear as gaps or anomalies | Administrative messages provide context around halts, auctions, and trading-status changes |

## Access Historical Data for Strategy Research

Different backtesting systems need different ways to retrieve historical data.

### REST API

REST works well for targeted historical requests, research scripts, strategy development, and applications that control their own data retrieval logic.

Teams can request the historical resources needed for a specific symbol, date, or analysis rather than maintaining separate integrations for each dataset.

### JSON-RPC

JSON-RPC provides structured access for supported historical stock workflows.

It can be integrated into automated research and backtesting infrastructure where RPC-style requests fit the architecture.

### Stock Historical MCP

FinFeedAPI also provides a hosted Stock Historical MCP server.

Supported MCP tools can be used for exchange and symbol discovery, historical OHLCV retrieval, and supported Native IEX historical resources, making them available to compatible AI-assisted research and tool-using workflows.

## Don't Stop at “The Strategy Would Have Bought Here”

A simple backtest might say:

The signal triggered at 10:32. The historical price was $X. Buy.

A deeper historical workflow asks:

What were the observed market conditions around 10:32?

- What were the bid and ask?
- What displayed size was available?
- How deep was the book?
- How was the book changing?
- What trades were occurring?
- Was the exchange within regular market hours?
- Was there a trading-status change, auction, or halt?

The goal is not to claim that historical data can perfectly reconstruct a hypothetical fill.

It is to replace unnecessary assumptions with more evidence about the historical conditions in which the strategy would have operated.

## Test Strategies Against More Than Historical Prices

Start with T+1 historical OHLCV and go deeper when your strategy depends on spreads, liquidity, order flow, trade conditions, or exchange state.

FinFeedAPI combines broad historical stock coverage with detailed Native IEX microstructure datasets for supported workflows, giving research teams more information to evaluate strategies under historical market conditions.

- [Explore Stock API](/products/stock-api)
- [View Stock API Documentation](/products/stock-api/docs)