FIX Antenna ANSI C  2.18.0
 All Data Structures Variables Pages
FIX Message

Creating FIX message

A message can be created by create skeleton and set fields

To create a framework for a FIX application-level message, use the B2BITS_FIXMsgFactory_NewSkel(B2BITS_FIXVersion ver, const char *aMsgType, B2BITS_FIXVersion ftver) method. Thereafter you can set the desired field values of the message and send it to the counter-party.

For example:

order = B2BITS_FIXMsgFactory_NewSkel(B2BITS_FIX44, "D", B2BITS_NA);
B2BITS_FIXMessage_SetAsCString(order, B2BITS_FIXField_ClOrdID, "USR20000101");
B2BITS_FIXMessage_SetAsCString(order, B2BITS_FIXField_HandlInst, "2");
//...
B2BITS_FIXMessage_SetAsCString(order, B2BITS_FIXField_Symbol, "IBM");

Get field

Use the B2BITS_FIXMessage_GetAs..(B2BITS_FIXMessage msg, int tag) methods to get the FIX field value.

This method retrieves the field value by tag number. The field can be:

  1. Not defined for this message type by specification.
  2. Defined as optional for this message type by specification and absent in this message instance.
  3. Defined for this message type by specification and present in this message instance.

Setting field

Use the B2BITS_BOOL B2BITS_FIXMessage_SetAs..() methods to set a field value.

This method returns "true" if the given tag is found and the old value is replaced with the new one. Otherwise the method returns "false" (the given tag is inserted).

Remove field

Use the B2BITS_FIXMessage_Remove(B2BITS_FIXMessage msg, int tag) method to remove a field by tag.

This method returns "true" if the given tag is found and the field is removed. Otherwise the method returns "false".

Repeating group

The B2BITS_FIXGroup cover class is intended for working with Repeating Groups. It is possible to get this object using the B2BITS_FIXMessage_GetGroup(int aTag) function, where aTag is a tag, corresponding to the group (leading tag), a pointer to which can be obtained. On completing the work with the object, it can be removed using the B2BITS_FIXGroup_Release(B2BITS_FIXGroup* apGroup) function, where apGroup is a pointer to the object.

When setting the new value to the tag determining group size, the object is re-created and old field values inside the group are erased.

The functions B2BITS_FIXGroup_.. similar to B2BITS_FIXMessage functions, however in contrast to them, there is an additional argument defining index (a sequence number starting with 0) of the group entry, for example:

Use the B2BITS_FIXMessage_Remove(..., int tag) method , where tag is a Repeating Group Leading Tag, to remove the Repeating Group. Setting the corresponding tag to zero is not allowed.

Release message

To deallocate resources used by FIX message, use the B2BITS_FIXMessage_Release(B2BITS_FIXMessage *apMsg) function.

For example:

// The user is responsible for the deallocation
B2BITS_FIXMessage_Release(pFIXMessage);