示例#1
0
 @Override
 public void stopSelling(boolean flag) {
   if (flag != portfolioTable.isStopSelling()) {
     portfolioTable.setStopSelling(flag);
     jpaHelper.updateObject(portfolioTable);
   }
 }
示例#2
0
  @Override
  public long getCurrentWorth() {
    long currentWorth = getUnusedAmount();

    for (int i = 0; i < portfolioTable.getHistory().size(); i++) {
      final PortfolioHistory portfolioHistory = portfolioTable.getHistory().get(i);

      if (portfolioHistory.getSoldDate() == null) {
        final StockPrices latest = jpaHelper.getLatestStockPrice(portfolioHistory.getStockPrice());
        currentWorth += latest.getSell() * portfolioHistory.getAmount();
      }
    }

    return currentWorth;
  }
示例#3
0
 @Override
 public boolean investAmount(final long amount) {
   return jpaHelper.investMoney(amount, portfolioTable);
 }
示例#4
0
 @Override
 public long getInvestedAmount() {
   return jpaHelper.getTotalInvestedAmount(portfolioTable);
 }
示例#5
0
 @Override
 public List<Pair<StockPrices, StockPrices>> getHistoryStocks() {
   return jpaHelper.getOldStocks(portfolioTable);
 }
示例#6
0
 @Override
 public List<StockPrices> getCurrentStocks() {
   return jpaHelper.getCurrentStocks(portfolioTable);
 }
示例#7
0
 @Override
 public List<StockNames> getAvalibleStocks() {
   return jpaHelper.getStockNames(portfolioTable);
 }