Login Page - Create Account

Support Board


Date/Time: Fri, 14 Mar 2025 09:55:44 +0000



Post From: Sub-second order fills not shown when using GetOrderFillEntry

[2022-06-02 18:21:18]
ray42 - Posts: 21
Hi Team,

Thank you for the clarification. Then the problem seems to be that it still sometimes misses sending the info/showing the print statement. Is there anything I should optimize in the code?

Right now, the way I'm testing this is by almost spamming the buy/sell market button but this is to make sure that ALL the orders are sent successfully to the server. I verified the server logs also and it has processed everything it gets from SierraChart, but SierraChart sometimes does not send ALL the orders - especially if the order execution on the platform is done very fast.


  if (CurrentOrderFillEntrySize != PriorOrderFillEntrySize){ 
    PriorOrderFillEntrySize = CurrentOrderFillEntrySize; 
    if (CurrentOrderFillEntrySize > 0){ 
      s_SCOrderFillData OrderFillData; 
      sc.GetOrderFillEntry(CurrentOrderFillEntrySize - 1, OrderFillData); 
      SCString OrderFillMessage; 
      s_SCPositionData SCPositionData; 
      int got_position = sc.GetTradePosition(SCPositionData); 
 
      OrderFillMessage.Format("...",...); 
      SCString LogMessage; 
      LogMessage.Format("[%s] %s [x %u] @ %f [Side: %d] [fill id: %s]", 
                sc.DateTimeToString(OrderFillData.FillDateTime, FLAG_DT_COMPLETE_DATETIME_MS).GetChars(), 
                OrderFillData.Symbol.GetChars(), 
                static_cast<uint32_t>(OrderFillData.Quantity), 
                OrderFillData.FillPrice,  
                OrderFillData.BuySell, 
                OrderFillData.FillExecutionServiceID.GetChars() 
      ); 
      sc.AddMessageToLog(LogMessage, 0); 
      sc.AddMessageToLog("Preparing to send message", 0); 
       
      if (RequestState == REQUEST_NOT_SENT){ 
        if (!sc.MakeHTTPPOSTRequest(PostURL, OrderFillMessage, &HTTPHeader, NumberOfHeaders)){ 
          sc.AddMessageToLog("Error making HTTP request.", 0); 
          RequestState = REQUEST_NOT_SENT; 
        }else{ 
          RequestState = REQUEST_SENT; 
          sc.AddMessageToLog("HTTP Request Sent Successfully!", 0); 
        } 
      } 
       
      if (RequestState == REQUEST_SENT && sc.HTTPResponse != ""){ 
        RequestState = REQUEST_RECEIVED; 
        sc.AddMessageToLog(sc.HTTPResponse, 0);  
      }else if (RequestState == REQUEST_SENT && sc.HTTPResponse == ""){ 
        sc.AddMessageToLog("HTTP req NOT complete yet", 0); 
      } 
      sc.AddMessageToLog(sc.HTTPResponse, 0); 
    } 
  }

The above is the full code including the print to message log code + send to server code. If it's asynchronous, then I should be able to see ALL messages being sent even if the server is slow right? But that is not the case here. Is this a problem of the code I've written above being inefficient/slow?


Edit: I've removed almost all the print code and only kept `sc.MakeHTTPPOSTRequest(PostURL, OrderFillMessage, &HTTPHeader, NumberOfHeaders)` - the result is still missing ~10 orders.

I'm simply comparing the no. of "Making HTTTP POST request" to the no. of fills in the activity log. Most recent comparison: 88 vs 98.
Date Time Of Last Edit: 2022-06-02 18:43:33