Examples of QuoteDataBean


Examples of org.apache.aries.samples.ariestrader.api.persistence.QuoteDataBean

        return quoteData;
    }

    private QuoteDataBean getQuoteForUpdate(Connection conn, String symbol) throws Exception {
        QuoteDataBean quoteData = null;
        PreparedStatement stmt = getStatement(conn, getQuoteForUpdateSQL);
        stmt.setString(1, symbol); // symbol

        ResultSet rs = stmt.executeQuery();
View Full Code Here

Examples of org.apache.aries.samples.ariestrader.api.persistence.QuoteDataBean

     * @see TradeServices#getAllQuotes(String)
     */
    public Collection getAllQuotes() throws Exception {

        Collection quotes = new ArrayList();
        QuoteDataBean quoteData = null;
        Connection conn = null;

        if (Log.doTrace())
            Log.trace("TradeJdbc:getAllQuotes");

View Full Code Here

Examples of org.apache.aries.samples.ariestrader.api.persistence.QuoteDataBean

        stmt.close();
        return accountData;
    }

    private QuoteDataBean getQuoteData(Connection conn, String symbol) throws Exception {
        QuoteDataBean quoteData = null;
        PreparedStatement stmt = getStatement(conn, getQuoteSQL);
        stmt.setString(1, symbol);
        ResultSet rs = stmt.executeQuery();
        if (!rs.next())
            Log.error("TradeJdbc:getQuoteData -- could not find quote for symbol=" + symbol);
View Full Code Here

Examples of org.apache.aries.samples.ariestrader.api.persistence.QuoteDataBean

        boolean publishQuotePriceChange) throws Exception {

        if (TradeConfig.getUpdateQuotePrices() == false)
            return new QuoteDataBeanImpl();

        QuoteDataBean quoteData = null;
        Connection conn = null;

        try {
            if (Log.doTrace())
                Log.trace("TradeJdbc:updateQuotePriceVolume - inSession(" + this.inSession + ")", symbol,
                    changeFactor, new Double(sharesTraded));

            conn = getConn();

            quoteData = getQuoteForUpdate(conn, symbol);
            BigDecimal oldPrice = quoteData.getPrice();
            double newVolume = quoteData.getVolume() + sharesTraded;

            if (oldPrice.equals(TradeConfig.PENNY_STOCK_PRICE)) {
                changeFactor = TradeConfig.PENNY_STOCK_RECOVERY_MIRACLE_MULTIPLIER;
            } else if (oldPrice.compareTo(TradeConfig.MAXIMUM_STOCK_PRICE) > 0) {
                changeFactor = TradeConfig.MAXIMUM_STOCK_SPLIT_MULTIPLIER;
            }

            BigDecimal newPrice = changeFactor.multiply(oldPrice).setScale(2, BigDecimal.ROUND_HALF_UP);
            BigDecimal low = quoteData.getLow();
            BigDecimal high= quoteData.getHigh();
            if (newPrice.compareTo(high) == 1) high = newPrice;
            else if (newPrice.compareTo(low) == -1) low = newPrice;

            updateQuotePriceVolume(conn, quoteData.getSymbol(), newPrice, newVolume, low, high);
            quoteData = getQuote(conn, symbol);

            commit(conn);

        } catch (Exception e) {
View Full Code Here

Examples of org.apache.aries.samples.ariestrader.api.persistence.QuoteDataBean

                .getBigDecimal("purchasePrice"), rs.getTimestamp("purchaseDate"), rs.getString("quote_symbol"));
        return holdingData;
    }

    private QuoteDataBean getQuoteDataFromResultSet(ResultSet rs) throws Exception {
        QuoteDataBean quoteData = null;

        quoteData =
            new QuoteDataBeanImpl(rs.getString("symbol"), rs.getString("companyName"), rs.getDouble("volume"), rs
                .getBigDecimal("price"), rs.getBigDecimal("open1"), rs.getBigDecimal("low"), rs.getBigDecimal("high"),
                rs.getDouble("change1"));
View Full Code Here

Examples of org.apache.geronimo.samples.daytrader.QuoteDataBean

  public void resetStatsFromServer() throws Exception {
    auditStats.clearStats();
    Collection quotes = trade.getAllQuotes();

    for (Iterator it = quotes.iterator(); it.hasNext(); ) {
      QuoteDataBean bean = (QuoteDataBean)it.next();
      auditStats.updateSymbol(bean.getSymbol(), bean.getCompanyName(), bean.getPrice(), bean.getOpen(), bean.getLow(), bean.getHigh(), bean.getVolume(), System.currentTimeMillis(), bean.getPrice(), bean.getVolume());
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.