INNER CODE UNIT · Java
hasUnboughtOrders
qtds35k/HighFrequencyTradingBot · src/trading/Main.java:146
private static boolean hasUnboughtOrders(Map<String, OrderCycle> orderMap) {
for (Map.Entry<String, OrderCycle> entry : orderMap.entrySet()) {
OrderCycle order = entry.getValue();
if (order.getState() == 1)
return true;
}
return false;
}
// in addition to simple order handling, this method picks out unbought orders
// and check if its priceToBuy matches current bid price
// if not, cancel it (a new one will be placed during the next loop)
private static boolean handleMarketMakerOrders(Map<String, OrderCycle> marketMakerOrderMap, HttpHelper hh, Manager bigBoss) throws IOException, InterruptedException {
boolean adjustCounter = false;
for (Map.Entry<String, OrderCycle> entry : marketMakerOrderMap.entrySet()) {
OrderCycle order = entry.getValue();
order.updateOrderStatus(); // SELLs may happen here