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
November 29, 20260
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
How to Approach This
- Clarify the schema and expected output format before writing queries.
- Use CTEs (WITH clauses) to break complex queries into readable steps.
- Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
- Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
- 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 ProblemsSample 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
- Outer merge on
trade_refwithindicator=True. left_onlymeans we booked it and the counterparty did not confirm;right_onlyis the opposite, and often the more urgent since it may be a t...