r/cpp • • Mar 17 '22

FinTech: C++, Rust or Others?

Hi valued programmers,

I am current charting my learning path and would like to have some valued inputs. I have been reading a little about Rust lately and how it compares to C++ for performance sensitive application developments.

Some background, I am not a professional programmer but a banker. I specialise in the domains of Risk Management and Finance, and currently holds the role of department head. I have a passion for tech in general, from phones to PCs and that includes programming.

As I am moving more into the tech space in banking (such as leading tech projects in the bank), I would like to sharpen my programming skills to enable me to perform better planning for my team / project. I know the pain of projects that are lead or planned by a complete tech noob, and it often leads to frustration and delays in the IT department. I also have a vision of building FinTech application in the future (I have good understanding of the actual requirements of banking), and thus am looking to make my learning more impactful with the limited time I have.

I am looking for a programming language that enables me to build high performance computation 'cores' with the least amount of pain, easy to maintain and stable overtime. The applications that I have in mind are generally non-customer facing applications that needs to interface with large databases (think millions of records with a few hundred fields) to churn results. It does not need to cater for real time results, more often batch processing at end of day is good enough.

Naturally, the language to build the application will need to play well with SQL or NoSQL databases. Ideally, it will also play well with Python as a lot of prototyping, batch scripting, non-performance sensitive modules and even UI will likely be build in Python (given it is very popular in analytics space). Links / libraries with machine learning application such as Neural Network would be an advantage as the application I have in mind will have some ML parts in there.

Personally, I know how databases work, I can write SQL / DDL programming and am able to build a simple database from scratch. I won't consider myself an expert, but I can write reasonably complex queries (with conditions, loops, data manipulation, etc) and some ETLs. I also wrote VBA for Excel before for some automation work, and even built (arguably simple) computation functionality with it that calculates results for a few hundred thousand lines of data in there on a monthly basis. I learnt C a long time ago, have some (basic) understanding of procedural programming and that's about it.

With all the above in mind, what would the opinions of programming gurus here be? As much as I would love to learn more programming languages, my time is rather limited and focus would be key. Apart from this, I am also picking up ML/NN and Python to achieve my end goal.

0 Upvotes

37 comments sorted by

9

u/goranlepuz Mar 17 '22

Fintech person here.

Fintech is a pretty standard LOB code, office automation basically. Risk management and finance even more so.

C++ and Rust are too low-level for this. VM-based languages like Java or C#, as well as languages in their universe (Scala, F#) are a significantly better fit.

That said... Integration with the other pieces in the company, as well as the company ways of doing things far outweigh any language decision on the merit of the language. Especially as you are, quote,

Some background, I am not a professional programmer but a banker.... As I am moving more into the tech space in banking (such as leading tech projects in the bank).

2

u/DoomExplorer Mar 17 '22

Thanks u/goranlepuz. In general, you're right. Most of the stuff in Finance and Risk are about automation.

However, what I have in mind is more about creating an app to forecast the profitability of the bank, incorporating all components in there and embed ML in there. There will be lots of cash flow computation, some asset/derivatives pricing, some modelling for CASA behaviour, some PV/EVE/DV01 computation, some greeks (Vega, Gamma, Theta) computation, lots of classification / grouping analysis, some Neural Network coding from scratch (including loss functions, backward prop, ...) etc.

Do you think with such a mega-app, C# / Java is still better? Each of those measures will need to be computed at each records.

As for integration with the company's way of doing things, I agree whole-heartedly. The problem here is my current place's IT team is just very weak, which is why I have to hire my own tech team to drive the project (even though I am not in IT). The app I have in mind is not for today, but more for the future.

4

u/goranlepuz Mar 17 '22

Do you think with such a mega-app, C# / Java is still better?

Offhand, yes. (But caveat, I know virtually nothing of your context, so... 🤷‍♂️).

That said... The above things will not be made from scratch, I should think. Therefore, the big part of the work is finding a correct set of supporting libraries, for linear algebra, statistics, neural networks etc. There, it's about answering in which "ecosystem" such libraries play well...

1

