The stock market is a high-tech industry - in addition to the physical IT infrastructure and high-tech trading robots, players in this market are engaged in the development of technical standards for data transfer protocols. With today's material we are opening a series of topics about financial information transfer protocols. The first release provides information on one of the oldest protocols - Financial Information eXchange or FIX for short.
A bit of history
The creation of the FIX protocol was initiated by a number of US financial organizations in 1992 - brokers and investment funds wanted to speed up the process of trading on the exchange. At that time, a significant part of trade operations was performed using a telephone, and the FIX protocol allowed for the interaction to be transferred to an electronic form. ')
As a result, an open standard for transmitting information in electronic form was born, which is not controlled by any of the large organizations. Today, FIX has become the industry standard used by financial market participants from different countries to connect their products.
How it works
Currently, the protocol is defined at two levels - the session (work on data delivery) and the application (description of the data content). There are two variants of the protocol syntax - traditional, Tag = Value and in XML (FIXML) format. Consider each one of them.
Tag Value Syntax
FIX protocol messages usually contain a header and, in fact, the message body. Each message is a stream of fields =, separated from each other by special characters - the ASCII-character SOH (# 001, 0x01) is used in the FIX specification for data separation.
Tags contain data in TagNum format, and the tag field cannot be empty (besides, the value must be positive and not start with zeros). A message with an empty Tag field will be rejected.
The message body usually consists of a header, a message body, and a trailer. The first field of the message is always the beginning of the string ( BeginString , tag # 8), then the length of the message body ( BodyLength tag # 9) and the type of message ( MsgType , tag # 35) are indicated . The last symbol of the trailer is always a checksum (tag # 10).
Often messages contain both the encrypted part and characters transmitted in text form - this scheme is usually used for validation and verification of data. For example, sending an encrypted SenderCompID value pointing to the sender is an obsolete validation method.
To provide greater flexibility, the FIX protocol contains the so-called user fields - User Defined Fields. They are used when transferring data between cooperating financial institutions. Tag numbers from 5000 to 9999 were reserved for user fields - they could be reserved on the official website of the standard. In the future, these numbers were spent , so a new interval was allocated - from 20,000 to 3,9999.
Messages in the Tag Value format look like this (^ is the SOH separator):
Here, ClOrdID is an id-order, side = ”2” means a sell order, then the transaction time is indicated, the type of the order (2 corresponds to the Limit order) and its price pX. The Acct field indicates the user's account number.
Further, the message indicates information about the security and the number of securities that need to be bought or sold. As a result, a simple message will look something like this:
At the beginning of the path of the XML version of FIX, only the DTD syntax was used. In the future, the W3C organization developed a new mechanism - XML Schema, which made FIX developers adapt the standard to use this variant of the syntax.
This step allowed to improve the XML version of the FIX protocol, in particular, users were able to add attributes and contextual abbreviations to messages.
The basic organization of an XML schema assumes that there are data types used in the fields that are contained in a separate file. FIX fields are defined in a special shared file, and FIXML components and syntax elements in special component files. FIXML messages are defined using special files that indicate a category.
Example message about sending a request for FIXML (Schema):
Each message sent in the FIX protocol format consists of mandatory, optional, and conditionally mandatory (depending on the meaning of other parts of the message) fields.
Messages are divided into three categories:
Pre-trading messages;
Trade messages (orders and transfer of information about transactions);
Post trading messages.
FIX on Russian exchanges
Using the FIX protocol, anyone can connect directly to the Moscow Exchange. In addition, the exchange is working to unify FIX access for all available markets (stocks, futures, foreign exchange).
ITinvest also provides its customers with access to the Moscow Exchange markets via direct connection via the FIX protocol. In addition, special IT services have been created for high-frequency traders and algorithmic traders, ranging from server collocation in the M1 data center to providing access to virtual machines to house a trading robot.
Other protocols
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 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, the so-called native protocols are used, which arose before the merger of the MICEX and RTS exchanges into the Moscow Exchange.
For example, in the markets related to the RTS (FORTS - futures and options , Standard), 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.
These protocols will be discussed in our next articles. Today, thank you for your attention, we will be happy to answer questions in the comments.
PS If you notice a typo or mistake - write a personal message, and we will fix everything promptly.