#!/usr/bin/env python3 """Convert a tick parquet file into the raw test format: little-endian records of (int64 time_msc, double bid, double ask), 24 bytes each. usage: to_ticks.py input.parquet output.ticks [point_scale] If point_scale is given, integer price columns are divided by it (Dukascopy layout). """ import os import struct import sys sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) from parquet_mini import read_parquet # noqa: E402 def main(): src, dst = sys.argv[1], sys.argv[2] scale = int(sys.argv[3]) if len(sys.argv) > 3 else 0 cols, leaves, nrows = read_parquet(src) names = [l[0] for l in leaves] ts = cols['timestamp'] if 'bid' in names: bid, ask = cols['bid'], cols['ask'] else: bid, ask = cols['bid_price'], cols['ask_price'] out = bytearray() pack = struct.Struct('