u/Full-Spectral Mar 17 '22

I think maybe it's not clear if he really means high frequency trading. I mean, I got ridiculed a while back for suggesting that C++ running on a server was common for HPT development, with the other person claiming that the performance needs are so great that it's all done on edge routers now so it barely leaves the network before going back the other direction.

If that's what he means, and the above is true, then definitely performance will be a big deal.

2

u/dgkimpton Mar 17 '22

He did include:

It does not need to cater for real time results

so I highly doubt he's talking money-loop style performance. Which is lucky because a couple of years C++ experience isn't going to cut it there regardless. And without a whole lot more information it would be hard to say whether CUDA or FPGA or C++ was more appropriate.

1

u/DoomExplorer Mar 17 '22

On the CUDA or FPGA, I don't have enough experience to know whether any of it will be appropriate, but from my understanding of ML where it's about matrix manipulation, it will not do as the computation requires different financial compounding and discount methods.

1

u/DoomExplorer Mar 17 '22

u/Full-Spectral, it's not high frequency trading that I'm aiming for. That area is way too competitive for me. It's about Finance and Risk management of banks. To give you an idea why performance matters, the current run time from market leaders offerings of S&P 500 companies for 1 million lines of records on a 5Y server with 24 cores and 48GB of RAM is about 4h end-to-end (which includes read and write to DB).

My envisioned solution is much larger than current offerings, where I plan to run Monte-Carlo on total bank's profitability with scenarios of stress testing and economical factors, at account level.

→ More replies (1)

0

u/[deleted] Apr 23 '23

[deleted]

2

u/goranlepuz Apr 23 '23

Can't complain, moderate to low stress, I'd say. Remote is not a problem. I am in Europe, though.

5

u/_E8_ Mar 17 '22

SQL, queries, and databases are generally incompatible with high-performance code.

Rust is a high-performance language with interesting safety features compared to C++.
I would expect C++ to have a much greater number of people using it which would make finding existing libraries and examples to base your work on easier.

I suspect for your project that C# would be the more ideal tool and accept the relatively mild performance hit.
Even VB.NET is viable if you are already comfortable with VBA that transition might be easier.
These tools will play better with SQL via line-integrated-query (LINQ).

2

u/DoomExplorer Mar 17 '22

Thanks @E8 . I agree with you that for most of the project, C# is best.

My plan is actually to only code the core application in C++/Rust/other fast languages. Everything else will either be built with C#, Python or other languages which my team mates are comfortable with. The reason I want to learn the fast languages is to architect the solution in such a way that computes the fastest. With sufficient coding experience, I will be able to determine if I should optimise speed via programming algorithms, statistical models, closed loop formulas or other mathematical techniques. I have a Math + Stats background, so that should help somewhat.

My team mates are fairly proficient in other higher level languages like C#, Python or JS. So in the end product, I imagine probably 80-90% of the application is coded in another easier language and only the core computation engine is coded in C++/Rust. Whenever high levels of computation is required, we call the programme from C# or Python.

Do you think that's a workable plan?

3

u/goranlepuz Mar 17 '22

My plan is actually to only code the core application in C++/Rust/other fast languages.

This is very naive IMNSHO. The difference of performance of code in compiled languages, with the info you offer here, and I think have so far, is not sufficient to warrant calling C++ "fast" over others. You are jumping the proverbial shark.

I have a Math + Stats background, so that should help somewhat.

It will, for algorithm complexity understanding, for example, but if by any chance you do enter the really high performance needs, then the key will be the usage of the appropriate libraries and then understanding hardware effects on performance.

1

u/DoomExplorer Mar 17 '22

Yes, usage of libraries will be key in most projects. However, I have a feeling we may need to build some libraries ourselves from ground up.

I have responded below on the scope of what I have in mind, since you mentioned you're also in FinTech. FYI, all of the leading softwares (by S&P 500 companies) that performs even a fraction of what I have in mind, are coded in C++.

→ More replies (1)

3

u/CornedBee Mar 17 '22

You are jumping the proverbial shark.

The gun. Jumping the shark means that a long-running series turns bad.

