Urgent.News

What's breaking now, across thousands of outlets.

Tech

Splitting a multi-account Chime statement into one ledger per account, in Python

A Chime statement PDF can hold more than one account, so a parser has to split it by section before it adds anything up. Each section gets its own beginning balance, rows and ending balance, and each one is proven on its own. ZeraBooks does this when it converts a Chime statement: it reads every section as a separate account. Here is the same idea in about 40 lines of Python. (I founded…

Chime statements can contain multiple accounts, so they need to be split into separate ledgers to ensure accurate financial tracking. This is achieved by identifying the section titles at the beginning of each account, which mark the start of a new account's data. The Python code provided demonstrates how to parse a sample Chime statement into two accounts: Checking and Savings.

It uses regular expressions to identify section titles, beginning and ending balances, as well as individual transaction rows containing the transaction date, description, and amount. The amounts are converted to Decimal objects for precise calculations. To verify the split, the code calculates the sum of the rows for each account and compares it to the difference between the beginning and ending balances.

If the two match, the split is successful; if not, there is a mismatch. The example provided shows that the total of the transactions in the Checking account (1,317.50) and the difference between the beginning and ending balances (76.99) match the printed ending balance (999.41). Similarly, for the Savings account, the total of the transactions (250.00 + 1.18) matches the difference between the beginning and ending balances (251.18).

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

The Half-Life of an x402 Listing

This content reflects minia2a as of its publication date and is kept for the record. Current model: x402 pay-per-call in USDC on Base only , 5 free trial calls per signed wallet , no credits and no…

More from Saturday 7 November →