I have noticed and verified with an additional testing code that repeatedly calling NtDirect.dll method 'OrderStatus' will keep increasing memory usage of my application.
Once I identified this issue I ran the following snippet. I place an order, get it's orderId and then call 'OrderStatus' 5,000,000 times (five million times) in a for loop as here:
for(int i = 0; i < 5000000;i++)
{
OrderStatus(orderId);
}
While this loop is executing, I keep watching TaskManager's memory usage of my application and it keeps increasing fairly fast (from 20MB to 200MB until this loop is done, the loop is done in about a minute). Once done, the memory stays at 200MB.
Anyone using this interface and doing automated trading will run into this issue once they start tracking status of their order as during an open trade one has to keep calling this method frequently (I do it every 20 milliseconds) to be able to get 'real-time' updates on their order status.
Comment