Package org.apache.stonehenge.stocktrader

Examples of org.apache.stonehenge.stocktrader.CustomQuoteBean


          .prepareStatement(SQL_SELECT_MARKETSUMMARY_GAINERS);
      ResultSet rs = gainers.executeQuery();

      try {
        for (int i = 0; rs.next() && i < 5; i++) {
          CustomQuoteBean quote = new CustomQuoteBean(
              rs.getString(1), rs.getString(2), rs.getDouble(3),
              rs.getBigDecimal(4), rs.getBigDecimal(5), rs
                  .getBigDecimal(6), rs.getBigDecimal(7), rs
                  .getDouble(8));
          topGainers.add(quote);
        }
      } finally {
        try {
          rs.close();
        } catch (SQLException e) {
          logger.debug("", e);
        }
      }
    } catch (SQLException e) {
      throw new DAOException("", e);
    } finally {
      if (gainers != null) {
        try {
          gainers.close();
        } catch (SQLException e) {
          logger.debug("", e);
        }
      }
    }
    List<CustomQuoteBean> topLosers = new ArrayList<CustomQuoteBean>();
    PreparedStatement losers = null;
    try {
      losers = sqlConnection
          .prepareStatement(SQL_SELECT_MARKETSUMMARY_LOSERS);
      ResultSet rs = losers.executeQuery();

      try {
        for (int i = 0; rs.next() && i < 5; i++) {
          CustomQuoteBean quote = new CustomQuoteBean(
              rs.getString(1), rs.getString(2), rs.getDouble(3),
              rs.getBigDecimal(4), rs.getBigDecimal(5), rs
                  .getBigDecimal(6), rs.getBigDecimal(7), rs
                  .getDouble(8));
          topLosers.add(quote);
View Full Code Here


      orderDAO.beginTransaction();

      BigDecimal total = null;
      int holdingId = -1;

      CustomQuoteBean quote = orderDAO.getQuoteForUpdate(order.getSymbol());
      if (quote == null) {
        if (logger.isDebugEnabled()) {
          logger
              .debug("Unable to locate a quote entry for the symbol :"
                  + order.getSymbol());
        }
        return;
      }

      order.setPrice(quote.getPrice());

      if (StockTraderUtility.ORDER_TYPE_BUY.equals(order.getOrderType())) {
        holdingId = orderDAO.createHolding(order);
        BigDecimal orderQuantity = BigDecimal.valueOf(order
            .getQuantity());
View Full Code Here

    response.setGetOrdersReturn(param);
    return response;
  }

  public GetQuoteResponse getQuote(GetQuote getQuote) {
    CustomQuoteBean param;
    try {
      param = mgr.getQuote(getQuote.getSymbol());
    } catch (DAOException e) {
      logger.debug("", e);
      throw new RuntimeException(e);
View Full Code Here

TOP

Related Classes of org.apache.stonehenge.stocktrader.CustomQuoteBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.