Package org.apache.stonehenge.stocktrader

Examples of org.apache.stonehenge.stocktrader.CustomQuoteBean


      selectQuote = sqlConnection.prepareStatement(SQL_SELECT_QUOTE_NOLOCK);
      selectQuote.setString(1, symbol);
      ResultSet rs = selectQuote.executeQuery();

      try {
        CustomQuoteBean quote = null;
        if (rs.next()) {
          quote = new CustomQuoteBean(
                            rs.getString(1),
                            rs.getString(2),
                            rs.getDouble(3),
              rs.getBigDecimal(4),
                            rs.getBigDecimal(5),
View Full Code Here


      logger.debug("MarketSummaryDAO.getQouteForUpdate(String)\nSymbol :"+ symbol);
    }
    PreparedStatement qouteForUpdateStat = null;
    try {
      qouteForUpdateStat = sqlConnection.prepareStatement(SQL_SELECT_QUOTE);
      CustomQuoteBean quote = null;

      qouteForUpdateStat.setString(1, symbol);
      ResultSet rs = qouteForUpdateStat.executeQuery();

      if (rs.next()) {
        quote = new CustomQuoteBean(
                        rs.getString(1),
                        rs.getString(2),
            rs.getDouble(3),
                        rs.getBigDecimal(4),
                        rs.getBigDecimal(5),
View Full Code Here

      gainers = sqlConnection.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),
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

      selectQuote = sqlConnection.prepareStatement(SQL_SELECT_QUOTE_NOLOCK);
      selectQuote.setString(1, symbol);
      ResultSet rs = selectQuote.executeQuery();

      try {
        CustomQuoteBean quote = null;
        if (rs.next()) {
          quote = new CustomQuoteBean(
                            rs.getString(1),
                            rs.getString(2),
                            rs.getDouble(3),
              rs.getBigDecimal(4),
                            rs.getBigDecimal(5),
View Full Code Here

      logger.debug("MarketSummaryDAO.getQouteForUpdate(String)\nSymbol :" + symbol);
    }
    PreparedStatement qouteForUpdateStat = null;
    try {
      qouteForUpdateStat = sqlConnection.prepareStatement(SQL_SELECT_QUOTE);
      CustomQuoteBean quote = null;

      qouteForUpdateStat.setString(1, symbol);
      ResultSet rs = qouteForUpdateStat.executeQuery();

      if (rs.next()) {
        quote = new CustomQuoteBean(
                        rs.getString(1),
                        rs.getString(2),
            rs.getDouble(3),
                        rs.getBigDecimal(4),
                        rs.getBigDecimal(5),
View Full Code Here

      gainers = sqlConnection.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),
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());
        BigDecimal orderPrice = order.getPrice();
View Full Code Here

          .prepareStatement(SQL_SELECT_QUOTE_NOLOCK);
      selectQuote.setString(1, symbol);
      ResultSet rs = selectQuote.executeQuery();

      try {
        CustomQuoteBean quote = null;
        if (rs.next()) {
          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));
        }
View Full Code Here

    }
    PreparedStatement qouteForUpdateStat = null;
    try {
      qouteForUpdateStat = sqlConnection
          .prepareStatement(SQL_SELECT_QUOTE);
      CustomQuoteBean quote = null;

      qouteForUpdateStat.setString(1, symbol);
      ResultSet rs = qouteForUpdateStat.executeQuery();

      if (rs.next()) {
        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));

        try {
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.