Examples of SecuritiesCurrentMarketPrice


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

Examples of gluebooster.demos.finance.fields.SecuritiesCurrentMarketPrice

         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

Examples of project.gluebooster.applications.assetManagement.fields.SecuritiesCurrentMarketPrice

  
   
    SecuritiesInformation info = new SecuritiesInformation();
    info.setPriceNotation(new BigDecimal(1));
    SecuritiesMarketPrice marketPrice = new SecuritiesMarketPrice();
    SecuritiesCurrentMarketPrice currentMarketPrice = new SecuritiesCurrentMarketPrice();
    ExchangeRate euro = new ExchangeRate();
    euro.setRate(new BigDecimal(1));
    euro.setSourceCurrency("EUR");
    euro.setTargetCurrency("EUR");
    ArrayList<ExchangeRate> rates = new ArrayList<ExchangeRate>();
View Full Code Here

Examples of project.gluebooster.applications.assetManagement.fields.SecuritiesCurrentMarketPrice

        ArrayList<SummarizedTransaction<TransactionClass>> result = new ArrayList<SummarizedTransaction<TransactionClass>>();

       BigDecimal currentValue = new BigDecimal(0);
        SecuritiesInformation information = null;
        SecuritiesCurrentMarketPrice currentMarketPrice = null;
        String assetname = null; //no asset yet, "" == different assets, otherwise the same asset
        String currency = null;
       
      for (String key: keys)
         {
View Full Code Here

Examples of project.gluebooster.applications.assetManagement.fields.SecuritiesCurrentMarketPrice

         trans.setInfo( informationMap.get(trans.getAsset()));
         /*
         if (trans.getInfo() == null)
           getLog().warn("No info for '" + trans.getAsset() + "' in ", informationMap.keySet());
         */
         SecuritiesCurrentMarketPrice price =  priceMap.get(trans.getAsset());
         trans.setCurrentPriceInfo(price);
         /*if (price == null)
           getLog().warn("No price for '" + trans.getAsset() + "' in ", priceMap.keySet());
         */
         result.add(trans);
View Full Code Here

Examples of project.gluebooster.applications.assetManagement.fields.SecuritiesCurrentMarketPrice

            isNotEmpty = 0 != quantities.get(entry.getAsset()).getQuantity().doubleValue();
          if ( entry.isActive() && isin != null && ! "".equals(isin.trim()) && ! UNNECESSARY.equals(isin.trim()) && isNotEmpty)
          {
            try
            {
            SecuritiesCurrentMarketPrice currentPrice = currentPricesMap.get(entry.getIsin());
            boolean upToDate = false;
            if (currentPrice == null)
            {
              currentPrice = new SecuritiesCurrentMarketPrice();
              currentPrice.setIsin(isin);
              currentPrice.setAssetname(entry.getAsset());
             
            }
            else
            {
              if (currentPrice.getPrice() != null)
                if (System.currentTimeMillis() -  currentPrice.getValueDate().getTime().getTime() < DateBoostUtils.daysInMilliseconds(5))
                {//5 days are up to date
                   upToDate = true;
                }
            }
           
            SecuritiesMarketPrice price = new SecuritiesMarketPrice();
            price.setIsin(isin);
           
             if (doCancelUpdateSecuritiesInformation)
               break;
            
             boolean result = false;
             int i = 0;
             if (upToDate && entry.getAssetname() != null)
               getLog().debug("up to date: " + entry.getAsset() + " (" + isin+ ")");
             else
             {
               while (i < managers.length)
               {
                  try
                  {
                    result = managers[i].updateInformation(entry, price, currentPrice, exchangeRateManager, userMessageManager);
                  }
                  catch (Exception ex)
                  {
                    ex.printStackTrace();
                  }
                  if (result)
                    i = managers.length;
                  else
                    i++;
               }
               if (result)
               {
                  Session session = getSessionFactory().getCurrentSession();
                  getLog().debug("begin transaction");
   
                  session.beginTransaction();
   
                  session.saveOrUpdate(entry);
                  if (price.getPrice() != null)
                  {
                    getLog().debug("saving price: ", price.getId()," ", price.getIsin()," ", price.getPrice()," ", price.getCurrency()," ", price.getValueDate().getTime());
                    session.save(price);
                    getLog().debug("saved price ");
                 
                    if (currentPrice.getPrice() != null)
                    {
                      getLog().debug("saving current price ", currentPrice.getId()," ", currentPrice.getIsin()," ", currentPrice.getPrice()," ", currentPrice.getCurrency()," ", currentPrice.getValueDate().getTime());
                      session.saveOrUpdate(currentPrice);
                    }
                  }
                  getLog().debug("commit transaction");
   
View Full Code Here

Examples of project.gluebooster.applications.assetManagement.fields.SecuritiesCurrentMarketPrice

  
   
    SecuritiesInformation info = new SecuritiesInformation();
    info.setPriceNotation(new BigDecimal(1));
    SecuritiesMarketPrice marketPrice = new SecuritiesMarketPrice();
    SecuritiesCurrentMarketPrice currentMarketPrice = new SecuritiesCurrentMarketPrice();
    ExchangeRate euro = new ExchangeRate();
    euro.setRate(new BigDecimal(1));
    euro.setSourceCurrency("EUR");
    euro.setTargetCurrency("EUR");
    ExchangeRate cad = new ExchangeRate();
View Full Code Here

Examples of project.gluebooster.applications.assetManagement.fields.SecuritiesCurrentMarketPrice

  /**
   * @todo Funktioniert nicht mehr
   */
  public void testOutdate() throws Exception
  {
      SecuritiesCurrentMarketPrice current = new SecuritiesCurrentMarketPrice();
      GregorianCalendar calendar = new GregorianCalendar();
      calendar.add( GregorianCalendar.DAY_OF_YEAR, -5);
      System.out.println(calendar.getTime());
      current.setValueDate(calendar);
      SummarizedTransaction transaction = new SummarizedTransaction( Collections.EMPTY_LIST);
      transaction.setCurrentPriceInfo(current);
     
      assertFalse(transaction.isCurrentPriceOutdated());
  }
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.