The FixDictionary support following operations with FIX protocol:
For example:
#include "B2BITS_Fixopaedia.h" #include "B2BITS_FDElement.h" #include "B2BITS_Fixopaedia_Descriptions.h" using namespace Fixopaedia; // Create the FixDictionary std::auto_ptr<FixDictionary> dict(new FixDictionary()); // Modification of the FixDictionary // ... // Start the FixDictionary. FixDictionary modification will be prohibited dict->start(); // Working with the FixDictionary // ... // destruct FixDictionary dict.reset()
For example:
#include "B2BITS_Fixopaedia.h" #include "B2BITS_FDElement.h" #include "B2BITS_Fixopaedia_Descriptions.h" using namespace Fixopaedia; // Create the FixDictionary std::auto_ptr<FixDictionary> dict(new FixDictionary()); // Retrive the FIX44 protocol FDElement* protocol = dict->get("\\\\FIX44"); // Get the integer field type FDTypeInfo* ti = dict->getTypeInfo(FixDictionaryFactory::nameByFDT(FDT_INT)); // Create new description for the integer field with name 'myField' and id = 1000 FieldDescription* fd = FieldDescription::create("myField", 1000, ti, false); // Register field description in FIX44 protocol protocol->toProtocolDescriptionPtr()->registerAdditionalDescription(fd); // Retrive the 'Allocation Instruction Ack' message of the FIX44 protocol FDElement* msgP = dict->getRootElement()->get("FIX44\\P"); // Insert the 'myField' tag into the 'Allocation Instruction Ack' message (field is not required) dict->insert(fd, msgP, NULL, NOT_REQUIRED, "", true); dict->start(); // Working with the FixDictionary // ...
For example:
#include "B2BITS_Fixopaedia.h" #include "B2BITS_FDElement.h" #include "B2BITS_Fixopaedia_Descriptions.h" using namespace Fixopaedia; // Create the FixDictionary std::auto_ptr<FixDictionary> dict(new FixDictionary()); // The field 'myField' and id = 1000 was added into the 'Allocation Instruction Ack' message // Get the descriptor of the 1000 tag FDElement* fP_1000 = dict->get("\\\\FIX44\\P\\T$1000"); assert(fP_1000 != NULL); assert(1000 == fP_1000->toFieldDescription()->getTag()); FDElements fdeList; fdeList.push(fP_1000); // Remove the 'myField' tag from the 'Allocation Instruction Ack' message dict->remove(fdeList); dict->start(); // Working with the FixDictionary // ...
For example:
#include "B2BITS_Fixopaedia.h" #include "B2BITS_FDElement.h" #include "B2BITS_Fixopaedia_Descriptions.h" using namespace Fixopaedia; // Create the FixDictionary std::auto_ptr<FixDictionary> dict(new FixDictionary()); // Update FIX protocol from "exampleFIXProtocol.xml" file dict->loadXmlFile("exampleFIXProtocol.xml"); // FIX41 protocol customization - new tag 386 added into the 'Order Cancel/Replace Request' message std::string xml2("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" "<fixdics><update>" "<fixdic fixversion=\"4.1\" title=\"FIX 4.1\" date=\"2006/5/11\">" "<fielddic>" "<fielddef tag=\"386\" name=\"field386float\" type=\"float\">" "</fielddef>" "</fielddic>" "<msgdic>" "<msgdef msgtype=\"G\" >" "<field tag=\"386\"/>" "</msgdef></msgdic></fixdic>" "</update></fixdics>"); // Update the FIXDictionary dict->executeXml(xml2); dict->start(); // Working with the FixDictionary // ...
For example:
#include "B2BITS_Fixopaedia.h" #include "B2BITS_FDElement.h" #include "B2BITS_Fixopaedia_Descriptions.h" using namespace Fixopaedia; // Create the FixDictionary std::auto_ptr<FixDictionary> dict(new FixDictionary()); FDElements fdeList; // Locate the 571 tag in 'Collateral Inquiry' message bool qres = dict->query("\\\\FIX44\\BB", SEARCH_DEEP, "Type=Field, ID=571", &fdeList); assert(qres); assert(1 == fdeList.size());
<FixPath> ::= "\\", <Protocol>, "\", <MessageType>, "\", <PathNode> { , "\", <PathNode> } ; <Protocol> ::= Fix protocol version; <MessageType> ::= The type of Fix message; <PathNode> := [<Name>], ["$", <tag>] ; (*) <Name> ::= The name of dictionary entry ('T' for tags and 'G' for groups); <tag> ::= The number of tag for Field or leading tag for Group; <IndexInGroup> ::= The index of partial field in repeating group. (**)(***) (*) At least one element '<Name>' or ' "$", <tag>' must be specified. (**) IndexInGroup is zero-based. (***) IndexInGroup is always ignored by FixDictionary but can be used by dictionary-based applications for selecting partial field in repeating group.
FixPath can be absolute or relative. For absolute path FixDictionary calculates field position starting from dictionary root. For relative path FixDictionary calculates field position starting from current context (f.e. if we got a message from FixDictionary, we can query it fields by relative path, without selecting protocol and message type).
<RelativePath> ::= ".\", <PathNode> { , "\", <PathNode> } ;
The dictionary element for each iteration is searchig by following way:
For example:
\\FIX44\8\$31 - FixDictionary entry for Field with tag 31 in message of type "8" for FIX v4.4; \\FIX44\8\ClOrdID - FixDictionary entry for Field with Name "ClOrdID" in message of type "8" for FIX v4.4; \\FIX44\8\Instrument\$55 - FixDictionary entry for Field with tag 31 in block "Instrument" (The same result will be for path '\\FIX44\8\$55'); .\$25 - FixDictionary entry for Field or Group with tag 25 depending on context.
1.5.6