
Most applications on modern exchanges are not generated by humans, but by specially created trading robots, which operate according to a given algorithm. At the same time, many traders and investors still operate on the stock exchange manually - using special trading programs.
Regardless of the chosen mode of operation on the exchange, API technology is extremely useful. Today we will talk about how open interfaces are used in finance.
')
Broker API: robots and trading applications
There are many ways to create trading robots - for example, they can sometimes be programmed directly in the trading terminal,
as in the case of SmartX and its built-in scripting language Tradescript .
Programming simple robots using Tradescript in the SmartX terminalIn some cases, trading systems are connected to a trading terminal — for example, Excel can be used for this purpose.
However, connecting the robot directly to the broker's servers, bypassing the client interfaces, allows it to quickly receive data on trades (Market Data) and account status, process these data faster and, based on them, generate buy or sell orders and then track their execution. In this scheme, the trading speed depends only on the speed of the robot itself and the communication channels. That is why brokerage companies create APIs for their trading systems.
The interface for connecting to the ITinvest trading infrastructure was created using a component object model (COM). This means that robots developed on platforms that support this technology, from C ++ and Delphi to Visual Basic for Application from MS Excel, can be connected to trading servers.
Recently, a
new version of the API (SmartCOM 4.0) has been released, 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 merchants, 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 automating the full cycle of algorithmic trading.
- QScalp is a trading drive for analysis and high-speed execution of operations on the market with short-term and high-frequency stock trading.
- Volfix is a powerful tool for supporting a trading solution, the latest data structurizer, an analytical service that includes all the most modern ways to submit and process 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 is a trading terminal for active trading (scalping).
- Option-lab is a professional laboratory of an option trader that has powerful analytical capabilities.
- TSLab is a modern exchange terminal with built-in 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 is paramount: direct access to the exchange
At a time when everything is decisive for a fraction of a second on the stock exchange for many traders, the work according to the “user – brokerage system – core stock” scheme is not suitable for everyone. That is why a technology appeared that allows to optimize this chain to the maximum -
direct access to the exchange (Direct Market Access, DMA).
With this method of connection, the application is placed in the exchange trading system directly, bypassing the broker’s trading system. All this allows to significantly reduce the time of delivery of the application to the exchange and receiving information about its status.
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. On this server, special software is installed - 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 transactions and receive data.
The
FIX (Financial Information eXchange) protocol is a financial information exchange protocol that has become the
global standard for exchanging data between participants in exchange trading in real time. It is supported by the world's largest exchange platforms, including the Moscow Stock Exchange.
FIX protocol message transfer scheme. Image: WikimediaTo 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 for significant data compression capabilities for transferring large amounts of market information with minimal time delays. In addition to the Moscow Stock Exchange, it is used on the NYSE, Nasdaq-OMX and many other global sites.
Also for direct connection using native protocols. These protocols emerged before the merger of the MICEX and RTS exchanges into the Moscow Exchange. For example, in the markets related to the RTS exchange, the Plaza II protocol is used to directly perform transactions and obtain data in the connection mode.
To perform trading operations and obtain stock exchange data on the sites previously belonging to the MICEX exchange (currency and stock markets), a bi-directional MICEXBridge gateway (TEAP) is used.
With such an organization of the trading process, a trader can count on a significant gain in time. For example, when directly connected to the stock and currency markets of the Moscow Stock Exchange, the processing time of an order decreases to 0.5 ms, and does not exceed 2 ms on the FORTS market. When using the same broker system, applications are processed in a time from 5-10 ms to 150-500 ms, depending on the broker system, market type and connection method. Those. through broker systems, applications are processed 10-100 times slower than with a direct connection (although most merchants are quite satisfied with this speed).
We considered financial data transfer protocols in more detail in our series of articles:
In comparison with access to trading through the brokerage system API, a direct connection is not only faster, but also more expensive. If in the first case the user incurs costs only on the software itself and the broker's commission, then in the second case additional costs arise - you can read more about it
here .
Conclusion: if only information is needed
In addition to trading on the stock exchange through a special software or robots, the API 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 exchange can be found
at the link . In Russia, the Moscow Exchange
sells subscriptions to various options for broadcasting data about the auction. Among other ways there is a full-fledged
informational API .