I am currently developing a Java application for trading using Interactive Broker's API. I have encountered an issue and I am unsure what I am doing incorrectly or whether this is a bug in the API.
At this point I can currently submit my orders using the following call:
m_controller.placeOrModifyOrder( m_contract, m_order, new IOrderHandler() {
@Override
public void orderStatus(OrderStatus status, int filled, int remaining, double avgFillPrice, long permId, int parentId, double lastFillPrice, int clientId, String whyHeld) {
/*dbgMsg(String.format("Status: %s - Filled: %d - Remaining: %d - Avg F px: %f - Permid: %d - Parentid: %d - Last Fill Px: %f - Client id: %d - WhyHeld: %d",
status.toString(),
filled,
remaining,
avgFillPrice,
permId,
parentId,
lastFillPrice,
clientId,
whyHeld));*/
System.out.println("Order Status");
}
@Override
public void orderState(NewOrderState orderState) {
m_controller.removeOrderHandler( this);
System.out.println("Order state "+orderState.toString());
// TODO Auto-generated method stub
//dbgMsg(orderState.toString());
}
@Override
public void handle(int errorCode, String errorMsg) {
//dbgMsg(String.format("ORDER ERROR [%d]: %s", errorCode, errorMsg));
System.out.println("Order Error: "+errorMsg);
}
});
The issue that I am encountering is that while the order is transmitted and filled on Trader Workstation through the API, I do not receive any updates for the order that has been created.
I have also verified that I am in fact receiving the order updates through the ILiveOrdersHandler which basically provides the status updates for all orders.
I do not know whether this is a programming issue on my part or an issue with the underlying API; I have also confirmed this behavior on the provided sample code from IB, by adding System.out.println() calls to the corresponding handler in their program.
Any help would be greatly appreciated.