Package com.google.gdata.data.finance

Examples of com.google.gdata.data.finance.PortfolioData


        PositionEntry positionEntry = inlinedFeed.getEntries().get(i);
        printPositionEntry(positionEntry);
      }
      System.out.println("************* End of inlined feed *****************");
    }
    PortfolioData portfolioData = portfolioEntry.getPortfolioData();
    System.out.println("\tPortfolio Data:");
    System.out.println("\t\tCurrency is " + portfolioData.getCurrencyCode());
    System.out.printf("\t\tPercent Gain is %.2f%%\n", portfolioData.getGainPercentage() * 100.0);
    System.out.println("\t\tReturns:");
    System.out.printf("\t\t\tOne week: %.2f%%\n", portfolioData.getReturn1w() * 100.0);
    System.out.printf("\t\t\tFour weeks: %.2f%%\n", portfolioData.getReturn4w() * 100.0);
    System.out.printf("\t\t\tThree months: %.2f%%\n", portfolioData.getReturn3m() * 100.0);
    System.out.printf("\t\t\tYear-to-date: %.2f%%\n", portfolioData.getReturnYTD() * 100.0);
    System.out.printf("\t\t\tOne year: %.2f%%\n", portfolioData.getReturn1y() * 100.0);
    System.out.printf("\t\t\tThree years: %.2f%%\n", portfolioData.getReturn3y() * 100.0);
    System.out.printf("\t\t\tFive years: %.2f%%\n", portfolioData.getReturn5y() * 100.0);
    System.out.printf("\t\t\tOverall: %.2f%%\n", portfolioData.getReturnOverall() * 100.0);
    if (portfolioData.getCostBasis() == null) {
      System.out.println("\t\tCost Basis not specified");
    } else {
      for (int i = 0; i < portfolioData.getCostBasis().getMoney().size(); i++) {
        Money m = portfolioData.getCostBasis().getMoney().get(i);
        System.out.printf("\t\tThis portfolio cost %.2f %s.\n",
                          m.getAmount(), m.getCurrencyCode());
      }
    }
    if (portfolioData.getDaysGain() == null) {
      System.out.println("\t\tDay's Gain not specified");
    } else {
      for (int i = 0; i < portfolioData.getDaysGain().getMoney().size(); i++) {
        Money m = portfolioData.getDaysGain().getMoney().get(i);
        System.out.printf("\t\tThis portfolio made %.2f %s today.\n",
                          m.getAmount(), m.getCurrencyCode());
      }
    }
    if (portfolioData.getGain() == null) {
      System.out.println("\t\tTotal Gain not specified");
    } else {
      for (int i = 0; i < portfolioData.getGain().getMoney().size(); i++) {
        Money m = portfolioData.getGain().getMoney().get(i);
        System.out.printf("\t\tThis portfolio has a total gain of %.2f %s.\n",
                          m.getAmount(), m.getCurrencyCode());
      }
    }
    if (portfolioData.getMarketValue() == null) {
      System.out.println("\t\tMarket Value not specified");
    } else {
      for (int i = 0; i < portfolioData.getMarketValue().getMoney().size(); i++) {
        Money m = portfolioData.getMarketValue().getMoney().get(i);
        System.out.printf("\t\tThis portfolio is worth %.2f %s.\n",
                          m.getAmount(), m.getCurrencyCode());
      }
    }
  }
View Full Code Here

TOP

Related Classes of com.google.gdata.data.finance.PortfolioData

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.