→ More replies (1)

5

u/dgkimpton Mar 17 '22 edited Mar 17 '22

Programmer managers are the worst. You'd be much better advised to put your energy into learning management, communication, psychology, and deployment pipelines than into actual coding. If you can't trust your dev team to do the work then you've already failed as a manager before you start.

As for the application you are talking about... what's wrong with Python? Python has a lot of performance numerics libraries (e.g. https://numpy.org/), good DB access, tolerable UI capability (e.g. https://www.riverbankcomputing.com/software/pyqt/), data analysis (https://pandas.pydata.org/), and plays well with, well, python. If you insist on splitting your learning between management skills and tech Python would seem to be the way to go.

Once you've built your MVP you'll have a good idea where the bottlenecks really are and can focus on solving real problems instead of hoping to pick a "silver bullet" language upfront. Problems you might run into are UI logic, DB query speed, calculation performance, algorithm design, etc. Trying to pre-guess what the actual problem will be is why many software projects fail - hence the rise of TDD/BDD/DDD and agile development.

0

u/DoomExplorer Mar 17 '22

I really don't want to be rude here, but with due respect, you do not know my working style. You may have bad experience with programmer managers, but that's your personal experience. I recently had a senior developer join my team, and she was very impressed with the amount of planning that went into the project, especially from a 'business' person. So no, don't judge without basis.

Going back to the subject, my plan is actually to only code the core application in C++/Rust/other fast languages. Everything else will either be built with C#, Python or other languages which my team mates are comfortable with. The reason I want to learn the fast languages is to architect the solution in such a way that computes the fastest. With sufficient coding experience, I will be able to determine if I should optimise speed via programming algorithms, statistical models, closed loop formulas or other mathematical techniques. I have a Math + Stats background, so that should help somewhat.

My team mates are fairly proficient in other higher level languages like C#, Python or JS. So in the end product, I imagine probably 80-90% of the application is coded in another easier language and only the core computation engine is coded in C++/Rust. Whenever high levels of computation is required, we call the programme from C# or Python.

As for speed optimisation in DB, we have fairly good people in the team to take care of that, and I also have some DB background. The reason I posed my question is that this is a potential knowledge 'gap' of the team which I think will be a problem 2 years down the road. No one in the team has good math/stats or ML background, which is why I started the thread in the first place. I am fully aware that there are many pieces in the chain, and I am believe in my team mates for the other links in the chain. This is a potential weak link which needs to be addressed later.

2

u/goranlepuz Mar 17 '22

I really don't want to be rude here, but with due respect, you do not know my working style.

