return gmState;
}
protected ArrayNode getPortfolio() {
ArrayNode stocks = Json.newObject().arrayNode();
GameManager gm = new GameManager();
for (PortfolioStock portfoilioStock : gameState.getCurrentPlayer().getPortfolios()) {
ObjectNode stockNode = Json.newObject();
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);