Removed Order Id
This commit is contained in:
@ -28,6 +28,7 @@ package traders.ManTrader;
|
||||
import gui.OpenOrdersList;
|
||||
|
||||
import sesim.Exchange;
|
||||
import sesim.Order;
|
||||
import sesim.Order.OrderType;
|
||||
|
||||
/**
|
||||
@ -176,7 +177,7 @@ public class ManTraderConsole extends javax.swing.JPanel {
|
||||
|
||||
System.out.printf("Should buy: %f %f\n",volume,limit);
|
||||
|
||||
long createOrder = trader.getSE().createOrder(trader.getAccount().getID(),
|
||||
Order createOrder = trader.getSE().createOrder(trader.getAccount().getID(),
|
||||
trader.getSE().getDefaultStockSymbol(),
|
||||
OrderType.BUYLIMIT, volume, limit);
|
||||
System.out.printf("The retval is %d",createOrder);
|
||||
@ -193,7 +194,7 @@ public class ManTraderConsole extends javax.swing.JPanel {
|
||||
|
||||
System.out.printf("Should sell: %f %f\n",volume,limit);
|
||||
|
||||
long createOrder = trader.getSE().createOrder(trader.getAccount().getID(),
|
||||
Order createOrder = trader.getSE().createOrder(trader.getAccount().getID(),
|
||||
trader.getSE().getDefaultStockSymbol(),
|
||||
OrderType.SELLLIMIT, volume, limit);
|
||||
System.out.printf("The retval is %d",createOrder);
|
||||
@ -205,7 +206,7 @@ public class ManTraderConsole extends javax.swing.JPanel {
|
||||
|
||||
System.out.printf("Should stoploss: %f %f\n",volume,limit);
|
||||
|
||||
long createOrder = trader.getSE().createOrder(trader.getAccount().getID(),
|
||||
Order createOrder = trader.getSE().createOrder(trader.getAccount().getID(),
|
||||
trader.getSE().getDefaultStockSymbol(),
|
||||
OrderType.STOPLOSS, volume, limit);
|
||||
System.out.printf("The retval is %d",createOrder);
|
||||
|
@ -183,14 +183,16 @@ public class RandomTraderA extends AutoTraderBase implements AccountListener {
|
||||
int n = se.getNumberOfOpenOrders(account_id);
|
||||
if (n > 0) {
|
||||
Account ad = se.getAccount(account_id);
|
||||
|
||||
|
||||
|
||||
Set<Long> keys = ad.getOrders().keySet();
|
||||
|
||||
Iterator<Long> it = keys.iterator();
|
||||
while (it.hasNext()) {
|
||||
// Order od = it.next();
|
||||
boolean rc = se.cancelOrder(account_id, it.next());
|
||||
Order od = ad.getOrders().get(it.next());
|
||||
boolean rc = se.cancelOrder(account_id, od);
|
||||
}
|
||||
|
||||
}
|
||||
return n;
|
||||
|
||||
@ -405,9 +407,9 @@ public class RandomTraderA extends AutoTraderBase implements AccountListener {
|
||||
// System.out.printf("Buy Order wont work\n");
|
||||
// return false;
|
||||
// }
|
||||
long rc = se.createOrder(account_id, se.getDefaultStockSymbol(),type, volume, limit);
|
||||
Order rc = se.createOrder(account_id, se.getDefaultStockSymbol(),type, volume, limit);
|
||||
|
||||
if (rc == -1) {
|
||||
if (rc == null) {
|
||||
|
||||
// System.out.printf("Buy failed %f, %f / %f (%f)\n", volume, money, limit, ad.getMoney());
|
||||
return false;
|
||||
@ -445,8 +447,8 @@ public class RandomTraderA extends AutoTraderBase implements AccountListener {
|
||||
// return false;
|
||||
// }
|
||||
// System.out.printf("Create a Sell Order %f %f!!!!\n", volume, limit);
|
||||
long rc = se.createOrder(account_id, se.getDefaultStockSymbol(), type, volume, limit);
|
||||
return rc != -1;
|
||||
Order rc = se.createOrder(account_id, se.getDefaultStockSymbol(), type, volume, limit);
|
||||
return rc != null;
|
||||
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,7 @@ import org.json.JSONObject;
|
||||
import sesim.AutoTraderBase;
|
||||
import sesim.AutoTraderGui;
|
||||
import sesim.Account;
|
||||
import sesim.Order;
|
||||
import sesim.Order.OrderType;
|
||||
import sesim.Quote;
|
||||
|
||||
@ -166,7 +167,8 @@ public class RandomTraderB extends AutoTraderBase {
|
||||
Iterator<Long> it = keys.iterator();
|
||||
while (it.hasNext()) {
|
||||
// Order od = it.next();
|
||||
boolean rc = se.cancelOrder(account_id, it.next());
|
||||
Order od = ad.getOrders().get(it.next());
|
||||
boolean rc = se.cancelOrder(account_id, od);
|
||||
}
|
||||
}
|
||||
return n;
|
||||
|
Reference in New Issue
Block a user