B2BITS FIX Antenna C++ 2.33.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Bats::UnitService Class Referenceabstract

Represents single BATS unit. More...

#include <B2BITS_BatsUnitService.h>

Public Member Functions

virtual void connect (ServiceListener *serviceListener)=0
 Connects the service to the mutlicast group.
 
virtual void disconnect ()=0
 Disconnects the service from the mutlicast group.
 
virtual ApplicationgetApplication () const =0
 Returns @Application.
 
virtual const std::string & getChannelID () const =0
 Returns channel id.
 
virtual IUdpMock * getMock ()=0
 
virtual const RuntimeParametersgetParams () const =0
 Returns parameters.
 
virtual System::u8 getUnitID () const =0
 Returns unit id.
 
virtual bool hasInstrumentSubscriptions () const =0
 Checks if service has instrument subscriptions.
 
virtual bool isConnected ()=0
 Returns true if service is in connected state.
 
virtual void setCredentials (const std::string &userName, const std::string &password, const std::string &subId)=0
 Sets SPIN/GRP credentials.
 
virtual void subscribeToInstrument (const std::string &symbol, System::u16 depth, InstrumentListener *listener, bool dispatchMessages=true)=0
 Subscribe listener to updates for particular symbol.
 
virtual void subscribeToSymbolMapping (SymbolMappingListener *listener)=0
 Subscribe listener to symbol mapping messages.
 
virtual void unsubscribeFromInstrument (const std::string &symbol)=0
 Unsubscribe symbol listener.
 
virtual void unsubscribeFromSymbolMapping (SymbolMappingListener *listener)=0
 Unsubscribe symbol mapping listener.
 

Detailed Description

Represents single BATS unit.

Member Function Documentation

◆ connect()

virtual void Bats::UnitService::connect ( ServiceListener * serviceListener)
pure virtual

Connects the service to the mutlicast group.

Starts all threads required by the service. serviceListener should stay alive until service is disconnected. Service becomes connected if this method succeds

Parameters
serviceListenerOptional listener to receive notification from the unit
Exceptions
Utils::Exceptionif error eccurs
See also
isConnected(), disconnect()

◆ disconnect()

virtual void Bats::UnitService::disconnect ( )
pure virtual

Disconnects the service from the mutlicast group.

This method returns returns immediately, service becomes disconnected only after ServiceListener::Notification::Disconnected notification. Does nothing if service is already disconnected.

Exceptions
no
See also
isConnected(), connect()

◆ getApplication()

virtual Application * Bats::UnitService::getApplication ( ) const
pure virtual

Returns @Application.

Returns
Bats::Application that owns this service
Exceptions
no

◆ getChannelID()

virtual const std::string & Bats::UnitService::getChannelID ( ) const
pure virtual

Returns channel id.

Returns
Id of the channel, specified as channel@id attribute in XML configuration file
Exceptions
no

◆ getMock()

virtual IUdpMock * Bats::UnitService::getMock ( )
pure virtual

◆ getParams()

virtual const RuntimeParameters & Bats::UnitService::getParams ( ) const
pure virtual

Returns parameters.

Returns
Parameters used by service
Exceptions
no

◆ getUnitID()

virtual System::u8 Bats::UnitService::getUnitID ( ) const
pure virtual

Returns unit id.

Returns
Id of the unit specified as unit@id attribute in XML configuration file
Exceptions
no

◆ hasInstrumentSubscriptions()

virtual bool Bats::UnitService::hasInstrumentSubscriptions ( ) const
pure virtual

Checks if service has instrument subscriptions.

◆ isConnected()

virtual bool Bats::UnitService::isConnected ( )
pure virtual

Returns true if service is in connected state.

Returns
true if service is connected
Exceptions
no
See also
connect(), disconnect()

◆ setCredentials()

virtual void Bats::UnitService::setCredentials ( const std::string & userName,
const std::string & password,
const std::string & subId )
pure virtual

Sets SPIN/GRP credentials.

Parameters
userNamemust not exceed 4 characters
passwordmust not exceed 10 characters
SessionsubId, must not exceed 4 characters
Exceptions
Utils::Exceptionif parameters are incorrect

◆ subscribeToInstrument()

virtual void Bats::UnitService::subscribeToInstrument ( const std::string & symbol,
System::u16 depth,
InstrumentListener * listener,
bool dispatchMessages = true )
pure virtual

Subscribe listener to updates for particular symbol.

Parameters
symbolName of BATS symbol, must not exceed 8 characters
depthDepth of order book, if set to 0 incremental updates will not be delivered
listenerRequired observer to receive messages and updates
dispatchMessagesWhen set to true service delivers raw PITCH messages
Exceptions
Utils::Exceptionif error occurs
Note
It is allowed to subscribe after service has been connected to the feed and received some data. Since it is not possible to restore actual state for a single BATS symbol, subscribing in this case leads to whole unit reset and recovery from Spin server, unless natural refresh is used. In case of natural refresh, just subscribed listener would be notified via onReset with ResetReason::rrNaturalRefresh

◆ subscribeToSymbolMapping()

virtual void Bats::UnitService::subscribeToSymbolMapping ( SymbolMappingListener * listener)
pure virtual

Subscribe listener to symbol mapping messages.

Parameters
listenerObserver to receive mapping messages from unit, cannot be null cannot be used twice
Exceptions
Utils::Exceptionparameter is incorrect or if error occurs

◆ unsubscribeFromInstrument()

virtual void Bats::UnitService::unsubscribeFromInstrument ( const std::string & symbol)
pure virtual

Unsubscribe symbol listener.

Parameters
listenerListener to unsubscribe
Exceptions
Utils::Exceptionif error occurs

◆ unsubscribeFromSymbolMapping()

virtual void Bats::UnitService::unsubscribeFromSymbolMapping ( SymbolMappingListener * listener)
pure virtual

Unsubscribe symbol mapping listener.

Parameters
listenerListener to unsubscribe
Exceptions
Utils::Exceptionif error occurs