# Google Data APIs Client Library (1.43.0)

## com.google.gdata.client.finance
Class FinanceUtilities

    java.lang.Object
      com.google.gdata.client.finance.FinanceUtilities

    public class FinanceUtilities

extends java.lang.Object

FinanceUtilities contains useful methods related to the Finance GData API

Method Summary
`static PortfolioEntry` `makePortfolioEntry(java.lang.String portfolioName, java.lang.String currencyCode)` Creates a portfolio entry object.
`static TransactionEntry` `makeTransactionEntry(java.lang.String type, java.lang.String date, java.lang.String shares, java.lang.String price, java.lang.String commission, java.lang.String currency, java.lang.String notes)` Creates a transaction entry object.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### makePortfolioEntry

    public static PortfolioEntry makePortfolioEntry(java.lang.String portfolioName,
                                                    java.lang.String currencyCode)

  Creates a portfolio entry object.

  Parameters:
    `portfolioName` - the name of the new portfolio. e.g. "Oil & Gas". This is required when creating a portfolio, but optional when updating.
    `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.
  Returns:
    the newly created portfolio entry
  Throws:
    `IOException` - If there is a problem communicating with the server.
    `MalformedURLException` - If the URL is invalid.
    `ServiceException` - If the service is unable to handle the request.

### makeTransactionEntry

    public static TransactionEntry makeTransactionEntry(java.lang.String type,
                                                        java.lang.String date,
                                                        java.lang.String shares,
                                                        java.lang.String price,
                                                        java.lang.String commission,
                                                        java.lang.String currency,
                                                        java.lang.String notes)

  Creates a transaction entry object.

  Parameters:
    `type` - The type of transaction (one of "Buy", "Sell", "Sell Short", "Buy to Cover"). This should be specified. In this method, the type will be set to "Buy" if left unspecified.
    `date` - The date of the transaction in the format YYYY-MM-DD. This is optional ("watchlist" or "holding" items might not have a date). If left unspecified, this parameter should be an empty string.
    `shares` - The number of shares/units involved in a transaction. This does not have to be a whole number quantity (e.g. 10.1 is valid). This is optional ("watchlist" entries need not have a share count)
    `price` - The transaction unit price (e.g. 99.99). This is optional.
    `commission` - The transaction commission (e.g. 25.0). This is optional.
    `currency` - The ISO4217 currency code for the transaction price and commission. e.g. USD, EUR, JPY, GBP, CAD, HKD, etc. This is required only if price or commission have been specified.
    `notes` - Any notes related to the transaction. This is optional.
  Returns:
    the newly created transaction entry
  Throws:
    `IOException` - If there is a problem communicating with the server.
    `MalformedURLException` - If the URL is invalid.
    `ServiceException` - If the service is unable to handle the request.