Throughout the years, I’ve learnt many programming languages, starting with BASIC and its variants over two decades ago. Since then, I’ve done projects in numerous other languages, including perhaps more unusual languages like Haskell and Prolog, and more common ones such as Java and C, when I was at university. Through my working career, I’ve dabbled in a mixture of languages, most notably Matlab, Java and most recently Python, with a modicum of VBA thrown in (and a bit of R). I doubt I’m that different to most folks who have coded throughout their career, in my use of a many different languages. The general thought process behind coding is something which is transferable between different languages. However, each language is different and all have their slightly different peculiarities. One question I’ve been thinking about, is should I learn the new programming language, Julia?
Before, we answer that question, let’s think about the advantages of Python, which is the main language I use at the moment to analyse markets. Python has a large user base, and many people in finance have started using it, including at many large quant hedge funds, which is certainly a good vote of confidence. The Python ecosystem around data science is also fantastic, with the SciPy stack, which includes libraries such as pandas (for time series) and numpy (for dealing with matrices and vectors). There are also quite a lot of finance libraries (warning, shameless plug alert coming…!) include a few which I’ve developed, finmarketpy (for backtesting trading strategies), findatapy (for downloading market data) and chartpy (for plotting).
However, despite the very wide user base and the continuing adoption of Python by financial professionals and data scientists more broadly, there are things which could be improved about Python. It isn’t the fastest language and also parallelism isn’t handled in the best possible way by it (to get true parallelism, you end up kicking off new processes). There are some workarounds to this, for example, by using Cython and also the ability to call C++ code for things which you need to run very fast (also some of the time, simply writing better Python code does help too!). It would be nice though if we could just write everything is one language, rather than this hybrid approach. Can Julia address these shortcomings?
Julia is supposed to be very quick (like C), but at the same time has some of the benefits of being a relatively easy to use scripting language. I’ve been impressed by some of the talks I’ve seen on Julia. I’ve also seen a few smart friends adopting Julia, which is a plus! The key question which has also come up with conversations with my friend is this: is it now worth learning Julia? In order to better answer this question, I brainstormed a list of pros and cons, summarising the above points, to help me decide, whether I should learn Julia.
Points for learning Julia
- Syntax is fairly straightforward, like other scripting languages
- Quick in execution (although I’d be keen to run my own benchmarks to confirm this!)
- Easy parallelism, unlike Python
- Growing user community in finance, including a few high profile organisations like NY Fed
- Already has some crucial libraries for finance like DataFrame (like pandas)
Points against learning Julia
- Time it takes to learn Julia (unfortunately, we can’t get around this issue, when learning a new language!)
- Have existing code base in other languages (in my case Python)
- Whilst the user community is growing, it is many times smaller than other languages used
- Ecosystem of open source libraries is much smaller than either Python or R (and some important Julia libraries are not free, like JuliaFin)
- Has a slightly different approach to object-oriented programming compared to older languages like Python or Java (which I still need to investigate)
- Cloud computing power is getting cheaper and cheaper.. just throw more processing power at a problem, rather than learning a new language!
In the end, I actually installed Julia on my computer and also Juno IDE to develop Julia code: I’ve already written a few lines of Julia. However, it’s still a very long way to go for me on this Julia journey! Whilst I doubt I’ll suddenly change my whole development stack to Julia, it might prove useful for some tasks, which I’d like to run much quicker. I would be interested to hear from folks who have started to use Julia too in finance, has it been a worthwhile experience or would it have been better to stick to Python exclusively?