Python and MATLAB Tradeoffs for Quantitative Research
Summary
The document compares Python and MATLAB as tools for quantitative research and trading work. Contributors describe Python as easier to share and run across environments, open source, and well suited to numerical work, data manipulation, file access, and automation. They also cite its array syntax and integration with external sources as advantages. One contributor views learning Python as broadly reusable, while another presents it as a useful language for connecting research tasks and routine data workflows.
The discussion also notes areas where MATLAB may be preferable, including Java integration, optimization routines, three-dimensional plotting, and its research toolboxes. One perspective is to model and test ideas in MATLAB before implementing them elsewhere, while another stresses that the right choice depends on workplace conventions and available software. These are practitioner opinions rather than a controlled performance comparison; needs, libraries, licensing, and a firm’s existing systems can change the tradeoff.
Key ideas
- Python can simplify code sharing, data handling, and research workflow automation.
- Python’s open-source numerical ecosystem is presented as a strength for quantitative analysis.
- MATLAB is credited with strong optimization tools, Java integration, plotting, and specialized toolboxes.
- The best choice depends on a researcher’s tasks, software access, and workplace practices.
Tags
Full text
# Switching from Matlab to Python for Quant Trading and Research # Switching from Matlab to Python for Quant Trading and Research Has anybody else out there made this switch? I'm considering it right now. What were the negatives and positives of the switch? ## Answer by Brian B (score 17) https://quant.stackexchange.com/a/651 I made the switch years ago, and it has been great. I even switched the class I teach from Matlab to Python. Here are some things to consider - Others can run your Python code when you share it with them. Matlab has compilers and the like, but they are an extra step you must take since most people do not have Matlab on their desk. - Python and its extensions are open source and so allow you to see under the hood - Python ctypes is slightly nicer than Matlab C integration - Python syntax is excellent (e.g list comprehensions), and NumPy syntax for arrays is also cleaner than Matlab's - Python is easier to integrate with external data sources and files On the other hand - Matlab integrates nicely with Java - Matlab optimization routines are really excellent - Matlab 3D plotting is better ## Answer by ZAxisMapping (score 14) https://quant.stackexchange.com/a/654 Rich, you might find this cheatsheet useful on your journey. I was advocating Python over Matlab to a co-worker just minutes ago. I should start by saying that Matlab is a fine piece of software - its documentation is amazing, as are the pdfs that accompany the various toolboxes (as I'm sure you know). However, regarding Python, Brian B brings up many good points. Two big advantages I would like to emphasize: - I know that I will be able to develop Python anywhere I might work in the future (including at home over the weekends). In other words, learning the language is time well spent. Learn once, and benefit for years. It's the same reason why I love working on the command line in *nix environments, instead of GUIs (MS Office ribbons come to mind). - I acknowledge that a very large portion of quant research is simple, unglamorous data manipulations - Python serves as a strong glue language (like Perl, but with much stronger numerical libraries). I can set cron jobs for Python scripts that load data, send me emails, etc. I'm sure there are those who do this in Matlab (just like there are those that do all sorts of crazy stuff in VBA), but Python is a far better tool for these jobs. Having said all of that, all legit quant shops can afford Matlab (and all of the costly toolboxes required for database access, xls read/write, compilation - which really should be free IMO). If you are purely research, then you can probably get by with only Matlab, but I find it somewhat restrictive and, perhaps, somewhat risky in terms of availability. ## Answer by Gabriel (score 3) https://quant.stackexchange.com/a/4036 There is a Python library for this that you may want to take a look at: http://gbeced.github.com/pyalgotrade/ ## Answer by Tangurena (score 2) https://quant.stackexchange.com/a/648 I've only found MatLab to be useful for modeling and testing algorithms, with the implementation in any other language. ## Answer by Scott (score 1) https://quant.stackexchange.com/a/4037 I'm a big fan of python over the competitors as well. I use the pysci & matplotlib libraries heavily which are all open source albeit not specifically designed for optimizations but solid for visualizations & fast analysis. Another part of making a transition for me, was the ease of use on the Mac. It's native although I do use macports (very easy install) for several other projects & it augments my development environment nicely. Macports provides a huge catalogue of modules easily installed with 1 command & dependency resolution (no *nix package mgmt. hell) & of course all of the IDE's work nicely (I use VIM). Git is native, debugging is very mature, & if you can get over strict indentation (macros or IDE's help) then it's typically quite readable code. Never posted before but have lurked for months so hopefully this contribution helps. ## Answer by phil (score 0) https://quant.stackexchange.com/a/650 Everything has pros & cons. So it has to do with personal preferences but more importantly to me it has to do with what your shop uses. Most use a mix of interpreted/compiled language. ## Answer by Joern (score 0) https://quant.stackexchange.com/a/4881 MATLAB has a trading and backtesting toolbox which offers similar functionality to other retail trading packages. http://www.tadeveloper.com
Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.