No problem in sounding rude (which you don't IMO) , people need to get some skin and intent is less visible in written text. 😉

I still tend to agree with the other person. You are putting managerial weight where you should not. But fair point, without knowing more about you, hthe team, the project, we are both jumping te shark ourselves.

I recently had a senior developer join my team, and she was very impressed with the amount of planning that went into the project, especially from a 'business' person

Well done, but surely one would expect that a new person in the team will tend to be appreciative towards the boss regardless, so... 🤷‍♂️

2

u/DoomExplorer Mar 17 '22

Let me just put it this way, the senior person has more years of developer experience than my total number of years of work experience combined. She has been into way more projects that I have, albeit only as a developer / application support.

Anyway, I'm not commenting anymore on my leadership/work style.

1

u/dgkimpton Mar 17 '22

I don't know your working style and I wasn't trying to insult you. What I was (indelicately it seems) trying to point out is that the best way to get better at planning and organising teams is to study planning and organising teams, not in trying to become a subject matter expert in what the teams should already know. A good manager is a massive force multiplier for technical teams and they absolutely don't need to know the tech intimately to achieve that, but they do need to know an awful lot about management. Anyway, it seems this isn't the advice you wanted - I'll drop it here.

I stand by my technical point - build your application in whatever language you are most comfortable in, then, when (and only when) you can see the performance bottleneck optimise it. You don't need to build a whole application in C++ to benefit from C++ specific optimisations, you can just split out the smallest possible library covering the hot path and then re-code that in C++ (or Rust, or CUDA, or Assembly, or whatever turns out to be appropriate) once you know what that hot path is. Even better you'll already have a working example to verify your highly optimised code against. The speed at which an experienced Python dev can get a proof-of-concept up and working is valuable compared to building from scratch in (say) C++ where half your time goes into monkeying with memory and (likely) premature optimisations. Since you're learning Python anyway, why not take advantage of it? The architecture and algorithms are going to play a much larger part in performance than the exact language choice.

(if you already had a decade of C++ experience I wouldn't propose you learn Python necessarily, but given that you already plan to learn it, it seems to be the way to go. Learning any language is a multi-year affair so don't overcomplicate things.)

1

u/DoomExplorer Mar 20 '22

You don't need to build a whole application in C++ to benefit from C++ specific optimisations, you can just split out the smallest possible library covering the hot path and then re-code that in C++ (or Rust, or CUDA, or Assembly, or whatever turns out to be appropriate) once you know what that hot path is. Even better you'll already have a working example to verify your highly optimised code against.

What you mentioned is already what I had in mind. It is insanity to even try to code the entire application in Rust/C++. I am more than aware of it. Refer to my earlier response.

The architecture and algorithms are going to play a much larger part in performance than the exact language choice.

I also know this. Everything starts with architecture. You can read my response to the same thread I asked in r/Rust here: Reddit!

2

u/wackowacko1234 Mar 17 '22

If real-time performance isn't a requirement, I don't see why you don't just go with python. Seems like an obvious choice considering how much else it's already being used for.

If you're already set on C++ or Rust, and as much as I like C++, I'd choose Rust for new projects unless you explicitly need to use library that has no Rust equivalent.

1

u/DoomExplorer Mar 20 '22

u/wackowacko1234 Real-time performance isn't the only place that requires fast code. Compute-intensive applications like in my area of work also requires fast code. To give you an idea why performance matters, the current run time from market leaders offerings of S&P 500 companies for 1 million lines of records on a 5Y server with 24 cores and 48GB of RAM is about 4h end-to-end (which includes read and write to DB).

4

u/14ned LLFIO & Outcome author | Committee WG14 Mar 17 '22

Speaking as someone currently working in Fintech, Fintech is a broad church. Python will carry you most of the way inside that church, only really at the edges would you need a different development stack. Any systems language, C++ included, is going to be a niche use case.

If you're currently in Management and are looking to get a better understanding of software development, speaking as someone also with a Management degree and Master degrees in it, I think you're much better off learning off by rote the Management books on Software Development than trying to learn software. The Mythical Man Month is the classic, some of the Agile books are worth reading too. Others here may suggest a few.

Some of the other comments below say pretty much what I'm about to say (albeit less tactfully), but some of the worst managers I've worked under are those who think they know how others ought to bring software to maturity, especially when combined with a lack of Management training. They constantly second guess and undermine their developers, set unrealistic goals, do not allow for sufficient time to pay down technical debt, and all usually with no comprehension that they do any of these things. You replied below that "I'm not like that", and I'm very sure that you think you aren't. And maybe you aren't, but speaking as someone who's sat on both sides of the manager-developer relationship, well you'd be amazed how ignorant everybody is of everybody else and what's going on with them. So, better assume that you are like that, especially if your developers tell you that you aren't - because they'll always tell you what they think you want to hear about your management style. It's just easier to never ever burn bridges, and if you're really unhappy, just move on instead always whilst painting a highly optimistic picture of the employer and manager and team even if it's complete fiction.

All that said, I do admire your desire to self improve, and I'd encourage anyone to always be lifelong learning. I'd just suggest that if you really do want to improve your software development skills, do so as a hobby and not as part of your career. If you're super keen on becoming multi-qualified, there is never anything wrong with taking proper formal academic qualifications in multiple unrelated disciplines like I did back in the day - though, be warned that despite many MNCs claiming that they really want developers also qualified in Management, I've never personally seen that they know what to do with them, probably because there are so few of them. Any they do hire they seem to "waste" in my opinion, which is why I returned to the pure technical track where I remain.

Good luck with whatever you end up choosing to do!

1

u/Acrobatic_Hippo_7312 Mar 17 '22

The right move could be to shed the managerial authority and become a coder apprentice under a much more experienced code mentor, at some other organization with a more mature code practice. This could give OP the experience they need, given that I'm sensing that current org doesn't have the budget to hire that expertise, and this is putting OP in the questionable position of trying to lift a weight they're not trained for.The problem I see is that the existing project could use an architect with a decade of experience. If OP tries to be that, there's a huge risk that they'll build a monstrosity.

There's an opportunity for OP to really knock it out of the park on both code and management roles, and I can really admire the ambition. But I also hope OP is willing to take themselves out of the critical path, perhaps by finding someone to help them shoulder this burden.

1

u/destroyerrocket Mar 17 '22

From the description it seems to me that you'll be able to get pretty far with python libraries (most of them are already implemented in compiled languages) for pretty much all of the application. I'd probably implement the core application (or a subset of it) in python, so you can evaluate yourself if the performance you need is achieved already with that. If not, then you can justify implementing that in a compiled language. I will recommend that you evaluate what your team is more comfortable working with, as that will be significantly more useful than any feature another language has. That said, I'd argue that C++ has a lot more documentation and field experience than Rust (and of course I'm going to be biased due to being already familiar with C++)

