Package project.gluebooster.applications.assetManagement.fields

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


        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

         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

            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

  
   
    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

  /**
   * @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

Related Classes of project.gluebooster.applications.assetManagement.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.