Hi,
Quote:
My first question is how the order state changes
Please consider added diagram.
A function
closeOrders closes only filled orders. An order became closed(IOrder.State.CLOSED) only after its filled (IOrder.State.FILLED).
Quote:
My second question is whether it's possible to close such an order
It is possible, use a function
close. Consider following example:
for (IOrder o : context.getEngine().getOrders()){
if(o.getState() == IOrder.State.OPENED || o.getState() == IOrder.State.FILLED){
o.close();
}
}
If you close an order that isn't filled, it became in the state IOrder.Satate.CANCELED.