Reconcile Internal Trades Against Counterparty Confirmations in Pandas

Last updated: November 29, 2026

Quick Overview

Given an internal trade booking extract and a counterparty confirmation file, produce one row per trade reference labeled as matched, missing on either side, or broken on amount, value date or currency, with the amount difference.

Citi
Data Manipulation (SQL/Python)
Data Engineer
Citi
November 29, 2026
Data Engineer
Take-home Project
Data Manipulation (SQL/Python)
Medium

0

0

0 solved


Given an internal trade booking extract and a counterparty confirmation file, produce one row per trade reference labeled as matched, missing on either side, or broken on amount, value date or currency, with the amount difference.

Operations teams in Citi's markets and securities services businesses spend real money chasing reconciliation breaks, and automated matching is a core data engineering deliverable. The exercise checks outer joins, explicit break precedence, tolerances, and whether the output is something an operations analyst can act on.

What the Interviewer Expects
  • Use an outer merge with an indicator column
  • Separate missing-side rows from field breaks
  • Apply an amount tolerance instead of exact float equality
  • Define precedence when several fields break
  • Return a tidy, sorted break report
  • Discuss duplicate references and normalization
Key Topics to Cover
pandas merge
reconciliation
data quality
tolerances
operations
How to Approach This
  1. Clarify the schema and expected output format before writing queries.
  2. Use CTEs (WITH clauses) to break complex queries into readable steps.
  3. Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
  4. Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
  5. For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
  • What if a trade reference appears twice on one side?
  • How would you match when references differ but economics agree (fuzzy matching)?
  • How would you track break aging across days?
  • How would you scale this to 50 million rows?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice SQL Problems
Sample Answer
Clarify the Data

Both files have trade_ref, notional, ccy, value_date. I assume trade_ref is unique per side (I would assert it), notionals are in the trade currency, and value dates are already parsed. Tolerance ...

Approach
  1. Outer merge on trade_ref with indicator=True.
  2. left_only means we booked it and the counterparty did not confirm; right_only is the opposite, and often the more urgent since it may be a t...

Submit Your Answer
Markdown supported

Related Questions