Examples of StockIncomeAnnotation


Examples of org.pau.assetmanager.entities.StockIncomeAnnotation

    stockExpensesAnnotation(stocksBook);

  }

  private void stocksIncomeAnnotation(StocksBook stocksBook){
    StockIncomeAnnotation stocksIncomeAnnotation_done = new StockIncomeAnnotation();
    stocksIncomeAnnotation_done.setAmount(1000.0);
    stocksIncomeAnnotation_done.setBook(stocksBook);
    stocksIncomeAnnotation_done.setConcept("test_concept");
    Date date = new Date();
    stocksIncomeAnnotation_done.setDate(date);
    stocksIncomeAnnotation_done.setDone(true);
    stocksIncomeAnnotation_done.setNumberOfStocks(100L);
   
    Assert.assertEquals(new Double(1000.0),
        stocksIncomeAnnotation_done
            .getSignedAmount());
    Assert.assertEquals(new Long(100000L),
        stocksIncomeAnnotation_done
            .getTwoDecimalLongCodifiedAmount());
  }
View Full Code Here

Examples of org.pau.assetmanager.entities.StockIncomeAnnotation

      BindContext bindContext) {
    Double price = 0.0;
    Double amount = 0.0;
    Double numberOfStocks = null;
    if (annotation instanceof StockIncomeAnnotation) {
      StockIncomeAnnotation stockIncomeAnnotation = (StockIncomeAnnotation) annotation;
      amount= stockIncomeAnnotation.getAmount();
      if(stockIncomeAnnotation.getNumberOfStocks() > 0){
        numberOfStocks = stockIncomeAnnotation.getNumberOfStocks().doubleValue();
      }
    } else if (annotation instanceof StockExpensesAnnotation) {
      StockExpensesAnnotation stockExpensesAnnotation = (StockExpensesAnnotation) annotation;
      amount= stockExpensesAnnotation.getAmount();
      if(stockExpensesAnnotation.getNumberOfStocks() > 0){
View Full Code Here

Examples of org.pau.assetmanager.entities.StockIncomeAnnotation

                  stockExpensesAnnotation));
        } else if (annotation instanceof StockIncomeAnnotation) {
          // if there a sell stock transaction then we compute the previous purchase
          // stock transactions related in order to fulfill the amount of
          // stocks sold
          StockIncomeAnnotation stockIncomeAnnotation = (StockIncomeAnnotation) annotation;
          // iterate through all the previously buy subtransactions and divide them
          // or take their totality of stocks in order to fill the amount of sold stocks
          Map<StocksBuySubtransaction, Long> stocksBuySubtransactionToStocksNeededMap = splitBuyStockTransaction(stockIncomeAnnotation, stocksBuySubtransactionList);
          Long numberOfStoksUsed = sum(stocksBuySubtransactionToStocksNeededMap.values());
          Long additionalNecessaryStocks = stockIncomeAnnotation.getNumberOfStocks() - numberOfStoksUsed;
          // if there are no longer stocks necessary to buy in order to
          // sell the stock then the transaction is consistent and we can create it
          if (additionalNecessaryStocks == 0L) {
            Set<StocksBuySubtransaction> stocksBuySubtransactions = getStocksBuySubtransactions(stocksBuySubtransactionToStocksNeededMap,
                stocksBuySubtransactionList);
View Full Code Here

Examples of org.pau.assetmanager.entities.StockIncomeAnnotation

    String concept = null;
    Validate.notEmpty(stockIncomeDescriptionList,
        "The StockIncomeDescriptionList cannot be empty");
    Set<StockExpensesAnnotation> stocksBoughtSet = new HashSet<StockExpensesAnnotation>();
    for (StockIncomeDescription stockIncomeDescription : stockIncomeDescriptionList) {
      StockIncomeAnnotation stockIncomeAnnotation = stockIncomeDescription
          .getStockIncomeAnnotation();
      numberOfStocks += stockIncomeAnnotation.getNumberOfStocks();
      profits += stockIncomeAnnotation.getAmount();
      for (StocksBuySubtransaction stocksBuySubtransaction : stockIncomeDescription
          .getStocksBuySubtransactionSet()) {
        profits -= (stocksBuySubtransaction.getNumberOfStocks() * stocksBuySubtransaction
            .getPricePerStock());
        stocksBoughtSet.add(stocksBuySubtransaction
            .getStockExpensesAnnotation());
      }
      if (lastSoldDate == null) {
        lastSoldDate = stockIncomeAnnotation.getDate();
      } else if (lastSoldDate.before(stockIncomeAnnotation.getDate())) {
        lastSoldDate = stockIncomeAnnotation.getDate();
      }
      book = stockIncomeAnnotation.getBook();
      concept = stockIncomeAnnotation.getConcept();
    }
    Long numberOfStocksBought = 0L;
    for (StockExpensesAnnotation stockExpensesAnnotation : stocksBoughtSet) {
      numberOfStocksBought += stockExpensesAnnotation.getNumberOfStocks();
    }
View Full Code Here

Examples of org.pau.assetmanager.entities.StockIncomeAnnotation

          .get(annotation.getConcept());
      if (annotationsForMap == null) {
        annotationsForMap = new LinkedList<Annotation>();
        Boolean hasStocks = false;
        if (annotation instanceof StockIncomeAnnotation) {
          StockIncomeAnnotation stockIncomeAnnotation = (StockIncomeAnnotation) annotation;
          hasStocks = stockIncomeAnnotation.getNumberOfStocks() > 0;
        } else if (annotation instanceof StockExpensesAnnotation) {
          StockExpensesAnnotation stockExpensesAnnotation = (StockExpensesAnnotation) annotation;
          hasStocks = stockExpensesAnnotation.getNumberOfStocks() > 0;
        }
        if (hasStocks) {
View Full Code Here

Examples of org.pau.assetmanager.entities.StockIncomeAnnotation

            stockState.getBalance()
                - stockExpensesAnnotation.getAmount(),
            stockState.getNumberOfPurchasedStocks()
                + stockExpensesAnnotation.getNumberOfStocks(), month, year);
      } else if (annotation instanceof StockIncomeAnnotation) {
        StockIncomeAnnotation stockIncomeAnnotation = (StockIncomeAnnotation) annotation;
        stockState = new StockState(stockState.getSymbol(),
            stockState.getBalance()
                + stockIncomeAnnotation.getAmount(),
            stockState.getNumberOfPurchasedStocks()
                - stockIncomeAnnotation.getNumberOfStocks(), month, year);
      }
      symbolToCurrentStockState.put(annotation.getConcept(), stockState);
    }

  }
