Exemple #1
0
 protected Submit prepareSubmit(SymbolAnalysis a) {
   Submit s = new Submit();
   s.setSymbol(a.getTarget().getSymbol());
   s.setAction(a.getDecision().getAction());
   s.setTime(a.getDecision().getTime());
   s.setTag(a.getTag());
   if ("loss_stop".equals(a.getDecision().getReason())) {
     s.setType(Submit.Type.urgent);
   } else {
     s.setType(Submit.Type.normal);
   }
   s.setPrice(a.getDecision().getPrice());
   return s;
 }
Exemple #2
0
 private void submit(SymbolAnalysis a) {
   if (EXCLUDED_SYMBOLS.contains(a.getTarget().getSymbol())) {
     String reason = "the symbol is declared/configured as excluded explicitly";
     logger.log(
         Level.WARNING,
         "Ignore submitting the analysis - {0}, because {1}",
         new Object[] {a, reason});
     return;
   }
   try {
     Submit s = prepareSubmit(a);
     beforeSubmit(s);
     if (!s.isValid()) {
       logger.log(Level.WARNING, "Ignore invalid submit: {0} ", s);
       return;
     }
     doSubmit(s);
     afterSubmit(s);
   } catch (Throwable t) {
     String msg = "Failed to process Submit";
     logger.log(Level.SEVERE, msg, t);
   }
 }