DEV Community

Cover image for Free fintech data engineering lab: find a missing dollar with Python + SQLite
Anton Gameza
Anton Gameza

Posted on Fully Autonomous

Free fintech data engineering lab: find a missing dollar with Python + SQLite

Free and open source: 100 English lessons, 40 foundation exercises, and 8 scenario labs for fintech data engineering. The repository's lessons and core practice are available without payment or a signup wall. Clone it and start locally with Python 3.12+ and SQLite: no paid cloud account or API key is needed.

I maintain this learning project. This walkthrough uses six synthetic payment events to show why a balanced journal can still disagree with an external settlement.

Three checks that answer different questions

Idempotency: if a delivery is repeated, do we count the same business event twice?

Journal balance: do the signed entries for each event and currency add up to zero?

Reconciliation: does our internal expected amount agree with an independently supplied settlement record?

None of these checks replaces the other two. A balanced pair of entries can faithfully record an incorrect amount. A replay-safe pipeline can faithfully reproduce that incorrect amount every time.

Run the experiment

Use Python 3.12 or later with SQLite support. From a terminal:

git clone https://github.com/antony502189-max/fintech-data-engineering-roadmap.git
cd fintech-data-engineering-roadmap
python -m fintech_lab.quickstart
Enter fullscreen mode Exit fullscreen mode

On Windows, use py -3 instead of python if necessary.

Every run starts with a fresh in-memory SQLite database and writes no files. The first delivery inserts six events; repeating the delivery inserts zero and recognizes six duplicates. The journal check passes.

Reconciliation still produces two exceptions:

Payment Currency Expected minor units External minor units External minus expected Result
p1 USD 7700 7700 0 matched
p2 EUR 4900 4900 0 matched
p3 USD 2500 2400 -100 amount mismatch
p9 USD unknown 500 unknown unexpected external payment

Explain the dollar before fixing the code

For p1, capture minus fee minus refund is:

10000 - 300 - 2000 = 7700 USD minor units
Enter fullscreen mode Exit fullscreen mode

For p3, the internal record expects $25.00, but the external settlement reports $24.00. The difference is negative 100 USD minor units: a $1.00 shortfall.

For p9, there is no corresponding internal payment. Its expected amount is unknown, so the difference is unknown too. Treating that missing value as zero would hide the distinction between a known zero balance and a payment we cannot explain.

USD and EUR are kept separate throughout. Adding them together would not produce a meaningful monetary total.

Change one input and predict the result

In the repository's fintech_lab/synthetic.py, find p3 inside settlement() and change its net_minor from 2400 to 2500.

Run the quickstart again. p3 should now match. p9 should still be unexpected. Repairing one amount does not explain an unrelated external payment.

Restore 2400 afterward: the repository's tests expect the original deliberate defect.

You can also keep the full database and report for inspection:

python -m fintech_lab --out work/article-demo
Enter fullscreen mode Exit fullscreen mode

That command writes warehouse.db and report.json and includes historical customer tiers and late-event feature examples. Use a new output directory for a clean run: unlike the in-memory quickstart, this version retains its database.

Where to go next

If the example is useful, the repository includes 100 English lessons, 40 foundation exercises, and 8 scenario labs. C07 is a SQL bug hunt about join fan-out; C06 covers backup recovery; C08 covers feature availability and delayed labels.

Start with the first-win walkthrough, or browse the repository.

The goal is to produce an explanation backed by code and checks, rather than only read a roadmap. If this helps you learn or teach, a voluntary GitHub star is appreciated. A reproducible edge case is even more useful feedback.

Scope and disclosure: I maintain the linked project. Its first edition and this article were prepared with AI assistance using Codex. The data is synthetic, and the signed journal is a simplified teaching model, not a production banking system. The repository documents its provenance and limitations.

Which reconciliation edge case would you add next: a partial refund, an unmatched fee, or a late settlement adjustment?

Top comments (0)