Package models.data

Examples of models.data.StockPrice


            stockNode.put("id", portfoilioStock.getId());
            String ticker = portfoilioStock.getStock().getTicker();
            stockNode.put("ticker", ticker);
            stockNode.put("company", portfoilioStock.getStock().getCompanyName());
            stockNode.put("quantity", portfoilioStock.getQuantity());
            StockPrice currentStockPrice = null;
            try {
                currentStockPrice = gm.getStockPrice(ticker, gameState.getGame().getVirtualCurrentDate());
            } catch (IOException ex) {
                play.Logger.warn("error occured while retrieving price", ex);
            }
            stockNode.put("currentPrice", currentStockPrice != null ? currentStockPrice.getStockPrice() : 0);
            //stockNode.put("purchasePrice", purchasePrice);
            stocks.add(stockNode);
        }
        return stocks;
    }
View Full Code Here


  }

  @Test
  public void getStockPriceSuccessTest()
    throws IOException, InvalidStockException{
    StockPrice stockPrice = gameManager.getStockPrice("GOOG",date);
    Assert.assertTrue(stockPrice!=null);
  }
View Full Code Here

    }

    private List<StockPrice> parseCSV(ICsvBeanReader beanReader) throws IOException {

        List<StockPrice> stockPrices = new ArrayList<StockPrice>();
        StockPrice temp;
        while ((temp = beanReader.read(StockPrice.class, header, processors)) != null) {
            stockPrices.add(temp);
        }

        return stockPrices;
View Full Code Here

        return stockPrices.isEmpty() ? null : stockPrices.get(0);
    }

    public double getStockPriceAmount(String ticker, Timestamp virtualDate) {
        StockPrice stockPrice;
        try {
            stockPrice = getStockPrice(ticker, virtualDate);
            return stockPrice == null ? 0 : stockPrice.getStockPrice();
        } catch (IOException ex) {
            play.Logger.error("Could not retrieve stock price", ex);
        }

        return 0;
View Full Code Here

TOP

Related Classes of models.data.StockPrice

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.