OnixS SGX Derivatives Handler for C++  2.17.0.0
Public Member Functions | Static Public Member Functions | List of all members
Handler Class Reference

High-level handler abstraction. More...

Public Member Functions

 Handler (const Settings &config)
 
void subscribe (const InstrumentSubscription &sub)
 Subscribe to instrument(s). Call this member before login.
 
bool unsubscribe (const InstrumentSubscription &sub)
 Unsubscribe instrument(s). More...
 
void login (const UserAccounts &accounts, const std::string &programId, bool force=false)
 Establishes the connection to the SGX gateway. More...
 
bool isLoggedIn ()
 Returns true if Handler object is connected.
 
void logout ()
 Logs out and stops the Handler.
 
void logoutAsync ()
 Request for logout from the SGX gateway. More...
 
void restart ()
 Restart sessions.
 
void restartAsync ()
 Request for restart sessions. More...
 
void changePassword (const std::string &loginId, const std::string &oldPassword, const std::string &newPassword)
 Changes the current password.
 
HandlerState::Enum getState () const
 Get handler state.
 
void log (LogLevel::Enum logLevel, const char *logMessage, size_t length)
 Logs the given user-level message to the handler log.
 
void log (LogLevel::Enum logLevel, const char *logMessage)
 Logs the given user-level message to the handler log.
 
void log (LogLevel::Enum logLevel, const std::string &str)
 Logs the given user-level message to the handler log.
 
void registerErrorListener (ErrorListener *listener)
 Registers the error listener.
 
void registerDedicatedStopOrderChangeListener (DedicatedStopOrderChangeListener *listener)
 Registers the Exchange message listener.
 
void registerMarketInfoListener (MarketInfoListener *listener)
 Registers the Market Info listener.
 
void registerExchangeMessageListener (ExchangeMessageListener *listener)
 Registers the Exchange message listener.
 
void registerFirmOrderBookListener (FirmOrderBookListener *listener)
 Registers the Firm Order Book listener.
 
void registerInstrumentStatusListener (InstrumentStatusListener *listener)
 Registers the Instrument Status Update listener.
 
void registerInstrumentDefinitionListener (InstrumentDefinitionListener *listener)
 Registers the Instrument Definitions listener.
 
void registerPriceDepthListener (PriceDepthListener *listener)
 Registers the price depth listener.
 
void registerIncrementalPriceDepthListener (IncrementalPriceDepthListener *listener)
 Registers the price depth incremental listener.
 
void registerFullOrderDepthChangeListener (FullOrderDepthChangeListener *listener)
 Registers the full order depth change listener.
 
void registerTradeInfoListener (TradeInfoListener *listener)
 Registers the trade information listener (market-data user only). More...
 
void registerTradeListener (TradeListener *listener)
 Registers the trade listener.
 
void registerDetailedTradeInfoListener (DetailedTradeInfoListener *listener)
 Registers the detailed trade information listener (trading user only). More...
 
void registerHandlerStateListener (HandlerStateListener *listener)
 Register the handler status listener.
 
void registerExchangeListener (ExchangeListener *listener)
 Registers the exchange listener.
 
void registerPreliminarySettlementPriceListener (PreliminarySettlementPriceListener *listener)
 Registers the preliminary settlement price listener.
 
void registerMissingTradeListener (MissingTradeListener *listener)
 Registers the missing trade listener.
 
void enterOrder (const OrderRecord &order)
 Enters a new order. More...
 
void enterOrder (MultiOrderRecord &order)
 
void alterOrder (const OrderRecord &order, int32 balanceQuantity)
 This transaction is used to send orders that have led to closings outside the Exchange. More...
 
void cancelOrder (const OrderId &orderId)
 Cancels the existing order by the given exchange order Id.
 
void cancelOrder (const std::string &orderId)
 Cancels existing order by the given client Id.
 
void cancelInactiveOrders (const std::string &symbol)
 Delete inactive orders for series.
 
void restoreOwnDeals (const OMexDate &date, const InstrumentTypeId &instrument, unsigned firstSeqNum, unsigned lastSeqNum)
 Restore own deals history.
 
void queryPreliminarySettlementPrices (const SeriesId &seriesId, const OMexDate &settlementDate, SettlementPriceType::Enum settlementPriceType)
 Query Preliminary Settlement Prices. More...
 
const BusinessDategetBusinessDate () const
 Get current business date.
 
uint32 getMultiOrderMaxSize () const
 Get maximum number of orders in multi-order transaction.
 
const std::string & licenseExpirationDate () const
 Get the license expiration date.
 

Static Public Member Functions

static const std::string & version ()
 Version of handler.
 

Detailed Description

High-level handler abstraction.

Each method can throw:

Exceptions
ArgumentExceptionInvalid parameters in Handler class methods call.
InvalidOperationExceptionMethod call is invalid for object's current state.
OmnApiExceptionError during OMN API operation.
SystemExceptionSystem-level errors on local side.

Member Function Documentation

void alterOrder ( const OrderRecord order,
int32  balanceQuantity 
)

This transaction is used to send orders that have led to closings outside the Exchange.

Alter existing order by the given order information.

Parameters
orderChanged order.
balanceQuantityIf the field balance_quantity_i is provided the system checks this quantity against the existing total volume of the order prior to applying the amendment. If the two match then the amendment is applied, if not, an error is returned.
Note
When altering the time validity of an order, the system will take the new time relative to when the alter transaction was received by the Central System.
void enterOrder ( const OrderRecord order)

Enters a new order.

Note
Order record will be completed with exchange order Id and series.
void login ( const UserAccounts &  accounts,
const std::string &  programId,
bool  force = false 
)

Establishes the connection to the SGX gateway.

Parameters
accountsThe exchange account. In multisession mode first account should be "market data" account and other accounts should be "trading" accounts.
programIdProgram id of the application. Example: "QUICKTRADE V24-3".
forceFlag for normal/forced login. Login normal: Fail if same user id has been login in another session. Login normal: Will terminate the existing session with same user id, and login as new session.
void logoutAsync ( )

Request for logout from the SGX gateway.

Note that you can't delete handler until logout is done

void queryPreliminarySettlementPrices ( const SeriesId seriesId,
const OMexDate settlementDate,
SettlementPriceType::Enum  settlementPriceType 
)

Query Preliminary Settlement Prices.

Parameters
seriesIdis either zero filled or filled with Country Code, Market Code and Commodity Code.
settlementDateSettlement Date.
settlementPriceTypeSettlement Price Type.
void registerDetailedTradeInfoListener ( DetailedTradeInfoListener listener)

Registers the detailed trade information listener (trading user only).

This callback is result of BD4 processing.

void registerTradeInfoListener ( TradeInfoListener listener)

Registers the trade information listener (market-data user only).

This callback is result of BD1 processing.

void restartAsync ( )

Request for restart sessions.

Note that you can't delete handler until restart is done

bool unsubscribe ( const InstrumentSubscription sub)

Unsubscribe instrument(s).

Call this member before login.

Returns
True if Handler was subscribed to given instrument(s) before.