To receive specific solicited order / fill events, you need to:
-
Create a class that is derived from ttsdk::IOrderEventHandler and provide implementations for the following methods.
-
virtual void OnExecutionReport(OrderPtr order, ExecutionReportPtr execRpt) = 0;
- Callback fired when delivering execution report messages
-
virtual void OnReject(OrderPtr order, RejectResponsePtr
rejResp) = 0;
- Callback fired when delivering order reject messages
-
virtual void OnSendFailed(OrderPtr order, const
OrderProfile& profile, const SendCode code) = 0;
- Callback fired when a request delivery surpasses the timeout threshold
-
virtual void OnUnsubscribed(const char* orderId) = 0;
- Callback fired when the unsubscribe request is complete and it is safe to destroy the handler object
-
-
Call the Subscribe() method of the OrderPtr instance
passing an instance of the class that defines your
ttsdk::IOrderEventHandler event handler.
- This is discussed further in the Submitting Orders section.
A sample implementation of class derived from ttsdk::IOrderEventHandler is demonstrated in the following code snippet.
class OrderObserver : public ttsdk::IOrderEventHandler
{
public:
OrderObserver() {}
virtual void OnExecutionReport(ttsdk::OrderPtr order,
ttsdk::ExecutionReportPtr execRpt) override
{
switch(execRpt->GetExecType())
{
case ttsdk::ExecType::New :
std::cout GetRequestId()
GetOrderStatus()) GetRequestId()
GetOrderStatus())
IsExternalAction()
GetRequestId()
GetOrderId()
GetOrderStatus())
IsExternalAction()
GetRequestId()
GetOrderId()
GetOrderStatus()) GetRequestId()
GetOrderId()
GetOrderStatus()) GetRequestId() GetOrderId() GetOrderStatus())
GetExecType()) GetRequestId()
GetOrderId() GetRejectReason())
GetText() GetOrderId()