I have a test portfolio with just one position: 1 share of AAPL
. If I set the currency for the portfolio to GBP, the position
market values returned via the API will have the following values:
Ticker:
Exchange: NASDAQ
Symbol: AAPL
Full Name: Apple Inc.
Updated: 2011-01-17T23:12:39.000Z
Share count: 1.00
This position is worth 2.19 GBP.
This position is worth 348.48 USD.
This is wrong, should be: 348.48 * 0.6297 = 219.43 GBP
. If I set the portfolio currency to other currency such as EUR, the
converted value is OK. For example,
Ticker:
Exchange: NASDAQ
Symbol: AAPL
Full Name: Apple Inc.
Updated: 2011-01-17T23:17:16.000Z
Share count: 1.00
This position is worth 262.49 EUR.
This position is worth 348.48 USD.
Using Java API, codes:
if (positionData.getMarketValue() == null) {
log.info("\t\tMarket Value not specified");
} else {
List<Money> moneyList = positionData.getMarketValue()
.getMoney();
for (Money money : moneyList) {
log.info(String.format(
"\t\tThis position is worth %.2f %s.",
money
.getAmount(),
money.getCurrencyCode()));
}
}