DATA RESEARCH

Real-Time Market Data Pipeline

A Python workflow for collecting streaming market observations, preparing structured datasets, and running offline machine learning experiments.

DATA PROCESSINGWORKFLOW
01CollectAsync WebSocket ingestion
02StructureParse, clean, and order records
03StoreParquet + Snappy
04EvaluateFeatures and offline backtests

Architecture overview · no live market feed

170Tickers in the recorded dataset
14 GB → 1.3 GBRaw logs to Parquet
≈90.7%Reported storage reduction

01 / OVERVIEW

Project overview

Objective

Turn timestamped order-book observations into consistent datasets for feature calculation and offline model evaluation.

My work

Built asynchronous collection and data-processing stages, handled incomplete records, and prepared features and time-aligned labels for XGBoost experiments and backtesting.

  • Python
  • asyncio
  • WebSockets
  • Parquet
  • Snappy
  • XGBoost

02 / WORKFLOW

Streaming observations to datasets

  1. 01

    Ingest

    Receive timestamped observations with asynchronous Python WebSockets.

  2. 02

    Separate writes

    Use an in-memory queue to separate reception from append-only disk writing.

  3. 03

    Clean and transform

    Handle missing order-book values and malformed records, sort by timestamp, and convert to Parquet.

  4. 04

    Build features

    Calculate mid-price, spread, order-book imbalance, micro-price, and temporal features.

  5. 05

    Label and evaluate

    Align five-minute prediction labels and run offline XGBoost classification and backtests.

03 / PROJECT RESULTS

Collection and storage

AreaDocumented result
CollectionRecorded Indonesian stock-market data covering 170 tickers.
TransformationConverted 14 GB of raw logs into 1.3 GB of Parquet data using out-of-core processing and Snappy compression.
Data preparationHandled incomplete records and sorted historical data by timestamp.
Offline evaluationBacktested XGBoost models using bid/ask execution prices and trading costs.

These results describe data collection and processing. They do not establish validated prediction accuracy or trading profitability.

04 / RESEARCH CONSIDERATIONS

Time ordering and evaluation

Preventing future information leakage

Time ordering, symbol boundaries, and feature availability matter when building predictors. Time-based validation must account for overlapping label horizons.

Operational validation

Queue capacity, shutdown behaviour, and persistence guarantees require separate validation. The documented architecture does not by itself establish production reliability.

05 / PUBLIC MATERIALS

Repository scope

The public repository contains architecture documentation, a fictional input-symbol list, and an ingestion dependency reference. The full implementation and datasets remain private because they include broker-specific access procedures and session handling.

Read the project documentation

REFERENCE MATERIAL

Explore the full project

More detail is available in the original repository.

View GitHub documentation