Skip to content
All library documents

Resampling Tick Data into OHLC Bars with Pandas

Article QuantInsti blog

Summary

This tutorial shows how to turn transaction-level tick data into open, high, low, and close values for fixed time intervals using Pandas resampling. A tick represents an individual trade, with the example dataset containing timestamps, last traded prices, quantities, and exchange identifiers. The described workflow is to load the data, set its timestamp as the index, and aggregate it into time-based OHLC bars. The example uses Bitcoin transactions and a 15-minute interval, while the article also mentions finer time units.

Aggregated bars make price movement easier to inspect than a stream of individual trades and can serve as input for charting, technical indicators, risk calculations, or backtesting. The method is a data-preparation step rather than a trading strategy, and the article reports no tests of its accuracy or resulting trading performance. Bar interval choice changes the information retained: aggregation removes within-bar sequence and detail, so researchers should match the interval to their analysis and take care with timestamp handling and any bid or ask data they combine.

Key ideas

  • Each tick records an individual transaction, while an OHLC bar summarizes trades over a chosen time interval.
  • Pandas resampling can aggregate timestamped trade prices into open, high, low, and close values.
  • The example converts Bitcoin tick data into 15-minute bars.
  • The chosen bar interval affects how much intraperiod detail is retained.
  • OHLC data can support charting and further analysis, but conversion alone does not produce or validate a trading signal.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.