Interview: how C # and C ++ help make money in the stock market
One of the most popular topics in our blog was the story of Jesse Spaulding - a guy who earned $ 500k in the stock market, applying his programming knowledge and understanding of the basics of the stock market ( part 1 , part 2 ). In the comments on these texts, some habra-users expressed their doubt about the realism of such a scenario in our country. Also heard phrases like "well, he used to work in this area."In this regard, the editorial board of ITinvest spoke with Andrei Gorkovenko, a developer who repeated the path of Jesse Spaulding and managed to turn his life around with the help of the stock market and technological knowledge. With this text, we open a series of interviews with direct participants in the processes on the Russian stock market - software developers, traders and company executives.
Note: Andrey Gorkovenko used to work as a programmer at ITinvest. In particular, he worked on the SmartX trading terminal project.(the history of its creation is described in a separate habratopika). Later, he created a universal mechanical trading system with which you can implement various trading strategies in the stock market. This development brings him the main income, which exceeds the average developer salary in Moscow.
Hi Andrey! Tell me, how did you find yourself connected with the stock market?
In 2007, I left the fourth year of the Voronezh Military Institute of Radio Electronics and started looking for work. Since I was always interested in programming, and, as it seemed to me, had certain skills in this area, I considered the corresponding vacancies. It so happened that I was offered a place in the local Voronezh branch of one of the largest Russian brokers.
And what were your responsibilities there?
My main task was to develop trading applications for company traders. For example, I made various systems and drives for scalpers . Using one of these programs, it was possible to enter orders into the trading terminal not with the mouse, but directly from the keyboard. Now it’s not surprising anyone, but in those years there were not many convenient means for trading. Another development of that period was an arbitrage robot, which was able to perform arbitrage operations in different markets (futures and spot).
It all started as a simple satisfaction of the organization’s own needs, but “got out of control”, as it turned out that such products were in demand by a wide mass of potential customers. A separate company was organized, which was engaged in the development of trading robots and exchange software. From this company, I already went to work at ITinvest, where I started developing a new SmartX trading terminal (the history of this project is posted here - approx. Editor ).
And how did it all come to an independent entry into the market?
Some time after changing my job and moving to Moscow, I optionally, in my free time, wrote a new robot that could trade anything. It was even more likely not a robot, but a trading platform that could connect to the interfaces of different domestic brokers, to different terminals, to the exchange. It was possible to quickly load a trading strategy into it, and it worked. Something like Wealth Lab or Russian StockSharp and TSlab.
The platform was completely written in C # and all the strategies that could be put into it were also written in that language. There were ready-made methods for processing applications, transactions, obtaining data, etc. It is only necessary to describe the mathematics of the trading strategy, without the accompanying binding of the necessary processes, and the robot will start trading.
This platform is still alive, it is the main source of my income. Of course, little has been preserved in it since 2011, but the basic constructions and philosophy have remained unchanged.

An interesting moment is that you yourself are not a trader, but a programmer. Did you write trading strategies yourself, or did someone help you? How to make money on such a system, if you do not understand trading?
It was so and so. Firstly, it helped me a lot that I initially worked for a company that was engaged in direct trading on the exchange. I was attached just to the department of professional traders, whose requests and needed to be implemented programmatically. This provided an understanding of the basic market mechanisms, as well as knowledge of the basic strategies for working in the market. Secondly, I have a partner who has significantly more experience in trading. A kind ofJeff Dean from trading (laughs). No kidding, his experience and insight greatly influenced the formation of me as a professional trader. Most of the strategies that have survived to this day are the fruit of our brainstorming sessions, disputes and reasoning. I also often communicate with my colleagues in the shop, we discuss the news of the market and near-market sphere. Of these meetings, you can often learn a lot of new and interesting things. I came up with some strategies on my own, watching the market. I also constantly study various solutions on forums, websites selling trading robots, etc. hoping to find at least some adequate idea. In general, to make a robot you need either an idea - your own or someone else's - that you can adapt to your platform and test.
In addition, at that time it was a scalping boom, when the active trading of RTS futures, etc., was just beginning and developing, I wrote drives for this business - I even attached a joystick to the terminal so that it was possible to send orders from buttons. Therefore, the basic trading ideas were familiar to me, and it was not difficult to shift them into a trading strategy.
In general, this is a rather fascinating process - the separation of grains from the chaff. 90% of ideas after testing turn out to be slag, and at best they show zero on history. The remaining ideas are checked for hidden and random errors, then they are launched in the virtual order execution mode, and only 1-2% reach real trading.
Clear. What is the result of this project? How successful is your opinion? What can you boast as a successful trader?
I don’t bother with any external manifestations of success like expensive cars and cool gadgets (I even use an old iPhone 4, it’s quite enough, although I can buy anything). In principle, I try to follow the considerations of expediency in everything and live ascetically - this tempers and helps to survive any difficulties without problems. But I do not skimp on travel. Only in 2013 I visited 6 countries (in the winter - in the Czech Republic, Germany and Austria, in the summer - in Finland, in the fall - in Spain and France). As for life, of course, thanks to trading, I was able to get rid of any boring things such as trips to work and meetings that devour a hell of a lot of time (especially in Moscow).
Now I work from home, I have good equipment, monitors, a comfortable environment, a comfortable chair. Have I less work? Perhaps not, but I'm free to build my schedule based on my needs and mood. The only moment, from 10:00 to 19:00, when the main trading session on the stock exchange is in progress, you need to keep an eye on the robot so that it does not fall. Rather, that the exchange does not fall (over the past year, the exchange has crashed more than the robot (laughs)). Although this can be done from anywhere - the system has already become “wiser” and is able to monitor itself and send SMS messages and emails about its status. You can pick it up even from a cafe, even from Bali.

