114 using SessionPtr = std::unique_ptr<Session>;
115 using OrderBook =
Book;
123 OrderBook orderBook_;
128 std::vector<std::shared_ptr<std::vector<uint8_t>>> instruments_;
131 std::vector<std::pair<Int32, Int32>> quoteSetId_;
134 SessionPtr busSession_;
135 SessionPtr bgwSession_;
147 static void checkConnected(
const SessionPtr& sn,
const char* kind);
149 template<
class Message>
150 static void send(
const SessionPtr& sn, Message&& msg);
154 template <
typename MsgType>
155 static void setCommonMessageFields(
Order& order, MsgType&& msg);
160 #define ONIXS_ICE_TRADING_CLIENT_MSG_CALLBACK(Msg) \
161 void on##Msg(const Msg msg, Session* sn) override {CUI::Screen::traceMsg(sn->id(), msg, CUI::Screen::Direction::In);}
164 void onError(
SessionErrorReason::Enum reason,
const std::string & description, Session * sn, Messaging::SbeMessage)
override;
165 void onWarning(
SessionWarningReason::Enum reason,
const std::string & description, Session * sn, Messaging::SbeMessage)
override;
167 void onMessageSending(
char*,
size_t, Session*)
override;
168 void onIPReport(
const Messaging::IPReport msg, Session* sn)
override;
169 void onSecurityDefinitionReport(
const Messaging::SecurityDefinitionReport msg, Session* sn)
override;
170 void onSecurityDefinitionReport_Strategy(
const Messaging::SecurityDefinitionReport_Strategy msg, Session* sn)
override;
172 void onExecutionReport_New(
const Messaging::ExecutionReport_New msg, Session* sn)
override;
173 void onExecutionReport_Reject(
const Messaging::ExecutionReport_Reject msg, Session* sn)
override;
174 void onExecutionReport_Cancel(
const Messaging::ExecutionReport_Cancel msg, Session* sn)
override;
175 void onExecutionReport_Modify(
const Messaging::ExecutionReport_Modify msg, Session* sn)
override;
176 void onExecutionReport_Trade(
const Messaging::ExecutionReport_Trade msg, Session* sn)
override;
177 void onExecutionReport_Snapshot(
const Messaging::ExecutionReport_Snapshot msg, Session* sn)
override;
178 void onNewOrderCrossReport(
const Messaging::NewOrderCrossReport msg, Session* sn)
override;
194template<
class Message>
195void TradingClient::send(
const SessionPtr& sn, Message&& msg)
197 sn->send(std::forward<Message>(msg));
200template <
typename MsgType>
201void TradingClient::setCommonMessageFields(
Order& order, MsgType&& msg)
#define ONIXS_ICE_TRADING_CLIENT_MSG_CALLBACK(Msg)
BGW session connection credentials.
Contains the SimpleOpenFramingHeader, the SBE message, and the data buffer.
Order::OrderId BookEntryId
void createStrategy()
Creates a strategy.
void traderLogout()
Logs the trader out from the BGW session.
TradingClient(const Settings &settings)
Initializes the client with the given settings.
void listInstruments()
Prints the list of instruments currently known to the client.
void requestBgwCredentials()
Requests BGW credentials (IpRequest) over the active BUS session.
void connectBus()
Commands.
void connectBgw()
Establishes a BGW session using previously obtained credentials.
void createFlex()
Creates a flexible instrument (flex).
void sendOrderCross()
Sends a cross order.
void sendMassCancel()
Submits a mass cancel request.
void replaceOrder()
Issues a replace for an existing live order.
void lookupInstruments()
Prints the list of instruments currently known to the client by the provided Symbol value.
void sendQuoteCancelRequest()
Cancels a previously submitted quote.
void cancelOrder()
Sends a cancel request for a specific order.
void sendOrder()
Sends a new order via BGW.
void sendMassQuote()
Sends a multiple quote request.
void showActiveOrders()
Displays active orders sent by this client session and their last-known statuses.
void showOrders()
Displays orders sent by this client session and their last-known statuses.
void sendQuote()
Sends a quote message.
void traderLogon()
Logs a trader into the connected BGW session.
void requestInstruments()
Submits a SecurityDefinitionRequest to fetch/refresh known instruments.
MessageHolder< CancelReplaceRequest > CancelReplaceRequestMsg
constexpr size_t MassQuoteRequestMaxEntriesCount
MessageHolder< OrderMassCancelRequest > OrderMassCancelRequestMsg
MessageHolder< SecurityDefinitionRequest > SecurityDefinitionRequestMsg
constexpr size_t NewOrderCrossRequestMaxEntriesCount
std::shared_ptr< CrossOrder > CrossOrderPtr
MessageHolder< NewOrderRequest > NewOrderRequestMsg
constexpr size_t QuoteCancelRequestMaxEntriesCount
MessageHolder< QuoteRequest > QuoteRequestMsg
std::optional< std::shared_ptr< T > > OptionalRef
Manages an optional contained reference.
MessageHolder< MassQuoteRequest, getMaxMessageSize< MassQuoteRequest >(MassQuoteRequestMaxEntriesCount)> MassQuoteRequestMsg
MessageHolder< QuoteCancelRequest, getMaxMessageSize< QuoteCancelRequest >(QuoteCancelRequestMaxEntriesCount)> QuoteCancelRequestMsg
std::shared_ptr< Order > OrderPtr
Timestamp getTransactTime(MsgType &&msg, typename std::enable_if< hasTransactTime< MsgType >::value, void * >::type=nullptr)
MessageHolder< NewOrderCrossRequest, getMaxMessageSize< NewOrderCrossRequest >(NewOrderCrossRequestMaxEntriesCount)> NewOrderCrossRequestMsg
void setLeavesQty(Order &order, MsgType &&msg, typename std::enable_if< hasLeavesQty< MsgType >::value, void * >::type=nullptr)
MessageHolder< CancelRequest > CancelRequestMsg