Hi,
I have a problem that I cannot solve. I make an order in EUR/USD for 1 lot,
in the onMessage function I call order.getRequestedAmount once and order.getAmount once.
The order state is ORDER_FILLED.
getRequestAmount returns me 0.9999999
getAmount return me 0.999999
So the is one more nine in getRequestAmount.
So when I compare this two amounts to check if order has been filled totally (which is the case), result do not match.
The same happens for lot size of: 0.1,0.2 etc...
Do you have a solution ?
if(messageOrder.getState() == IOrder.State.FILLED) {
double o = messageOrder.getRequestedAmount();
double a = messageOrder.getAmount();
DecimalFormat df = new DecimalFormat("0.00000000000000000000");
console.getOut().println(key + " : order amount: "+df.format(o));
console.getOut().println(key + " : order requested amount: "+df.format(a));
int result = Double.compare(o, a);
if(result != 0) {
console.getOut().println(key + " : Order amounts do not match !");
messageOrder.setRequestedAmount(0);
}
}
order requested amount outputs: 0.99999990000000000000
order mount outputs: 0.99999900000000000000
Of course every time I get the print: Order amounts do not match !
Many thanks in advance for any answer.