Best programming language for trading?

Ha, with all your "restrictions and focus" on a very specific niche you might well be right. But as I got an impression we are generally talking about financial firms that are engaging in trading financial assets I took the general view. I have worked at 5 large international investment banks in the capacity of flow trader, quant trader, and prop trader in both fixed income and equities, and at an undisclosed hedge fund, and have quite a number of close friends who work at several hft firms and hedge funds. Nowhere are interpreted languages used for any production and mission critical code that goes into the apps used to run the back, middle, or front ends. We should not confuse use cases where, for example, reports are generated and some guy in product control or so applies VBA macros or other Python code to customize things for specific traders or risk people. But that is an entirely different beast from stable production code that is audited and takes months/years to move into a stable production environment. I would be curious if you could name a single product on the front-end side that is available for purchase for production environments that is written in Python or VBA. If at all then it is individual apps that specific people use to make their lives easier. But certainly not production code on which clients execute millions of, for example, algo orders or risk management values/stresses trading books on a firm-wide and often global basis.

Most items on your list would only apply to interpreted language usage in very small firms/teams that either can't afford expensive proprietary software or do not have the budget for large IT teams. Such smaller firms might "stitch" things together here and there but I highly doubt this qualifies as production and mission critical code that a seasoned senior management and risk management division would ever sign off on. Heck, in most firms it takes weeks/months to just get a hard disk purchase approved and any hardware/software that is implemented in production environment goes though multiple layers of rigorous vetting, testing, and approvals before it is employed. I would claim that a trader at any mid- to large sized hedge fund would immediately get fired if it was found that he himself "altered" the order submission process by applying some sort of hack via interpreted languages to tailor to his/her preferences.

Your last statement definitely is a reflection of your own limited view of things at your firm or the few people you spoke to. Applications/software in research/development are in almost all cases strictly delineated from production code. R or Python are hardly EVER used in any production trading environment at any reputable firm, whether bank, hedge fund, or hft firm. Please name a few firms that programmed their OMS or order routing/execution in Python, I would love to learn and am happy to stand corrected. I am pretty sure you won't find all that many. Or perhaps a few firms that injected some interpreted language hacks into the pipeline of data sourcing (Blomberg pipe/Reuters RMDS -> backend apps in production). Other than at the consumer end in research/development nowhere in this pipeline are interpreted languages to be found.

Re frontends, yes, most firms spend a fortune on developers and technology to get the front ends right as well. All the technology is wasted and money lost when traders or support staff find a hard time to enter their trades and make adjustments on agreed trades with counter parties, for example. None of those front ends are written in interpreted languages either.

Sle, I do not mean to differ with you constantly on issues but it appears several times now that we differed and when laid out my arguments you restricted the universe to a few niche cases. Your points might all be valid in small offices where there might be budget constraints but at most reputable banks, hedge funds, and hft firms and especially on the buy side where the issue of fiduciary duty is more than anywhere else adhered to, interpreted language hacks are just not acceptable business practice. (and yes, VBA and other script code and interpreted languages are nothing but an unstable hack and should only be utilized when mistakes or errors are acceptable)

I think you have a rosy view of big firm's production applications. I've seen some god awful frontends that are complete garbage. Most likely these big firms would benefit from using more modern programming languages for a large portion of their code base and then optimize the parts that need optimizing.
 
  • Like
Reactions: d08
Sure I have seen plenty garbage myself. But none of that garbage was written in vba or python.

I think you have a rosy view of big firm's production applications. I've seen some god awful frontends that are complete garbage. Most likely these big firms would benefit from using more modern programming languages for a large portion of their code base and then optimize the parts that need optimizing.
 
Might very well be the case, hence I outlined where interpreted languages might be used in non-research production. At banks, reputable hedge funds, and buy side firms they are not. Not by a huge margin.

But to get back to the thread topic, I assume OP was asking about languages that retailers can use and embark on. I would put my money on C# especially now that mixed OS Net/Core has become the natural continuation of the net framework. Java looks increasingly outdated in comparison, feature wise, both for general purpose code and UI code especially. I contend that a well designed UI is as important than the backend. Nobody in the heat of the trading session is gonna play around with some Json config files and command line apps. And in that arena the clear world champion is wpf/xaml. Non UI wise of course there is always room for special purpose languages such as C++. Most other languages especially scripted and interpreted languages are great research tools. So, my vote for the average Joe goes out to C#. And I love Microsoft, after all they wrote the fastest Linux version there is aside their coming to grips with the open source community after all.

Not having a stake in this ... it occurs to me that you guys are too intelligent to be having this p*ssing contest. Might just be that you are all "correct" in the environments you work in.
 
There is a lot of high performance code running on Java. It's still one of the highest demand languages. I've personally written very highly optimized Java backends that are still being used today.
Extremely opaque, but plenty fast, and elegant.
 
C#... Do "professionals" really use Windows? Also...for the python bashers above...check out numba...well written Python can be as fast as C/C++
 
  • Like
