public class FinanceUtilities
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
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.
|
public static PortfolioEntry makePortfolioEntry(java.lang.String portfolioName, java.lang.String currencyCode)
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.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.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)
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.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.