}
private int calculateArbitrageCommodity(ArrayList<SortedSet<int[]>> arb_bs) {
- System.out.println("ARBITRAGE?");
+ //System.out.println("ARBITRAGE?");
int profit = 0;
SortedSet<int[]> buys = arb_bs.get(0);
SortedSet<int[]> sells = arb_bs.get(1);
int unitprofit = buy[0] - sell[0];
int count = buy[1] < sell[1] ? buy[1] : sell[1];
- System.out.println(" sell @"+sell[0]+" x"+sell[1]+" buy @"+buy[0]+" x"+buy[1]
- +" => x"+count+" @"+unitprofit);
+ //System.out.println(" sell @"+sell[0]+" x"+sell[1]+" buy @"+buy[0]+" x"+buy[1]
+ // +" => x"+count+" @"+unitprofit);
if (unitprofit <= 0)
break;
if (buy[1]==0) buys.remove(buy);
if (sell[1]==0) sells.remove(sell);
}
- System.out.println(" PROFIT "+profit);
+ //System.out.println(" PROFIT "+profit);
return profit;
}
for (ArrayList<String> row : data) {
String thiscommod = row.get(0);
- System.out.println("ROW "+row.toString());
+ //System.out.println("ROW "+row.toString());
if (lastcommod == null || !thiscommod.equals(lastcommod)) {
if (lastcommod != null)
arbitrage += calculateArbitrageCommodity(arb_bs);
arb_bs = new ArrayList<SortedSet<int[]>>(2);
arb_bs.add(0, new TreeSet<int[]>(compar));
arb_bs.add(1, new TreeSet<int[]>(compar));
- System.out.println("ROW init");
+ //System.out.println("ROW init");
lastcommod = thiscommod;
}
for (int bs = 0; bs < 2; bs++) {