Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Initialize FIX engine
  • Create BovespaApplication
  • Subscribe to symbol
  • Process incoming market data
  • Stop, release resources

Engine initialization

Execute the following instruction to initialize FIX engine.

...

Code Block
languagecpp
// Initializes engine.
try {
   Engine::FixEngine::init("engine.properties");
} 
catch( const Utils::Exception& ex ) {
   cout << "ERROR: " << ex.what() << endl;
}

BovespaApplication creation

You can create an BovespaApplication in three steps:

...

Code Block
languagecpp
        // Initialize parameters   
        BovespaApplicationParams params;

        // XML configs
        params.templatesFn_ = "templates.xml";
        params.configXml_ = "config.xml";

        // TCP Replay parameters
        params.tcpReplayParams_.senderCompId_ = "Sender";
        params.tcpReplayParams_.targetCompId_ = "Target";
        params.tcpReplayParams_.username_ = "username";
        params.tcpReplayParams_.password_ = "12345";
        params.tcpReplayParams_.ip_ = "1.2.3.4;";
        params.tcpReplayParams_.port_ = 3001;

        // Create Application object    
        app_ = Engine::FixEngine::singleton()->createBovespaApplication(params);

Subscription

You will start receiving market data from after you subscribe to a symbol and provide per-instrument listener.

...

Code Block
languagecpp
auto listener = new PerInstrumentListener();

BovespaSubscriptionItem item;
item.symbol_ = symbol;

app_->subscribeToInstrument(item, listener);

Releasing resources

Use the BovespaApplication::release() method to release the resources. Calling unsubscribe is optional.

Full sample

The sample below illustrates all above mentioned instructions combined in one application.

...