Example #1
0
 @Override
 public void stopSelling(boolean flag) {
   if (flag != portfolioTable.isStopSelling()) {
     portfolioTable.setStopSelling(flag);
     jpaHelper.updateObject(portfolioTable);
   }
 }
Example #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;
  }
Example #3
0
 @Override
 public boolean investAmount(final long amount) {
   return jpaHelper.investMoney(amount, portfolioTable);
 }
Example #4
0
 @Override
 public long getInvestedAmount() {
   return jpaHelper.getTotalInvestedAmount(portfolioTable);
 }
Example #5
0
 @Override
 public List<Pair<StockPrices, StockPrices>> getHistoryStocks() {
   return jpaHelper.getOldStocks(portfolioTable);
 }
Example #6
0
 @Override
 public List<StockPrices> getCurrentStocks() {
   return jpaHelper.getCurrentStocks(portfolioTable);
 }
Example #7
0
 @Override
 public List<StockNames> getAvalibleStocks() {
   return jpaHelper.getStockNames(portfolioTable);
 }