Table of Contents |
---|
...
Encapsulated payload (http://www.cmegroup.com/confluence/display/EPICSANDBOX/Drop+Copy+4.0#DropCopy4.0-Encapsulatedpayload)
How to build CME Client sample
...
If the build is successful you will find executable file "CMEClient.exe" at "samples/CMEClient/bin".
On Linux navigate to the "samples/" folder and execute make:
...
If the build is successful you will find executable file "CMEClient" at "samples/CMEClient/bin".
CME client sample usage
Configure
...
CMESample.Port = 9026
CMESample.SenderCompId = TSTCIDN // the last symbol of SenderCompID should be N as hot faioverfailover is not supported
CMESample.SenderSubId = TST
CMESample.SenderLocationId = RU // this parameter specifies location of client and can be set arbitrarily
CMESample.Password = password123
Obtain these parameters from CME.
The properties below control market segments on CME to connect:
CMESample.MarketSegments = 99,74
CMESample.MarketSegment.99.PrimaryHost = 69.50.112.199
CMESample.MarketSegment.99.BackupHost = 69.50.112.205
CMESample.MarketSegment.74.PrimaryHost = 127.0.0.1
CMESample.MarketSegment.74.BackupHost = 69.50.112.182
IP adresses of market data segments are published by CME. For more details see http://www.cmegroup.com/confluence/display/EPICSANDBOX/New+iLink+Architecture#NewiLinkArchitecture-SFTP-MSGWConfiguration
In the sample above two market segments are configured, but there is no restriction on number of them - feel free to add all market data segments.
CMESample.ProcessMessagesOutOfOrder = true
This parameter controls how application level messages should deliver to app code. Actually CME requires that application-level messages that are received out of order are taking into account by client application. For more info see http://www.cmegroup.com/confluence/display/EPICSANDBOX/Session+Layer+-+Resend+Request
If this parameter is set to true then it is garantee that messages are delivered in right order (sequence numbers are incerementing one-by one)
If it is set to false then application - level message are delivered as soon as FIXAntenna receives them from CME.
For more details see MessageDispatcher class implementation in MessageDispatcher.cpp
Run
Before running the sample make sure you have a valid license file and it is placed to the folder specified in "samples/CMEClient/bin/engine.properties" LicenseFile parameter (default value is ./../../../engine.license, that is the root folder where you unzipped the package).
Without a valid license file FIX Engine will fail to start and you won't be able to run the sample.
Run run.bat or run.sh files depending on your platform to run the sample.
Logs for the current session will be stored in the "samples/CMEClient/bin/logs" folder.
Menu:
=============================================
1. Begin Week Logon
2. Mid Week Logon
3. In-Session Logon
4. Disconnect session
5. Set Seq Nums
6. Switch Backup to Primary Host Ip
7. Reconnect Session Mid Week
8. Send message (for Trading interface only)
9. Send Test Request message (used in In-Session Logon)
0. Exit
=============================================
After the start you will also see all needed parameters, parsed from "engine.properties" file:
...
For each particular Market Segment a separate Session is created.
After the start and after each operation this menu will be displayed.
To execute an operation enter the number (0 - 9) and hit Enter.
Let's now look at each operation from the menu in more detail:
...
The main idea of it is shown on the picture below
Green-colored: classes that are shipped within FIX Antenna's dll (a developer can't modify them) For more info on these classes please see the documenation (http://corp-web.b2bits.com/fixacpp/doc/html/)
...
Some important tips on developing an application for CME with FIX Antenna C++
FIX Session creation
It is quite important to
- specify deliverAppMessagesOutOfOrder = true in order to enable enhanced resend request scenario
- specify resendRequestBlockSize = 2500 in order meet CME limitation of 2500 msg per single resend request
- specify targetSubID as a market segment id
- create FIX Session object using Engine::SessionId that accepts the session qualifier parameter - in order to have an ability to create more than one FIX Session with the same SenderCompID and TargetCompID pair
See the code snippet below for more details:
Engine::SessionExtraParameters ssnParams;
...
Engine::FixEngine::singleton()->createSession(app, Engine::SessionId(params.senderCompID_, "CME", sessionQualifier), Engine::FIX42, ssnParams);
For the complete code sample please see the
SessionCollection::createSession( const std::string &marketSegmentId, Engine::Application* app, const Params& params)
method.
Logon to CME
In each cases of logon to CME it is required to use "custom logon" in order to specify required by CME tags:
- 1603 - ApplicationSystemName
- 1604 - TradingSystemVersion
- 1605 - ApplicationSystemVendor
- 95 - RawDataLength (used for password length)
- 96 - RawData (used for password)
For more details see
std::auto_ptr<Engine::FIXMessage> createLogonMessage(const Params& params, SessionPtr session)
...