I have a fairly rigorous background in mathematics (last year of my undergrad in Pure Maths), and I have been exploring the world of Quantitative Finance as I explore what I might be able to do with my degree. Most of the material that has been suggested to me (mainly Quantitative Trading, Ernest P. Chan 2009) is quite dated, and so I am curious what are the main tools traders/analysts use today for data collection and backtesting. Most of the answers I am seeing are between Python and MATLAB, but I've seen decent arguments for both. Not even sure if this is the right place to be asking this kind of question but I'm quite new to this kind of stuff and most people here seem fairly knowledgeable.
These questions inevitably elicit strong responses. The truth is that both are excellent. I used Matlab when I first entered the industry, but have since migrated 100% to Python. I'll provide some quick reasons below:
Python is a general purpose language. You can certainly use Python to do computational finance, but you can also use it to automate just about everything. I use Python to scrape the web for data; I have built web apps using Python so that we can explore data more interactively; I've also worked on a silly app to archive/index every PDF I've read. You can do these with Matlab too, just not as intuitively.
Python is open source and free. Matlab is rather pricey. Even if cost is not a concern, it is much easier to explore how everything works when something is open source, which can be invaluable for learning. Python packages tend to be open source too. I've personally learned a great deal reading the code of some packages.
Python has an exceptional community. The community is much larger, which means getting help/support is likely easier (e.g., here on Stack Overflow). If you run into issues/find a bug, submit a bug report or even create a pull request yourself. I've had bugs fixed by package maintainers within hours. With Matlab, you likely have to wait until the next product update.
The Python community has also created some truly remarkable packages to do just about everything. Here, you can see a mapping I attempted between Matlab toolboxes and potential equivalents in Python. I have to admit, for some risk management stuff I did, Matlab's built-in toolboxes are exceptional, but over time I've managed to find/build equivalents that work just as well, with a ton of added flexibility. Python has also become one of the most popular languages in the AI field, with an excellent support community of its own and lots of packages you can readily use in your own projects.
A lot of people complain about Python's performance. In my opinion, it is a non-issue. There are so many ways to make your code run orders of magnitude faster and they involve very little extra learning. For example, with a few simple
numbadecorators, you can have Python functions automatically translated to optimized machine code. You can also use
Cythonto greatly speed up your Python code, without actually learning C/C++. Take a look at this page, which is a component of the excellent
statsmodelspackage for Python. Some very impressive benchmark results are available at the bottom (incidentally, against Matlab).
You might also want to consider R. Like Python, it's open source and has a large number of libraries.
My impression is Python and R are currently the most popular languages for quant finance, with Python ahead of R. As a result, if one of your goals is employability in the field, Python might be a better choice.
I think the best language, especially for QuantFinance, is R!
You can find some arguments in my blog post here: https://blog.ephorie.de/why-r-for-data-science-and-not-python.
Python tries to be everybody's darling whereas R has always been a statistical language, built by statisticians for statisticians. Quant finance mainly is statistics and there is no bigger and more sophisticated ecosystem than the R ecosystem when it comes to data science.
For some use cases see the QuantFinance category on my blog: https://blog.ephorie.de/category/quantitative-finance.
Between Python and MATLAB, I would choose Python. It is open source, has many libraries and it is object oriented. Also, its syntax is nice.
However, Python is slow.
If you are only a library user, you might think that Python is fast. This is because the library is running stuff in C or C++ under the hood. Python has the two language problem, where libraries rely in having code in both Python and something like C or C++ in order to be fast. This can be seen, for example, in the tensorflow repository, where 61% of the code is in C++. Another example is pytorch, where 53% is in C++.
At the beginning, these things might seem not important, but once you need or want to code a library to solve a specific complicated problem, you won't be able to do it in Python (unless an existing library already has the functions that you need, which will probably be in C/C++ and wrapped around Python). Or you will be able but it might be slow.
This will requiere that you learn C or C++ as well.
For those reasons, I will recommend you Julia programming language. It can be fast as C or Fortran and it can also work like Python, i.e. it solves the two language problem. It is easy to learn. Also, its community is full with people trying to solve scientific problems. It has amazing libraries that can be used for quantitative finance. You can write your own libraries in the same language. And many, many more features.
I hope this helps! Thank you!