View Full Code Here

Examples of org.pau.assetmanager.entities.StockIncomeAnnotation

    Annotation annotation = null;
    if (annotationType.equals(AnnotationType.EXPENSES)) {
      StockExpensesAnnotation stockExpensesAnnotation = new StockExpensesAnnotation();
      annotation = stockExpensesAnnotation;
    } else if (annotationType.equals(AnnotationType.INCOME)) {
      StockIncomeAnnotation stockIncomeAnnotation = new StockIncomeAnnotation();
      annotation = stockIncomeAnnotation;
    }
    addDefaultValuesToAnnotation(annotation,
        bookSelection.getSelectedBook(), currentYear, annotationsFilter);
    addAnnotation(annotation);
View Full Code Here

Examples of org.pau.assetmanager.entities.StockIncomeAnnotation

          annotationToCreate = propertyExpensesAnnotation;
        }
      } else if (annotationImportBook instanceof StocksBook) {
        // stocks book
        if (annotationImport.getTwoDecimalLongCodifiedAmount() >= 0) {
          StockIncomeAnnotation stockIncomeAnnotation = new StockIncomeAnnotation();
          annotationToCreate = stockIncomeAnnotation;
        } else {
          StockExpensesAnnotation stockExpensesAnnotation = new StockExpensesAnnotation();
          annotationToCreate = stockExpensesAnnotation;
        }
View Full Code Here

Examples of org.pau.assetmanager.entities.StockIncomeAnnotation

      StockExpensesAnnotation expensesAnnotation = (StockExpensesAnnotation) annotation;
      return "Comprados " + expensesAnnotation.getNumberOfStocks()
          + " valores por "
          + NumberFomatter.formatMoney(expensesAnnotation.getAmount());
    } else if (annotation instanceof StockIncomeAnnotation) {
      StockIncomeAnnotation incomeAnnotation = (StockIncomeAnnotation) annotation;
      return "Vendidos " + incomeAnnotation.getNumberOfStocks()
          + " valores por "
          + NumberFomatter.formatMoney(incomeAnnotation.getAmount());
    }
    return "";
  }
View Full Code Here

Examples of org.pau.assetmanager.entities.StockIncomeAnnotation

          StockExpensesAnnotation stockExpensesAnnotation = (StockExpensesAnnotation) annotation;
          if (stockExpensesAnnotation.getNumberOfStocks() == 0) {
            currentList.add(stockExpensesAnnotation);
          }
        } else if (annotation instanceof StockIncomeAnnotation) {
          StockIncomeAnnotation stockIncomeAnnotation = (StockIncomeAnnotation) annotation;
          if (stockIncomeAnnotation.getNumberOfStocks() == 0) {
            currentList.add(stockIncomeAnnotation);
          }
        }
      }
    }
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.