Skip to main content
18 votes
Accepted

Are bank transactions run with DB transactions?

Bank transactions are based on Double-entry bookkeeping. That means that account balances are derived, not stored or manipulated directly. Basically, every transaction is stored as a record saying "...
Michael Borgwardt's user avatar
12 votes

What are some approaches used in financial applications to prevent deposit/withdrawal sync problems?

Transactions A transaction wraps all of the required steps for a particular business operation and guarantees that either all of the steps succeed or they all rollback to the original state in the ...
Robert Harvey's user avatar
9 votes
Accepted

How are account balances persisted

Most commercial accounting software store the account balance, sometimes with the account, but most often in periodic tables (per year or per month). The technical point of view There are several ...
Christophe's user avatar
  • 79.9k
7 votes

Are bank transactions run with DB transactions?

"The real world of multi-business financial transaction processing" is always that there are many entirely-disconnected systems in place. "SQL transactions" therefore can never cover this.
Mike Robinson's user avatar
5 votes
Accepted

Loan Amortization Schedule - Precision and rounding

This is not a rounding error, but a wrong application of financial formulas. The formula used for your loan payment is based on financial math designed for a periodic payment with an interest ...
Christophe's user avatar
  • 79.9k
4 votes
Accepted

Designing distributed invoice number counting system

Indeed, many countries around the world, enforce a legal requirement to use sequential numbering for invoices. The aim is to reduce tax fraud: non-reported invoices (potential tax evasion) are easy ...
Christophe's user avatar
  • 79.9k
4 votes

Designing distributed invoice number counting system

You can't distribute an incremental counter practically by definition. (as Steve points out) And as you point out there is a legal requirement for invoices to have an incrementing counter. However, I ...
Ewan's user avatar
  • 78.5k
4 votes
Accepted

BigDecimal for Calculation with and Display of Stock Shares and Prices?

No double will not meet your needs. If it wasn't for needing to do calculations String would best meet your needs. That leaves BigDecimal. It calculates slower than double but it will faithfully ...
candied_orange's user avatar
3 votes
Accepted

How to handle events representing cross-domain knowledge

Typically, accounts payables and account receivables are sub-ledgers in the accounting context. They register accounting transactions with vendors and customers. Accounting transactions with vendors ...
Christophe's user avatar
  • 79.9k
3 votes

How are account balances persisted

If by "persisted" you mean "stored into a (not necessarily relational) database", then in general you shouldn't store derived values along with the primary values. This is called denormalization and ...
Kilian Foth's user avatar
3 votes
Accepted

Network Topology for ATM and POS Systems

OK here goes for the quick explanation on a very complex subject. Before we start you should be aware that the basic technologies date back to the 1980s where the processing and network technologies ...
James Anderson's user avatar
2 votes

Is there a better approach for mass balances processing

There is really not enough information to answer this question because it depends on an understanding of the worst-case latency requirement, which is not supplied in the question, and would be ...
Erik Eidt's user avatar
  • 34.3k
2 votes

How to automate certains tasks in a web application?

Nothing in your requirements suggests that you need to have a batch run every day. Instead, you need to be able to compute a customer's balance at the moment it is needed: when the user requests his ...
John Wu's user avatar
  • 26.6k
2 votes

What are some approaches used in financial applications to prevent deposit/withdrawal sync problems?

Locks and transactions are not really necessary to deal with such simple cases. You can combine the checking and the update in a single step (or statement in the SQL jargon), guaranteeing an atomic ...
p4f's user avatar
  • 29
2 votes
Accepted

Algorithm for calculating daily profits from user's balance minus deposits

In order to answer your question, you need to model more precisely your domain: If you just compare the daily balance of the account, you will find a 110% increase. But that's not a profit, it's a ...
Christophe's user avatar
  • 79.9k
2 votes

How to handle events representing cross-domain knowledge

Disclaimer For the purpose of the explanation, it's irrelevant whether we consider these bounded contexts as part of the same monolithic runtime or if they're completely separate microservices, their ...
Flater's user avatar
  • 54.8k
2 votes
Accepted

How to create financial reports with detailed information

The idea of your third approach is a step in the right direction: Store the total of the account, for example, at the end of each month, as an additional datum. Now to address your concerns: After ...
Doc Brown's user avatar
  • 211k
2 votes

Handling Back-dated Transactions and "Online" Transactions on ERP/Banking Systems

It's a great question, and one that reveals many of the subtleties about banking that we rarely see here. I can't answer all the questions, but I can say something on a couple which involve ...
Steve's user avatar
  • 10.3k
1 vote

More efficient FIFO inventory calculation?

In short The main challenge in your requirement is the uncertain sequence of outgoing orders, which could arbitrarily change the price. Several financial constraints forbid this to happen in some ...
Christophe's user avatar
  • 79.9k
1 vote

Design patters for handling invoice "payment_status" when split payments are involved

Most important: It’s up to management to decide the rules. A major organisation where I once worked had this rule: if a payment matches one, two or three bills exactly then it is applied to those ...
gnasher729's user avatar
  • 46.7k
1 vote

How are account balances persisted

If you check you bank statements you'll see the first line is usually 'balance carried over from previous month' I suggest you implement a similar 'snapshot' system, where you roll up previous ...
Ewan's user avatar
  • 78.5k
1 vote

What are some approaches used in financial applications to prevent deposit/withdrawal sync problems?

The term you're looking for is "consistency" (or lack of). For real enterprise SW, you would need several patterns to fix this Transactions (plain old transactions). Use either Atomic Updates, or ...
DanielCuadra's user avatar
1 vote

What are some approaches used in financial applications to prevent deposit/withdrawal sync problems?

Consistency With Cassandra or generally and distributed database this is a problem of 'consistency' and 'eventual consistency'. With eventual consistency the accuracy, or reads going out of your db, ...
Ross's user avatar
  • 921
1 vote

How to automate certains tasks in a web application?

Programs are good doing repetitive jobs. Instead of scheduling tasks on a precise date and moment, try scheduling 3 periodic tasks. Task 1: Accounts about to expire Let's say this task is executed ...
Laiv's user avatar
  • 14.8k

Only top scored, non community-wiki answers of a minimum length are eligible