Live data from Hacker News

Fintech engineering mistakes (2022)

startupwin.kelsus.com

21–30 of 112 posts

Re: Fintech engineering mistakes (2022)

#21
I’d also add:

— If you’re using JSON to pass around monetary quantities (eg. from the frontend to the backend), put them in strings as opposed to the native number type. You never know what the serializers and deserializers across languages will do to your numbers (round them, truncate them etc.).

— Start recording the currency of the transactions as early as possible. It can be a separate column in your table.

— Use TIMESTAMPTZ. Always.

Re: Fintech engineering mistakes (2022)

#22

One more: Timezones Various platforms use: UTC, the user’s timezone as set in their dashboard, the user’s detected timezone, the timezone of the server that is generating the reports. Aggregating or reconciling data from different platforms can be a pain if the timezones aren’t clearly indicated. I’ve had bank statements that didn’t agree to CSV exports of the same data because the servers generating the two reports…

Haha yeah for the past tax year I I looked at my transaction history and it was missing some that I expected to be there. Turns out, the exchange (Gemini, for crypto) uses UTC, but the IRS docs always tell you that a cutoff is relative to your own time zone.

The transactions were in the late evening on New Year's Eve, central US time, but that was already the next year by UTC, so any readout of "transactions for 2022" would not include them.

[1] e.g. https://www.irs.gov/taxtopics/tc301

Re: Fintech engineering mistakes (2022)

#24
post #5

This is a great little article, and I can't emphasize what a big deal #2 is.

Some folks will laugh at this advice.

Others (like me) will cry because we know of multibillion-dollar fintechs that still struggle with this.

The one I'm thinking of didn't even have cents for a long time. After a pretty heroic migration effort they added cents. And they did it properly. But within weeks folks were using floats all over the place for money, leading to flaky tests and all kinds of other errors.

Re: Fintech engineering mistakes (2022)

#25
post #2

You can absolutely use doubles for money. Excel does it and so do many other financial tools. There are pros and cons but as long as you do rounding and comparisons correctly it works perfectly fine.

If you want a simple real life example (unconnected to the way numbers are stored) here it is (accounting may have quirks that arrive unexpected).

In EU prices to customers are required to be comprehensive of VAT, so a price is € 60,00 included VAT 10%.

But in an invoice/receipt you have to explicit how much is the net and how much is the tax, so 60 / 1.10 = 54.55 and VAT is 54.55 x 0.10 = 5.46 which makes a nice 60.01.

You may be tempted to round down the 60 / 1.10 = 54.54 and have VAT 54.54 x 0.10 = 5.45 but this makes 59.99.

Re: Fintech engineering mistakes (2022)

#26
post #21

I’d also add: — If you’re using JSON to pass around monetary quantities (eg. from the frontend to the backend), put them in strings as opposed to the native number type. You never know what the serializers and deserializers across languages will do to your numbers (round them, truncate them etc.). — Start recording the currency of the transactions as early as possible. It can be a separate column in your table. — Use…

I'm generally not a fan of overloading fields, but we took the opportunity to add the currency code when we decided to encode monetary quantities in JSON as strings, e.g. "0.02USD". This has worked well, particularly because we use a money handling library that parses it unchanged.

Re: Fintech engineering mistakes (2022)

#27
And that's why I shall be sticking to cash for the next 10 years till all the beta testing is complete.

By which time hopefully interest bearing CBDCs will show up, and make all these mindless intermediaries sitting between my wallet and someone elses wallet obsolete.

Re: Fintech engineering mistakes (2022)

#28
post #2

You can absolutely use doubles for money. Excel does it and so do many other financial tools. There are pros and cons but as long as you do rounding and comparisons correctly it works perfectly fine.

What do you mean by "correctly"? It sounds like victim blaming. For money, I don't think it's perfectly fine to use numbers where this isn't true.

    0.1 + 0.2 

Re: Fintech engineering mistakes (2022)

#29
post #7

Earlier quoted context omitted.

If Excel uses doubles for money, it should be a warning sign. It uses simple numeric data type (I guess just ints) for freaking dates.. I can trace at least a couple of bugs in my career to just that fact.

Apart from its quirks Excel is fine, if you know its limitations. I think the real warning sign would be an analyst/programmer working with Excel and expecting high precision results.

I find Excel to be fine as long as I never use it.

Re: Fintech engineering mistakes (2022)

#30
post #5

This is a great little article, and I can't emphasize what a big deal #2 is.

Some folks will laugh at this advice. Others (like me) will cry because we know of multibillion-dollar fintechs that still struggle with this. The one I'm thinking of didn't even have cents for a long time. After a pretty heroic migration effort they added cents. And they did it properly. But within weeks folks were using floats all over the place for money, leading to flaky tests and all kinds of other errors.

JPY has entered the room
Post reply on HN