/** * Returns whether it has the ISO4217 currency code. * * @return whether it has the ISO4217 currency code */ public boolean hasCurrencyCode() { return getCurrencyCode() != null; }
/** * Returns the gain for the portfolio in the portfolio default currency. * * @return gain for the portfolio in the portfolio default currency */ public Gain getGain() { return getExtension(Gain.class); }
/** * Returns whether it has the percentage gain. * * @return whether it has the percentage gain */ public boolean hasGainPercentage() { return getGainPercentage() != null; }
@Override public void declareExtensions(ExtensionProfile extProfile) { if (extProfile.isDeclared(PortfolioEntry.class)) { return; } super.declareExtensions(extProfile); extProfile.declare(PortfolioEntry.class, PortfolioFeedLink.class); new PortfolioFeedLink().declareExtensions(extProfile); extProfile.declare(PortfolioEntry.class, PortfolioData.getDefaultDescription(true, false)); new PortfolioData().declareExtensions(extProfile); }
/** * Creates a portfolio entry object. * * @param portfolioName the name of the new portfolio. e.g. "Oil & Gas". * This is required when creating a portfolio, but optional when updating. * @param currencyCode the ISO4217 currency code for the portfolio. * e.g. USD, EUR, JPY, GBP, CAD, HKD, etc. * This is required when creating a portfolio, but optional when updating. * @return the newly created portfolio entry * @throws IOException If there is a problem communicating with the server. * @throws MalformedURLException If the URL is invalid. * @throws ServiceException If the service is unable to handle the request. */ public static PortfolioEntry makePortfolioEntry(String portfolioName, String currencyCode) { PortfolioEntry entry = new PortfolioEntry(); if (!portfolioName.equals("")) entry.setTitle(new PlainTextConstruct(portfolioName)); PortfolioData data = new PortfolioData(); if (!currencyCode.equals("")) data.setCurrencyCode(currencyCode); entry.setPortfolioData(data); return entry; }
/** * Returns whether it has the 1 year return (percentage). * * @return whether it has the 1 year return (percentage) */ public boolean hasReturn1y() { return getReturn1y() != null; }
/** * Returns whether it has the 3 year return (percentage). * * @return whether it has the 3 year return (percentage) */ public boolean hasReturn3y() { return getReturn3y() != null; }
/** * Returns whether it has the 1 week return (percentage). * * @return whether it has the 1 week return (percentage) */ public boolean hasReturn1w() { return getReturn1w() != null; }
/** * Returns whether it has the 3 month return (percentage). * * @return whether it has the 3 month return (percentage) */ public boolean hasReturn3m() { return getReturn3m() != null; }
@Override public void declareExtensions(ExtensionProfile extProfile) { if (extProfile.isDeclared(PortfolioEntry.class)) { return; } super.declareExtensions(extProfile); extProfile.declare(PortfolioEntry.class, PortfolioFeedLink.class); new PortfolioFeedLink().declareExtensions(extProfile); extProfile.declare(PortfolioEntry.class, PortfolioData.getDefaultDescription(true, false)); new PortfolioData().declareExtensions(extProfile); }
/** * Creates a portfolio entry object. * * @param portfolioName the name of the new portfolio. e.g. "Oil & Gas". * This is required when creating a portfolio, but optional when updating. * @param currencyCode the ISO4217 currency code for the portfolio. * e.g. USD, EUR, JPY, GBP, CAD, HKD, etc. * This is required when creating a portfolio, but optional when updating. * @return the newly created portfolio entry * @throws IOException If there is a problem communicating with the server. * @throws MalformedURLException If the URL is invalid. * @throws ServiceException If the service is unable to handle the request. */ public static PortfolioEntry makePortfolioEntry(String portfolioName, String currencyCode) { PortfolioEntry entry = new PortfolioEntry(); if (!portfolioName.equals("")) entry.setTitle(new PlainTextConstruct(portfolioName)); PortfolioData data = new PortfolioData(); if (!currencyCode.equals("")) data.setCurrencyCode(currencyCode); entry.setPortfolioData(data); return entry; }
/** * Returns whether it has the 1 year return (percentage). * * @return whether it has the 1 year return (percentage) */ public boolean hasReturn1y() { return getReturn1y() != null; }
/** * Returns whether it has the 3 year return (percentage). * * @return whether it has the 3 year return (percentage) */ public boolean hasReturn3y() { return getReturn3y() != null; }
/** * Returns whether it has the 1 week return (percentage). * * @return whether it has the 1 week return (percentage) */ public boolean hasReturn1w() { return getReturn1w() != null; }
/** * Returns whether it has the 3 month return (percentage). * * @return whether it has the 3 month return (percentage) */ public boolean hasReturn3m() { return getReturn3m() != null; }
/** * Returns the cost basis of the portfolio in the portfolio default currency. * * @return cost basis of the portfolio in the portfolio default currency */ public CostBasis getCostBasis() { return getExtension(CostBasis.class); }
/** * Returns whether it has the percentage gain. * * @return whether it has the percentage gain */ public boolean hasGainPercentage() { return getGainPercentage() != null; }
/** * Returns whether it has the ISO4217 currency code. * * @return whether it has the ISO4217 currency code */ public boolean hasCurrencyCode() { return getCurrencyCode() != null; }
/** * Returns the today's gain for the portfolio in the portfolio default * currency. * * @return today's gain for the portfolio in the portfolio default currency */ public DaysGain getDaysGain() { return getExtension(DaysGain.class); }
/** * Returns the market value of the portfolio in the portfolio default * currency. * * @return market value of the portfolio in the portfolio default currency */ public MarketValue getMarketValue() { return getExtension(MarketValue.class); }