@Override public void error(int id, int errorCode, String errorMsg) { System.out.println( "ERROR by API for ID " + id + " with error code " + errorCode + " and message " + errorMsg); if (errorMsg.contains("pacing violation")) { OpenRequest or = open_request_map.remove(id); System.out.println("received"); if (or.long_short_volatility == 0) { data_set.release_lt_sem(or.company); } else if (or.long_short_volatility == 1) { data_set.release_st_sem(or.company); } else { // TODO probably going to have to handle this differently. } } // TODO }
@Override public void historicalData( int reqId, String date, double open, double high, double low, double close, int volume, int count, double WAP, boolean hasGaps) { OpenRequest or; boolean end = (volume == -1); if (end) { or = open_request_map.remove(reqId); if (or.long_short_volatility == 1) // data_set.lt_semaphore[or.company.ordinal()].release(); data_set.st_semaphore[or.company.ordinal()].release(); } else { or = open_request_map.get(reqId); if (or.long_short_volatility == 2) { volatility_data_set.add_raw_data(or.company, WAP); } else if (or.long_short_volatility == 1) { System.out.println("COMPANY:" + or.company.name() + " WAP:" + WAP + " ST"); data_set.set_st_data(or.company, WAP); } else { data_set.set_lt_data(or.company, WAP); System.out.println("COMPANY:" + or.company.name() + " WAP:" + WAP + " LT"); } } }