public method IO2GLastOrderUpdateResponseReader.getUpdateType

Brief

Gets the last operation that has been performed with an order.

Declaration
C++
virtual O2GTableUpdateType  getUpdateType () = 0

Details

The possible return values are as follows:

Insert

An order is created and inserted in the Orders table.

Update

An order is updated. For example, a user changes any order property (amount, rate, etc) or an order status changes. For the possible statuses of different order types, refer to the Orders State Machines section.

Delete

An order is deleted from the Orders table. For example, an order is executed or cancelled by a user or the trading server.

Example

Getting the last order operation [hide]

   std::string updateTypeToString(O2GTableUpdateType updateType)
   {
       std::string sRes = "";
 
       switch (updateType)
       {
       case Delete:
           sRes = "Delete";
           break;
       case Insert:
           sRes = "Insert";
           break;
       case Update:
           sRes = "Update";
           break;
       default:
           sRes = "UpdateUnknown";
       }
 
       return sRes;
   }
 
   // Implementation of IO2GResponseListener interface public method onRequestCompleted
   void onRequestCompleted(const char * requestID, IO2GResponse *response)
   {
       O2G2Ptr<IO2GResponseReaderFactory> readerFactory = mSession->getResponseReaderFactory();
       if (readerFactory != NULL)
       {
           if (response->getType() == GetLastOrderUpdate)
           {
               O2G2Ptr<IO2GLastOrderUpdateResponseReader> lastOrderUpdateResponseReader = readerFactory->createLastOrderUpdateResponseReader(response);
               O2G2Ptr<IO2GOrderRow> orderRow = lastOrderUpdateResponseReader->getOrder();
               std::cout << "UpdateType: " << updateTypeToString(lastOrderUpdateResponseReader->getUpdateType()) <<
                            " Status: " << orderRow->getStatus() << std::endl;
           }
       }
   }

Declared in IO2GLastOrderUpdateResponseReader

back