Information services, robots and trading software: application of the API in the world of finance
Most applications on modern exchanges are generated not by people, but by specially created trading robots that operate according to a given algorithm. At the same time, many traders and investors still carry out operations on the exchange manually - using special trading programs.
Regardless of the chosen method of working on the exchange, the API technology is extremely useful. Today we’ll talk about how open interfaces are used in finance.
Broker API: robots and trading applications
There are a considerable number of ways to create trading robots - for example, sometimes they can be programmed directly in the trading terminal, as in the case of SmartX and its built-in scripting language Tradescript .
Programming simple robots using the Tradescript language in the SmartX terminal .
In some cases, trading systems are connected to the trading terminal - for example, Excel can be used for these purposes.
However, connecting the robot directly to the broker's servers, bypassing the client interfaces, allows it to quickly receive trading data (Market Data) and account status, process this data faster and, based on them, generate orders for buying or selling, and then monitor their execution. With this scheme, the trading speed depends only on the speed of the robot itself and the communication channels. That is why brokerage companies create the API of their trading systems.
The interface for connecting to the ITinvest trading infrastructure was created using a component object model (COM), which means that you can connect robots developed on platforms supporting this technology from C ++ and Delphi to Visual Basic for Application from MS Excel to trading servers.
Recently released a new version of the API(SmartCOM 4.0), which works with a trading system called MatriX (we used IBM Data Power technologies to create it).
The brokerage system API can be used not only to create trading robots by private traders, but also trading software developers who want to expand their user base at the expense of clients of a particular broker. Here is a short list of trading applications that can connect to our trading system via SmartCOM:
- StockSharp is a free platform for trading robots and automation of the full cycle of algorithmic trading.
- QScalp is a trading drive for analysis and high-speed execution of operations in the market for short-term and high-frequency exchange trading.
- Volfix is a powerful tool for supporting a trading solution, the latest data structurer, analytical service, which includes all the most modern methods for submitting and processing quotes.
- COM X-Trade is a free trading platform that includes all the necessary functionality for active trading (scalping) and intraday trading.
- LiveTrade Scalping SmartCOM - trading terminal for active trading (scalping).
- Option-lab - a professional laboratory of an option trader, has powerful analytical capabilities.
- TSLab is a modern exchange terminal with an integrated environment for the development of mechanical trading systems.
- EasyScalp is a modern trading terminal designed for scalping and intraday trading.
A more complete list of available API functions can be found here .
When speed comes first: direct access to the exchange
At a time when for a lot of traders everything is decided on the exchange by fractions of a second, the “user - brokerage system - exchange core” scheme is not suitable for everyone. That is why a technology has appeared that allows you to optimize this chain as much as possible - direct access to the exchange (Direct Market Access, DMA).
With this connection method, the application is placed directly in the exchange trading system, bypassing the broker's trading system. All this allows to significantly reduce the time of delivery of an application to the exchange and obtaining information about its condition.
In general, the direct access scheme is as follows: a server with a trading robot is connected to an intermediate server, which is located as close as possible to the core of the exchange trading system. Special software is installed on this server - the so-called gateways, which are used to transfer orders and market information directly to the trading system. At the same time, various protocols and connection methods are used to perform operations and receive data.
Protocol FIX (Financial Information eXchange) is a financial information exchange protocol that has become the world standard for exchanging data between exchange trading participants in real time. It is supported by the largest global stock exchanges, including the Moscow Exchange.
FIX protocol message passing scheme. Image: Wikimedia
To obtain market information (Market Data), the FAST protocol (Fix Adapted for STreaming) is used - a standard developed by the creators of the FIX protocol, which allows significant data compression capabilities to transfer large volumes of market information with minimal time delays. In addition to the Moscow Exchange, it is used on the NYSE, Nasdaq-OMX and many other world sites.
Native protocols are also used for direct connection. These protocols arose even before the unification of the MICEX and RTS exchanges into the Moscow Exchange. So on the markets related to the RTS exchange, the Plaza II protocol is used to directly perform operations and obtain data in the connection mode.
In order to carry out trading operations and obtain exchange data on sites previously referred to the MICEX Exchange (currency and stock markets), the MICEXBridge (TEAP) bidirectional gateway is used.
With this organization of the trading process, the trader can count on a significant gain in time. For example, with a direct connection to the stock and currency markets of the Moscow Exchange, the processing time of an application is reduced to 0.5 ms, and on the FORTS market it does not exceed 2 ms. When using the same brokerage system, applications are processed within a period of 5-10 ms to 150-500 ms, depending on the brokerage system, the type of market and connection method. Those. through brokerage systems, applications are processed 10-100 times slower than with a direct connection (although this speed is quite convenient for most merchants).
In more detail, we examined the financial data transfer protocols in our series of articles:
- Methods of transferring financial data: FIX protocol
- Ways to Transfer Financial Data # 2: FAST Protocol
- Ways to Transfer Financial Data # 3: Plaza II Protocol
- Ways to Transfer Financial Data # 4: ASTS Bridge Protocol
- How the transfer of financial data on the Nasdaq American Exchange is organized: ITCH and OUCH protocols
Compared with access to trading via the brokerage system API, direct connection is not only faster, but also more expensive. If in the first case the user bears the costs only for the software itself and the broker's commission, then in the second there are additional costs - more about this can be found here .
Conclusion: if you need only information
In addition to trading on the exchange through special software or robots, APIs can be used to create information services and debug financial programs without the risk of losing real money (for this you can also use a demo account of a broker ).
A list of such APIs for foreign exchanges can be found here . In Russia, the Moscow Exchange sells subscriptions to various options for broadcasting trading data. Among other ways there is a full-fledged information API .