What programming languages ​​and why are used in finance



    Many people who are interested in the topic of finance are interested in the question of which programming language is best suited to work, say, in the stock market. It is impossible to answer it unambiguously, since different languages ​​are suitable for different tasks.

    In our today's article we’ll talk about how to understand which of the existing technologies should be used in a particular situation in the stock market.

    Investment Decision Making


    First of all, we need to decide why we needed to program something. Frequent applications - development of software for trading on the stock exchange or analysis of large data arrays. The choice of a programming language will largely depend on what style of work on the market is expected. More specifically, it will depend on the application performance requirements.

    Here is what YCharts service developer Jeffrey Shek says about it in the corresponding Quora thread :

    If we are not talking about high-frequency trading, then it is obvious that investment decisions will not be made on the basis of seconds of processing time. Rather, the main tasks will be the search and collection of information. For example, many hedge funds invest only in clearly defined niches (unique industries, illiquid debt markets, troubled companies, etc.). In this case, collecting the necessary information will not be easy, even if you work with various APIs, you can rely on the fact that you can simply download information from different sources without dancing with a tambourine.

    Thus, if you need to aggregate data for analysis, then most likely you will want to use something with a large number of libraries, quite fast, with a lot of code already written for solving different problems (so as not to reinvent the wheel every time). Most often it will be something like C #, Java or Python .

    If you need a quick trading robot


    There are situations where speed is a priority. In this case, developers resort to the use of effective low-level languages.



    Aleksey Afanasevsky, head of the direction of algorithmic trading at Finam JSC, in one of our publications called the following technologies suitable in a similar situation:

    C ++ and pure C are very suitable for these tasks . It also happens that fast robots are created almost in assembler - here it is worth mentioning the mechanisms of direct reading and writing data to the memory of a network card, bypassing the standard mechanisms of working through drivers, as well as working with "superfast programmable hardware" like FPGA.

    Under the hood of a business


    Programming trading algorithms is a “calling card” of exchange technologies, however, real success in the market cannot be achieved if you do not pay attention to software components that are responsible not for the trade itself, but for the “accounting” of this process.

    One such aspect, according to Jeffrey Shek, is data storage.

    Database languages ​​are crucial. Do you want to save every application for Microsoft stocks per day? Try to do this using an SQL database (MySQL, SQLite, etc.). In this case, it is very likely that you will have to spend many hours optimizing before you can make a deal based on this data.

    I would recommend paying attention to languages ​​that allow you to store data in a column format (and not in a string format) - this is well suited for tick data. Among such technologies can be called KDB , OneTick , SECDB (created in Goldman Sachs). If you just need to keep stock prices, then MySQL with PosgreSQL will do just fine.



    All in the same Quora thread, PhD professor at Princeton University and head of the Flexport development department Andrew Ledwin focused on programming languages ​​that can be used to work “at the strategy level”.

    Here we need to generate profitable operating rules based on various signals. [...] At this level, the key point is the expressiveness of the language. Often it uses languages ​​like Python or even C ++ with Java, but I consider Haskell or Ruby to be an ideal option as a “wrapper” with the subsequent development of key modules in lower-level languages.

    Another important step is the search for signals. Most often this is offline activity, during which a large number of statistics are analyzed taking into account the limitations of real-time systems. It uses tools like R or Matlab(like the same Goldman). The possibility of machine learning and working with large amounts of data with minimal effort is important. But in general, the main result is here - if you manage to achieve it using Excel, then who cares?

    If you just want to work as a programmer


    Above, we talked about choosing a programming language in the context of writing your own trading systems. However, one should not forget that the infrastructure of the exchange and brokers is also written by someone in some languages, and employees of the respective companies should support this entire ecosystem.

    In the financial industry, experts who know C ++ well are always appreciated, since a significant part of brokers and exchanges systems is written with its use. Everything is written on it: from libraries for calculating price models of derivatives to infrastructure solutions, processing various flows and storing data. Therefore, specialists who know C ++ well will always find work (for example, on the same Moscow Exchange ).

    Investment companies also use C # quite often, and increasingly Java, says well-known quantum and Quantstart blog founder Michael Halls-Moore. The expert notes the popularity of these technologies in infrastructure projects - various front-end interfaces, data feeds and sometimes even modules for calculating derivatives prices are written specifically on them.

    The developer of the SmartX trading terminal , Andrey Gorkovenko , agrees with this . In an interview, he advised developers who would like to try their hand at the stock market to start learning these languages:

    I would advise you to turn your attention to high-level platforms and languages ​​such as .NET and Java. The latter is very popular in Western stock markets, while we have less, but there are good prospects for a wider distribution of this language. This means that Java programmers will be in demand in financial companies, funds and brokers.



    Conclusion: Everything is interconnected


    The line under discussion of programming languages ​​in finance can be summarized by quoting Joseph Wang , a quanta from Hong Kong's largest investment fund . According to this expert, the programming languages ​​used to solve certain problems complement each other.

    To implement things that require a lot of work with the processor, C ++ or CUDA is used. For processes related to data exchange, Java is used. To conduct research and prototyping trading applications, they resort to the Python, R, TradeScript scripting languages ​​(used in the SmartX terminal) or even Matlab. In turn, many traders use Excel / VBA to create reports.

    All of these languages ​​are interconnected. You can write a price analysis module in C ++, then feed the data to the Java trading engine, analyze the data using Python or R, and then upload all this to a report via Excel.

    Related links:


    Also popular now: