Package gluebooster.demos.finance.fields

Examples of gluebooster.demos.finance.fields.SecuritiesCurrentMarketPrice


    Double priceSum = 0.0;
    Double quantitySum = 0.0;
    Double currentValueSum = 0.0;
   
    SecuritiesInformation information = null;
    SecuritiesCurrentMarketPrice currentMarketPrice = null;


    for (SecuritiesTransaction transaction : subtransactions) {
     
     
     
      String transAccount = transaction.getAccount();
      if (account == null)
        account = transAccount;
      else if (!account.equals(transAccount)) {
        account = "";
      }

      String transAsset = transaction.getAsset();
      if (asset == null)
        asset = transAsset;
      else if (!asset.equals(transAsset)) {
        asset = "";
      }

      String transCurrency = transaction.getCurrency();
      if (currency == null)
        currency = transCurrency;
      else if (!currency.equals(transCurrency)) {
        System.out.println("clear currency " + currency + ":"
            + transCurrency);
        currency = "";
      }

      quantitySum = add(quantitySum, getSignedQuantity(transaction),
          asset, false);
      priceSum = add(priceSum, getSignedPrice(transaction, true), currency, true);
     
      if (transaction instanceof SummarizedTransaction){
        SummarizedTransaction summarized = (SummarizedTransaction) transaction;
        currentValueSum = add(currentValueSum, getSignedPrice(summarized, summarized.getCurrentPrice(), false),currency, false);
      } else {
        currentValueSum  = null;
      }

      if (transaction instanceof SummarizedTransaction){
        SummarizedTransaction summarized = (SummarizedTransaction) transaction;
       
        if ( "".equals(asset) ){
          information = null;
          currentMarketPrice = null;
        } else {
          if (information == null)
            information = summarized.getInfo();
         
          if (currentMarketPrice == null)
            currentMarketPrice = summarized.getCurrentPriceInfo();
         
        }

      }
     
    }
   
    setAsset(asset);
    setAccount(account);
    setCurrency(currency);
    setInfo(information);
    currentPrice = toBigDecimal(currentValueSum);
    setCurrentPriceInfo(currentMarketPrice);
    if (currentMarketPrice != null)
      setCurrentPricePerUnit(currentMarketPrice.getPrice());

    //set the quantity sign and quantity, so that no negative quantity exists.
    if (quantitySum == null ){
      setQuantitySign((byte) 1);//
    } else if (quantitySum >= 0){
View Full Code Here


         for (SecuritiesTransaction transaction: transactions)
         {
           SummarizedTransaction<SecuritiesTransaction> trans = new SummarizedTransaction<SecuritiesTransaction>(transaction);
           trans.changeCurrency(exchangeRateManager);
           trans.setInfo( informationMap.get(trans.getAsset()));
           SecuritiesCurrentMarketPrice price =  priceMap.get(trans.getAsset());
           trans.setCurrentPriceInfo(price);
           if (price != null)
              trans.setCurrentPricePerUnit( price.getPrice());
           result.add(trans);
         }
         return result;
     }  
View Full Code Here

TOP

Related Classes of gluebooster.demos.finance.fields.SecuritiesCurrentMarketPrice

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.