// projects / case-study · 06

CB Trading
Journal.

Personal trading-data ETL — pulls trades from Coinbase and Robinhood APIs, normalizes into a single Postgres schema, and surfaces P&L plus position analytics on top.

// type
personal · WIP
Status: work-in-progress — repo is rough, cleanup in flight.
// 01 / problem

Two brokerages, one ledger.

Coinbase and Robinhood each have their own API, schema, and quirks. Anyone trading on both ends up reconciling spreadsheets by hand. The goal: pull both into one Postgres warehouse and treat it like any other operational data — clean, queryable, joinable.

// 02 / approach

Normalize the schema, lean on SQL for analytics.

Extract from each broker's REST API, transform into a unified trades + positions schema in PostgreSQL, then build SQL views on top for realized/unrealized P&L, position-size weighting, and time-windowed returns.

  • Per-broker extractors handle API auth, pagination, rate limits
  • Normalized schema isolates broker quirks from analytics queries
  • Daily refresh job catches new trades incrementally
// 03 / stack

Stack.

Python Coinbase API Robinhood API PostgreSQL SQL