B2BITS FIX Antenna C++ 2.32.0
Loading...
Searching...
No Matches
FAST support

Preface

This article describes the FIX-over-FAST connectivity using B2BITS FIX Antenna C++ (tm) library. It is supposed that the 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 capabilities for transporting high-volume market data feeds and ultra-low latency applications.

Using B2BITS FIX Antenna C++(tm) the user can establish connection with FIX-over-FAST oriented remote site. Current users are also 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, the user should create an instance of the Engine::Session class using the Engine::FixEngine::createSession method with an appropriate value of underlyingProtocolType parameter (see also Session description). The following sample demonstrates the creation of a FIX 5.0 over FIXT 1.1 over FAST session.

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
Appl appl;
// create a session for FIX 5.0 using FIXT.1.1 as SCP layer over FAST
&appl, // pApp
"SENDER", // senderCompID
"TARGET", // targetCompID
Engine::FIX50, // ver - FIX 5.0 application protocol version
NULL, // pParam
Engine::FIXT11_FAST_TCP // underlyingProtocolType - create FIXT 1.1 over FAST sub-layer
);
// ... - business logic
// release resources
pSn->release();
} catch(const Utils::Exception& ex) {
cout << "EXCEPTION: " << ex.what() << endl;
}
}
Generic application interface.
Definition B2BITS_Application.h:82
Session * createSession(Application *pApp, const std::string &senderCompID, const std::string &targetCompID, FIXVersion appVer=NA, const SessionExtraParameters *pParam=NULL, const MessageStorageType storageType=default_storageType, UnderlyingProtocol underlyingProtocolType=FIX_TCP)
Creates a new FIX Session.
static FixEngine * init(InitParameters const &params)
Initializes the Engine.
static FixEngine * singleton()
Returns an instance of this class.
static void destroy()
Destroys the instance of this class.
FIX Session.
Definition B2BITS_Session.h:171
Generic application exception.
Definition B2BITS_Exception.h:76
virtual const char * what() const
Returns the reason for this exception.
virtual long release() const
Decrements reference counter.
@ FIXT11_FAST_TCP
FIX over FIXT.1.1 over FAST.
Definition B2BITS_PubEngineDefines.h:518
@ FIX50
FIX 5.0.
Definition B2BITS_PubEngineDefines.h:85
const MessageStorageType persistent_storageType
File storage - slow and safe.
Definition B2BITS_PubEngineDefines.h:435
STL namespace.

See also: Application description

Establish connection

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

  • as initiator
  • as acceptor

The following sample demonstrates how to establish a session as the initiator. The server is supposed to be located at localhost and 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
virtual void connect(SessionRole sessionRole=NA_SESSION_ROLE, const SessionBackupParameters *pSessionBackupParameters=NULL)=0
Establishes the FIX session.

The following sample demonstrates how to accept an 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 the connection is established the user is able to receive application messages. The process method of the Engine::Application class has to be implemented to process incoming messages.

Send message

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

// ... - fill message with data
pSn->put( msg ); // send message to the remote site
msg->release(); // release resources assigned with message
Basic FIX message.
Definition B2BITS_FIXMessage.h:81
virtual void release() const =0
Releases FIX message instance.
static FIXMsgFactory * singleton()
Returns the instance of the class.
virtual FIXMessage * newSkel(FIXVersion ver, const char *msgType, FIXVersion ssnver=NA) const =0
Creates the new skeleton of the application message and returns it.
virtual void put(FIXMessage *pMsg, PutMessageOptions const *options=NULL)=0
Sends the given message to the remote FIX engine.
@ FIXT11
FIXT 1.1.
Definition B2BITS_PubEngineDefines.h:89

See also: Send message | Send message

FIX to FAST mapping

Since FAST does not support full range of FIX types, mapping between FAST and FIX types is needed. The table below contains 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::MonthYearType

Value is serialized/deserialized to u64 using format yyMMdd (i.e. 2008-01-00 will be transferred as 080100)