Page tree
Skip to end of metadata
Go to start of metadata

Fix Antenna C++ processes messages in Incremental Feed with tag SecuritID (48) and calls callbacks from Bovespa::InstrumentListener.

In case of Security Status (35=f) messages it will be called Bovespa::InstrumentListener::process( BovespaSubscriptionItem const& subsItem, Engine::FIXMessage  const* msg ) callback.

Bovespa Exchange can send Security Status for groups of Instrument using  SecurityGrpoup (1151) tag as well, in this case FixAntenna doesn't call InstrumentListener callbacks.

Further step-by-step guide describes how to process this kind of messages.

Step-by-step guide

 

  1. Create map where SecurityIDs are associated with SecurityGroup.
  2. Fill this map on interested SecurityIDs using Bovespa::InstrumentListener::onSecurityDefinition callback:

    bool MyInstrumentListener::onSecurityDefinition( BovespaSubscriptionItem const& subsItem, Engine::FIXMessage const& dMsg )
    {
    //. . .
        Engine::TagValue const* entry = msg.getGroup( FIXFields::NoRelatedSym )->getEntry( 0 );
        if(entry->isSupported( FIXFields::SecurityGroup ) && entry->hasValue(FIXFields::SecurityGroup))
        {
            std::string securityGroup_ = entry->getAsString( FIXFields::SecurityGroup ).toStdString();
        std::string securityID = entry->getAsString( FIXFields::SecurityID ).toStdString();
        // fill map SecurityIDs by SecurityGroup
        //. . .
        }
    //. . .
    } 
  3. Create MyFeedListener implementing Bovespa::FeedListener interface.

  4. Subscribe to feed with MyFeedListener to get Security Status messages using any of this methods:

    /// subscribe to all messages on specified by feedId feed
    /// @note tcp recovery feed is not supported for subscription, but you can enable TCP recovery for incremental feeds to recovery missed messegs
    void Bovespa::BovespaApplication::subscribeToFeed( FeedListener* feedListener, std::string const& feedID );
    /// subscribe to all messages on specified from incremental feed on specified by channel_id
    /// @note tcp recovery feed is not supported for subscription
    /// @note set channel_id = "", to subscribe to all incrementall feeds
    /// @note onSubscribe and onUnsubscribe method will be called for each channel
    /// @note you can enable TCP recovery for incremental feeds to recovery missed messegs
    void  Bovespa::BovespaApplication::subscribeToIncrementalFeed( FeedListener* feedListener, std::string const& channel_id = 0 );
  5. Process Security Status messages in MyFeedListener ::onMessage() callback:

    void MyFeedListener::onMessage( std::string const& channelId, std::string const& feedId, Engine::FIXMessage const& dMsg )
    {
        if (dMsg.type() == "f")
        {
            if(dMsg.isSupported(FIXFields::SecurityGroup) && dMsg.hasValue(FIXFields::SecurityGroup))
            {
                std::string securityGroup_ = dMsg.getAsString( FIXFields::SecurityGroup ).toStdString();
                // process status message for Security Group
                // . . .
            }
        }
    }

 

Note:

One message may be the cause of two callbacks: