Exemplo n.º 1
0
 /**
  * Constructor for Candle.
  *
  * @param tradingday Tradingday
  * @param contract Contract
  */
 public Candle(
     Contract contract,
     Tradingday tradingday,
     RegularTimePeriod period,
     ZonedDateTime lastUpdateDate) {
   this.setTradingday(tradingday);
   this.setContract(contract);
   this.setPeriod(period.toString());
   this.setStartPeriod(period.getStart());
   this.setEndPeriod(period.getEnd());
   int barSize =
       (int) (TradingCalendar.getDurationInSeconds(period.getStart(), period.getEnd()) + 1);
   this.setBarSize(barSize);
   this.setLastUpdateDate(lastUpdateDate);
 }
Exemplo n.º 2
0
 /**
  * Constructor for Candle.
  *
  * @param contract Contract
  * @param open double
  * @param high double
  * @param low double
  * @param close double
  * @param lastUpdateDate Date
  */
 public Candle(
     Contract contract,
     RegularTimePeriod period,
     double open,
     double high,
     double low,
     double close,
     ZonedDateTime lastUpdateDate) {
   this.setContract(contract);
   this.setPeriod(period.toString());
   this.setStartPeriod(period.getStart());
   this.setEndPeriod(period.getEnd());
   Duration duration = Duration.between(period.getStart(), period.getEnd());
   int barSize = (int) (duration.getSeconds() + 1);
   this.setBarSize(barSize);
   this.setOpen(new BigDecimal(open));
   this.setClose(new BigDecimal(close));
   this.setHigh(new BigDecimal(high));
   this.setLow(new BigDecimal(low));
   this.setLastUpdateDate(lastUpdateDate);
 }