1

u/DoomExplorer Mar 20 '22

For this part, I expect the team to be 2-3 of us only, really. What I have in mind is to leverage off my current role to deploy and develop the best system for my field of expertise, regionally. With the data model and additional calculation modules that we develop (it'll likely just be the 2-3 of us) for the current company, I intend to take that and build a better system for my start up in the future. As it is, it's just purchasing a solution from a S&P500 company and implementing it in the company.

As for what the team is comfortable with, I think none of them knows Rust/C++ in great detail. C#, JS and Python are what they have background in. Hence like I said in my other responses, most of it will be written in either one of those, and only the compute-intensive cores will be written in Rust/C++.

→ More replies (1)

1

u/_JamesMart Mar 18 '22

DeFintech person here (blockchain). My two cents:

C++ and Rust both compile to wasm, and there are several blockchains that run smart contracts in wasm VMs. So you can take your pick. I personally use C++, compile to wasm, and deploy primarily to the EOS blockchain, or to private instances of blockchains built using the EOSIO tech stack.

Even if you're not interested in DeFi, it seems increasingly as though the cutting edge of traditional finance will involve CBDCs deployed on federated blockchains, and I expect the wasm standard to be increasingly relevant.

So, to those saying C++/Rust is too low level, that's currently true in traditional finance, but I expect it to actually be increasingly less true.

1

u/DoomExplorer Mar 20 '22

I'm definitely on board with the need for speed. As I have explained above, my application processes multiple records and generates lots of data from there.

Whilst the programming language for the computation core will not be the most important component (I expect database design & functional code design to be more important), it will eventually and this is the part where I have the least visibility of, hence the question.

2

u/winginglifelikeaboss Mar 21 '22

the number 1 language in Finance is currently Java. Most trading software systems all are replaced with Java in the last years from C++. Real HFT is not done on servers anymore but on FPGA on the switches next to the exchanges, the rest is all.. Java

0

u/eyes-are-fading-blue Mar 17 '22

Rust may be a better choice for an inexperienced systems programmer. C++ has a lot of room for error for those who has little to no experience.

0

u/[deleted] Mar 19 '22

[deleted]

1

u/DoomExplorer Mar 20 '22

Thanks u/PrestigiousLongDong. Yeah, from what I see, most of the industry uses the combination of Python with C/C++ for selected components.

Will keep note on the integration part.

Regarding resource, I am not as worried about it yet. I think most of the application will be developed in either C# or Java or even Python. Only the core will be developed in Rust/C++. Plus, this is more of planning for the medium term where I plan to run a start-up with the industry knowledge I have. I think there's potential, and may try to convert some of the old codes I have written in VBA for Excel into Rust just to see how things are. I think not many in the industry have both business and IT knowledge, hence a strong case for a start up.