Reactions: d08
On a related topic, at my previous job I shared an office with a guy in his late fifties who spent most of his career writing C and C++ code. We were on a Javascript stack project (React.js/Node.js) and there was not a day that went by where we did not have a thorough Javascript bashing session. It was usually initiated by one of us hunting down the cause of a runtime exception that would never occur in a compiled language. He was sort of grumpy by nature so it was not hard to get him riled up. Good times!
 
On a related topic, at my previous job I shared an office with a guy in his late fifties who spent most of his career writing C and C++ code. We were on a Javascript stack project (React.js/Node.js) and there was not a day that went by where we did not have a thorough Javascript bashing session. It was usually initiated by one of us hunting down the cause of a runtime exception that would never occur in a compiled language. He was sort of grumpy by nature so it was not hard to get him riled up. Good times!

It would also never occur in interpreted language that was designed to "do stuff" , i.e matlab, python, etc, as opposed to languages that are meant to "display stuff" in the browser, i.e javascript. I started playing with Javascript about a year ago, out of self-driven necessity.... and I absolutely hate it. Angular 4+ makes it a little bit better, but it just doesn't make sense to write it yourself...when there are perfectly capable Russians who speak great English and take $20/hr. Almost anything front end-related, I just use upwork now. Its not worth my time to do anything non-strategy related.
 
1. How familiar are you with development?

If you are not familiar with any form of general purpose language or you didn't take a college-level math class (using MATLAB or less commonly R) you would be best served by learning a platform specific language. Think ThinkScript, NinjaTrader's scripting, EasyLanguage, etc. These are designed to be picked up quickly. Alternatives to these are basically limited to Excel and Excel formulas. Excel VBA is a derivative of Visual Basic which would imply some familiarity with programming in a general purpose language. The entire finance industry is built on Excel sheets. Every financial engineering course I took was in Excel, except for one where I wrote some code in R.

If you fit into these stage go no farther. The languages described in the above paragraph will be your domain.
Appreciate your post and here are several VBA specific questions if you don't mind:

1. I recently learned how to program VBA in Excel. It is convenient to link data I download from my broker into Excel but difficult to run large computations (e.g. Monte Carlo), or iterative programming (e.g. reverse BSM to determine IV) with pure Excel spreadsheet. VBA allowed me to do that. But I found my VBA macro could not compute functions like normal distributions so I was forced to toggle between Excel and VBA to do the computation which is very cumbersome. Do you have any suggestions and can you help?

2. If I want to automate my trading algorithm from Excel, is it possible?

3. If I learn other languages and write codes in MATLAB (which I am taking an introductory class from Coursera), or C++ for example, can I download data from Yahoo Finance into those and can I link my Excel data file with those other languages similar to VBA in Excel?

Thank you.
 
I recently learned how to program VBA in Excel. It is convenient to link data I download from my broker into Excel but difficult to run large computations (e.g. Monte Carlo), or iterative programming (e.g. reverse BSM to determine IV) with pure Excel spreadsheet. VBA allowed me to do that. But I found my VBA macro could not compute functions like normal distributions so I was forced to toggle between Excel and VBA to do the computation which is very cumbersome. Do you have any suggestions and can you help?

With reversing BSM to get IV you should be able to use Excel Solver reasonably quickly. No need to learn linear/quadratic/etc programming if you don't have to.

For calculating distributions I would be very surprised if VBA didn't have a way to access NORMDIST or something. If not, you can always write your own function to do it. Depending on what you need it may be more work (mass function vs cumulative distribution, etc) but it's definitely doable.

If I want to automate my trading algorithm from Excel, is it possible?

This really depends on if your broker provides an API link up you can use from VBA. You could always write an Excel plugin yourself in another language (C# for example) and use that to communicate with the broker if you're dead-set on using Excel.

If I learn other languages and write codes in MATLAB (which I am taking an introductory class from Coursera), or C++ for example, can I download data from Yahoo Finance into those and can I link my Excel data file with those other languages similar to VBA in Excel?

A few things:

1. MATLAB is great if you already have the software but don't go spending $400+ dollars on it if you don't need to. R is a great substitute (though MATLAB is definitely far more refined). Python + numpy + pandas + scipy + jupyter + matplotlib is a reasonable solution as well.

With general purpose languages you can do whatever you want. It's really limited to if your broker supports the language and (if not) what you need to write to talk to them. I'd stay away from C++ for now. You likely won't need the performance gains if you're using Yahoo data. Which brings me to my next point...

2. Don't use free data

You get what you pay for. If you're interested in equities you need to make sure your data is adjusted properly for splits and dividends. If you intend to trade a basket of stocks you need to make sure delisted stocks are handled as well so you don't suffer from survivorship bias.

CSI Data is good. Quandl EOD data is great. Both are around the same price. Quandl has an API, CSI Data charges way too much for API access. If you want an API - my recommendation is Quandl. If you're really that strapped for cash go bum some cash from someone and buy adjusted historical stock data in CSV form.
 
Back
Top