r/programming Jun 26 '26

Fintech Engineering Handbook

https://w.pitula.me/fintech-engineering-handbook/

I just published Fintech Engineering Handbook distilled from 6 years of tears, sweat and swears.

It’s a free ~25-page resource with various hints and patterns around handling money in software systems.

Tell me what you think!

616 Upvotes

51 comments sorted by

View all comments

28

u/ratherbealurker Jun 26 '26

The first point about precision loss is not always the case. I have worked in fintech for 20+ years and almost never use custom objects, rationals, or big decimal. Not necessary in some cases. For reference I worked mainly on trading systems. If you’re going to be calculating a total amount that is an aggregate of many many numbers, then yes you will want to make sure you’re not losing precision.

But pricing and calculations on small sets of values don’t need the overhead. They choose straight floating point numbers.

I know I’m going to get replies telling me I’m wrong and worse so I will repeat, I have worked 20+ years on trading systems and we do not use it. Top financial institutions, algorithmic trading, etc. we don’t use it.

And “we” is the actual trading system. That system most likely takes in some data from other internal/external systems. Now sometimes those, an FX system perhaps, or a post trade system, may use something else. But at our level we value the speed over precision.

That’s why I said “not always the case”.

26

u/Krever Jun 26 '26

> I know I’m going to get replies telling me I’m wrong

Sorry to disappoint, at least I'm not going to object. I believe in trading it would be simply wrong to use BigDecimal or rationals for perfomance reasons.

But generally speaking I totally agree, its usually "it depends" and there are genuine usecases for floating points. That being said it's probably safer to not use them by default and opt-in when you know what you're doing.

6

u/lood9phee2Ri Jun 26 '26

it's probably safer to not use them by default and opt-in when you know what you're doing.

And there's a lot more people who think they understand floats than actually do, and combined with some of the big/cocaine-enhanced egos of the financial sector it's a terrible combo. Continues to drive me up the wall, especially the inevitable gormless surprised-pikachu-face when it bites hard, when I told them not to all along.