lausd-teacher / gwt-gdata

Automatically exported from code.google.com/p/gwt-gdata
0 stars 0 forks source link

Error retrieving position data from an existing portfolio. #7

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Using the Finance package, try to retrieve PositionFeed using the
appropriate PositionFeedCallBack. I am not sure I have the right URL, but I
am using
http://finance.google.com/finance/feeds/default/portfolios/13/positions
where 13 is the specific portfolio Id.

2. Abbreviated code is as follows
public void onSuccess(PositionFeed result) {
  PositionEntry[] entries = result.getEntries();
  PositionEntry entry = entries[0];
  PositionData data = entry.getPositionData();
  Money[] money = data.getMarketValue().getMoney();
  double value = money[0].getAmount();
}

What is the expected output? What do you see instead?
The expected output is the market value of the stock. What I actually get is
Uncaught exception "
com.google.gwt.core.client.JavaScriptException: (TypeError): this.getMoney
is not a function"

What version of the product are you using? On what operating system?
gwt-gdata 2.2.1 on Mac OS X 10.5.8.

Please provide any additional information below.
I wish the URLs were specified in the javadocs. I'm really blundering about
in the dark here. Also why is Money returned as an array? The javadocs are
mute on the issue.

Original issue reported on code.google.com by chris.ti...@gmail.com on 23 Mar 2010 at 4:18

GoogleCodeExporter commented 9 years ago
I'm noting that
http://code.google.com/apis/finance/docs/2.0/developers_guide_js.html#Interactiv
e_Samples
appears to exhibit problems with the getMoney() function.

Adding the line 
var money = positionData.getMarketValue().getMoney()

Causes the 'Retrieving Positions' script to fail silently. I am unable to test 
this
further as I am not really familiar with Javascript.

Original comment by chris.ti...@gmail.com on 29 Apr 2010 at 11:37

GoogleCodeExporter commented 9 years ago
Chris, looking at the exception, my first guess is that 
positionData.getMarketValue()
is returning a null value, so it's possible that the feed URL is not valid.

Keep in mind that the gwt-gdata library binds to the gdata JavaScript library 
(whose
JsDocs are available on 
http://code.google.com/apis/gdata/jsdoc/2.2/index.html), so
Money is returned as an array because that's how it's implemented in the 
underlying
GData JS API.

On URLs, i agree that they can be a pain to get right without some research, 
but the
correct place for this type of information is the GData Protocol documentation 
site.

Let me try to get a working sample for this.

Original comment by bobbysoa...@gmail.com on 30 Apr 2010 at 12:22