Documentation

BAR6 Format

partiqon's binary data format for efficient, transparent storage and retrieval of market data. Designed for speed, compact storage, and no vendor lock-in.

Overview

BAR6 is an open, documented binary format for storing historical market data. It supports both bar data (OHLCV) and raw tick data, with bid/ask information. Unlike proprietary formats, BAR6 is fully documented and designed to be read by any tool.

File Structure

Every BAR6 file starts with a binary header, followed by records:

[Header (24 bytes)] [Record 1] [Record 2] ... [Record N]

Header (24 bytes)

OffsetSizeTypeFieldDescription
04uint32magic0xB16B4246 ("BAR6" in little-endian)
41uint8versionFormat version (1 = current)
51uint8data_type0 = bar, 1 = tick
61uint8timeframe_minutesAggregation period (e.g., 5 = M5)
733stringsymbolNull-terminated instrument name

Bar Record (44 bytes each)

Each bar contains open, high, low, close prices and volume:

OffsetSizeTypeFieldDescription
08int64timestampUnix milliseconds
88doubleopenOpening price
168doublehighHighest price in bar
248doublelowLowest price in bar
328doublecloseClosing price
404uint32volumeNumber of ticks

Tick Record (34 bytes each)

Each tick record contains a bid, ask, and volume:

OffsetSizeTypeField
08int64timestamp (Unix milliseconds)
88doublebid
168doubleask
244uint32bid_volume
284uint32ask_volume

Converting Your Data

Use DataConvert to convert your historical data (CSV, MT4 .hst) into BAR6 format. DataConvert runs locally on your machine — your raw data never leaves your PC.

Why BAR6?

Reading BAR6 Programmatically

BAR6 is simple enough to read in any language. Here's Python pseudocode:

import struct with open('data.bin', 'rb') as f: # Read header magic, version, data_type, tf, symbol = struct.unpack('IBBx33s', f.read(40)) # Read bars while True: record = f.read(44) if not record: break ts, o, h, l, c, v = struct.unpack('dddddI', record) # Process bar...