Do you continue to develop alone or are you already attracting someone?
Yes, I continue to develop one. Now they are rewriting the system completely in C ++. While there is no need to attract wage labor.
Let's talk about technology. What is the reason for the initial choice of C # and the current transition to the "pluses"?
Initially, I wrote a project in C # because it was easier and faster for me to make a finished product on it. The functionality available in the .NET platform is quite rich (working with containers, streams, files, with XML, the presence of a GUI), which makes it a good choice. The reason for switching to C ++ is commonplace - there is not enough performance. Now the requirements for software in this regard are very high — the time for recounting strategies is measured in units of microseconds. Every microsecond counts.
The process of switching to the “pros” began a few years ago, when the server was purchased, and for the first time the robot collided first with the broker, and then with the exchange data center. I had to rewrite some of the modules already then, and then I took up the kernel. If we take the current trading robot, then in C ++ all "math, and adapters to exchange systems and brokers." Everything else remains in C #. That is, modules that require minimal delays are written in a low-level language, and the logic for making trading decisions, GUIs and auxiliary modules is implemented in a high-level language.
This bunch of languages - C # and C ++ - is extremely viable. It takes me an hour or two to write a new trading strategy or modify an old one. In the case of complex mathematics, a day and a half. At the same time, a back test function is built into the system, a new strategy can be immediately tested on historical data. In addition, there are genetic algorithms that can be used to optimize strategies.

In general, what is better to study for those who would like to find work in the stock market?
For those who begin their journey in trading or are somehow interested in this area, 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. Still, .NET is a fairly closed platform, which also has a number of limitations. For low-latency and HFT trading, it is not very suitable.
But in both .NET and Java, you can quickly create complete software products. The main minus - they are not the fastest (if the account goes to microseconds).
You talked about buying a server for the system to work. Was it done on the revenue that this robot generated? In general, how quickly did the project bring tangible income?
Everything was bought and made on the income from trading. Money for all the hardware was withdrawn from the brokerage account. As for the income, it took about six months before the income from the system’s work equaled the developer’s salary.

It is important to understand that 2011, when the project started, was marked by large fluctuations in the market. Money literally handed out to the right and left. Of course, this contributed to the success of my robot, which quickly began to generate good income. Until the robot was debugged, I traded one or two futures contractsRTS - the risk of losing real money at that time was very high. When it became clear that the system was working, well debugged and generating money, the amount was increased to tens, and then hundreds of thousands.
That year was very good for the robot, it was then that risk capital was earned, as I call it, which went on to further develop the system. However, if the market conditions were not so favorable, then there would be a high probability that I would try, lose all the money and forget about the stock market in general (I exaggerate, of course, I would not leave the market, but the loss of start-up capital would be extremely negative event for the project).
As in any case involving uncertainty and risk, there are ups and downs in trading. The variability (dispersion) of results in exchange trading, on the one hand, allows you to get significant profits (and we are not only talking about money; this includes time, knowledge and views on the world around me), but on the other hand, it constantly destroys my consciousness . To draw a line under almost three years of trading "on my own," I asked myself - would I refuse to pay (at that time a very, very decent for a 25-year-old programmer) salary if I knew that I would survive for these 3 years ? Definitely yes.
Related links and posts:
- How-to: robots and brokerage trading system API
- Stock Market Technologies: Direct Exchange Access
- How I Earn $ 500K in Machine Learning and High Frequency Trading - Part 1
- How I Earn $ 500K in Machine Learning and High Frequency Trading - Part 2
- SmartCOM trading robot creation tool
- Development of trading robots by ITinvest partners