Exemplo n.º 1
0
 /** Sets the time of the next scheduled raid */
 private void setNextRaid(Info info) {
   String raidTime = info.getMessage().substring(13);
   raidTime = substituteTimeZone(raidTime);
   try {
     SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd HH:mm z");
     Date date = parser.parse(raidTime);
     TimeZone z = parser.getTimeZone();
     GregorianCalendar cal = new GregorianCalendar(z);
     cal.setTime(date);
     raids.put(info.getChannel(), cal);
     saveRaids();
     info.sendMessage("Raid time set.");
   } catch (ParseException e) {
     info.sendMessage(
         "Date format was bad.  Date format is like \"2008-11-26 21:45 EST\".  You entered "
             + raidTime);
   }
 }
Exemplo n.º 2
0
 private StringBuilder getHeader(String symbol1, String symbol2) {
   StringBuilder header = new StringBuilder();
   String appInfo = JArbitrager.APP_NAME + ", version " + JArbitrager.VERSION;
   header.append("# This historical data file was created by ").append(appInfo).append(LINE_SEP);
   header
       .append("# Each line represents a 1-second snapshot of the market and contains ")
       .append(BackTestFileReader.COLUMNS)
       .append(" columns:")
       .append(LINE_SEP);
   header.append("# 1. date in the MMddyy format").append(LINE_SEP);
   header.append("# 2. time in the HHmmss format").append(LINE_SEP);
   header.append("# 3. best bid for the first instrument").append(LINE_SEP);
   header.append("# 4. best ask for the first instrument").append(LINE_SEP);
   header.append("# 5. best bid for the second instrument").append(LINE_SEP);
   header.append("# 6. best ask for the second instrument").append(LINE_SEP);
   header.append(LINE_SEP);
   header.append("instruments=").append(symbol1).append(",").append(symbol2).append(LINE_SEP);
   header.append("timeZone=").append(dateFormat.getTimeZone().getID()).append(LINE_SEP);
   return header;
 }