FAST support

Preface

This article describes the FIX-over-FAST connectivity using B2BITS FIX Antenna C++ (tm) library. It is supposed that user is familiar with B2BITS FIX Session (Engine::Session) class. For more information please refer to Session description, FIX Session Acceptor and FIX Session Initiator.

Overview

The FAST protocol (FIX Adapted for STreaming) is a technology standard developed by FIX Protocol Ltd., specifically aimed at optimizing data representation on the network. It is used to support high-throughput, low latency data communications between financial institutions. In particular, it is a technology standard that offers significant compression capabillities for the transport of high-volume market data feeds and ultra low latency applications.

Using B2BITS FIX Antenna C++(tm) user can establish connection with FIX-over-FAST oriented remote site. Also current users are able to migrate from FIX to FIX-over-FAST without significant code modifications.

Quick start

The following step-by-step guide will explain how to create FIX-over-FAST session, establish connection and send/receive FIX messages.

Create FIX-over-FAST Session

In order to send and/or receive application messages user should create instance of Engine::Session class using Engine::FixEngine::createSession method with appropriate value of underlyingProtocolType parameter (see also Session description).

The following sample demonstrates how to create FIX 5.0 over FIXT 1.1 over FAST session.



#include <iostream>
#include <B2BITS_V12.h>

using namespace std;

int main()
{
        class Appl : public Engine::Application {
                // See "Application description" section
        };

        try {
                // initialization
                Engine::FixEngine::init(); 

                Appl appl; 

                // create a session for FIX 5.0 using FIXT.1.1 as SCP layer over FAST
                Engine::Session* pSn = Engine::FixEngine::singleton()->createSession(
                        &appl,                    // pApp
                        "SENDER",                 // senderCompID
                        "TARGET",                 // targetCompID
                        Engine::FIX50,            // ver - FIX 5.0 application protocol version
                        NULL,                     // pParam
                        Engine::persistent_storageType,   // storageType
                        Engine::FIXT11_FAST_TCP   // underlyingProtocolType - create FIXT 1.1 over FAST sublayer
                        ); 

                // ... - business logic 

                // release resources
                pSn->release(); 
                Engine::FixEngine::destroy(); 

        } catch(const Utils::Exception& ex) {
                cout << "EXCEPTION: " << ex.what() << endl;
        }
}
See also: Application description

Establish connection

Then user should establish connection with remote counterparty. There are two methods to establish connection:

The following sample demonstrates how to establish session as initiator. It is supposed that server is located at localhost and it is bound to 9999 port.
                // ... - create FIX-over-FAST session

                Engine::FixT11FastTcpParameters connParams;
                connParams.host_ = "localhost";                 // remote host internet address
                connParams.port_ = 9999;                                // remote host TCP port
                connParams.templateFn_ = "fix50_fixt11_templates.xml";  // path to file with FAST templates for FIX.5.0-FIXT.1.1 protocol.
                pSn->connect( connParams );

                // ... - wait until pSn->getState() != Engine::Session::ESTABLISHED

The following sample demonstrates how to accept incoming FIX-over-FAST connection.

                // ... - create FIX-over-FAST session

                pSn->connect( 
                        "fix50_fixt11_templates.xml" // templateFn - path to file with FAST templates for FIX.5.0-FIXT.1.1 protocol.
                );

                // ... - wait until pSn->getState() != Engine::Session::ESTABLISHED

Message processing

After connection is established user is able to receive application messages. To process incoming messages method process of Engine::Application class should be implemented. For more information please refer to Processing incoming message.

Send message

After connection is established user is able to send application messages. The following sample demonstrates how to create and send message:

                Engine::FIXMessage* msg = Engine::FIXMsgFactory::singleton()->newSkel( Engine::FIX50, "D", Engine::FIXT11 );

                // ... - fill message with data 

                pSn->put( msg ); // send message to the remote site
                msg->release();  // release resources assigned with message

See also: Sending order | Send message | Send message

FIX to FAST mapping

As far as FAST does not support full range of FIX types mapping between FAST and FIX types is needed. The following table lists all conversion paths.
FAST typeFIX application typeComments
u32i32Value must be in range [0, 2^31)
u64i64Value must be in range [0, 2^63)
u32i64Value must be in range [0, 2^32)
u64u32
u32u64Value must be in range [0, 2^32)
i32u64Value must be in range [0, 2^31)
i32i64Value must be in range (-2^31, 2^31)
i64i32
u64i32
u32charValue must be in range [0, 2^7)
u64Engine::UTCTimestampTypeValue is serialized/deserialized to u64 using format yyyyMMddhhmmsszzz (i.e. 2008-01-02 03:04:05.678 will be transferred as 20080102030405678)
u32Engine::LocalMktDateTypeValue is serialized/deserialized to u32 using format yyyyMMdd (i.e. 2008-01-02 will be transferred as 20080102)
u64Engine::LocalMktDateTypeValue is serialized/deserialized to u64 using format yyyyMMdd (i.e. 2008-01-02 will be transferred as 20080102)
u32Engine::UTCTimeOnlyTypeValue is serialized/deserialized to u32 using format hhmmsszzz (i.e. 03:04:05.678 will be transferred as 20080102030405678)
u64Engine::UTCTimeOnlyTypeValue is serialized/deserialized to u64 using format hhmmsszzz (i.e. 03:04:05.678 will be transferred as 20080102030405678)
u32Engine::DecimalFractional part of decimal value will be truncated. Value must be in range [0, 2^32)
asciiEngine::Decimal
u64Engine::DecimalFractional part of decimal value will be truncated. Value must be in range [0, 2^64)
i32Engine::DecimalFractional part of decimal value will be truncated. Value must be in range (-2^31, 2^31)
u32asciiValue of string should be an integer in range [0, 2^32)
u64asciiValue of string should be an integer in range [0, 2^64)
i64asciiValue of string should be an integer in range (-2^64, 2^64)
asciiboolThe value of '\001' will be interpreted as true; otherwise it will be interpreted as false.
asciichar
asciii32
asciii64
i32char
u64Engine::MonthYearTypeValue is serialized/deserialized to u64 using format yyMMdd (i.e. 2008-01-00 will be transferred as 080100)


Generated on Fri Apr 17 12:26:08 2009 for B2BITS FIX Antenna C++ by  doxygen 1.5.6