10 messages in com.googlegroups.google-finance-apis[Google Finance APIs] Re: additional ...
FromSent OnAttachments
ChrisSep 30, 2008 11:14 am 
ChrisOct 3, 2008 2:21 pm 
DineshOct 3, 2008 8:46 pm 
Doug ChimentoOct 4, 2008 9:35 am 
DineshOct 4, 2008 9:34 pm 
Cham...@gmail.comOct 6, 2008 2:26 pm 
Dion Loy (Google)Oct 6, 2008 3:12 pm 
Cham...@gmail.comOct 7, 2008 8:17 am 
Dion Loy (Google)Oct 8, 2008 9:59 am 
Cham...@gmail.comOct 8, 2008 4:39 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:[Google Finance APIs] Re: additional returns data not as describedActions...
From:Dinesh (kdin@gmail.com)
Date:Oct 4, 2008 9:34:52 pm
List:com.googlegroups.google-finance-apis

Hi Guys

I tried entering a complete transaction, with date, amount etc. Then I tried the interactive sample "Retrieving Positions" on this page:

http://code.google.com/apis/finance/developers_guide_js.html#Interactive_Samples

Before I ran the code I made the following change:

*From:*

// An array with all of a portfolio's positions var entries = result.feed.entry; for (var i = 0; i < entries.length; i++) { var positionEntry = entries[i]; var positionData = entries[i].getPositionData(); PRINT(positionEntry.getTitle().getText() + ' shares: ' + positionData.getShares()); }

*To:

*// An array with all of a portfolio's positions var entries = result.feed.entry; for (var i = 0; i < entries.length; i++) { var positionEntry = entries[i]; var positionData = entries[i].getPositionData(); PRINT(positionEntry.getTitle().getText() + ' shares: ' + positionData.getShares() + *' marketValue: ' + positionData.getMarketValue()*); }

and here is what I get:

Apple Inc. shares: 1 marketValue: undefined Google Inc. shares: 100 marketValue: undefined Microsoft Corporation shares: 10 marketValue: undefined

All of these are valid positions in my portfolio. The number of shares is displayed correctly, however market value is somehow 'undefined'.

Any ideas?

On Sun, Oct 5, 2008 at 12:35 AM, Doug Chimento <dchi@gmail.com> wrote:

Chris, I think the confusion maybe that your portfolio does not have any transactions. By transaction I mean you have entered a date,amount, and number of shares for a stock. Without those three pieces of info, google can't calculate market value. Google allows you to enter a "basic" transaction, which means ONLY a stock symbol. As an example, below is a query/result from my portfolio. The 1st symbol has a date,amount and number of shares and so google can calculate market value. The 2nd entry is only a "basic" transaction, and so Google can't calc market value. I hope this helps.

GET /finance/feeds/dchi@gmail.com/portfolios/1/positions?returns=true HTTP/1.1<http://dchimento@gmail.com/portfolios/1/positions?returns=trueHTTP/1.1>

<entry><id> http://finance.google.com/finance/feeds/dchimento@gmail.com/portfolios/1@ </id> <updated>2008-10-04T16:22:49.000Z</updated> <category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/finance/2007#position'/<http://schemas.google.com/finance/2007#position%27/>

<title type='text'>UltraShort Russell2000 ProShares</title> <link rel='self' type='application/atom+xml' href=' http://finance.google.com/finance/feeds/dchimento%40gmail.com/portfolios/1/positions/AMEX%3ATWM'/<http://finance.google.com/finance/feeds/dchimento%40gmail.com/portfolios/1/positions/AMEX%3ATWM%27/>

<gd:feedLink href=' http://finance.google.com/finance/feeds/dchimento@gmail.com/portfolios/1/positions/AM@'/<http://finance.google.com/finance/feeds/dchimento@gmail.com/portfolios/1/positions/AMEX:T@>

<gf:positionData gainPercentage='-0.1127551327' return1w='0.2734328793' return1y='-0.1127551327' return3m='-0.1127551327' return3y='-0.1127551327' return4w='-0.1127551327' return5y='-0.1127551327' returnOverall='-0.1127551327' returnYTD='-0.1127551327' shares='100.0'> <gf:costBasis><gd:money amount='9800.0' currencyCode='USD'/></gf:costBasis> <gf:daysGain><gd:money amount='657.0' currencyCode='USD'/></gf:daysGain> <gf:gain><gd:money amount='-1105.0003' currencyCode='USD'/></gf:gain> <gf:marketValue><gd:money amount='8694.9997' currencyCode='USD'/></gf:marketValue> </gf:positionData> <gf:symbol exchange='AMEX' fullName='UltraShort Russell2000 ProShares' symbol='TWM'/></entry>

#################################################################################################### <entry><id> http://finance.google.com/finance/feeds/dchimento@gmail.com/portfolios/1/po@ </id> <updated>2008-10-04T16:22:49.000Z</updated> <category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/finance/2007#position'/<http://schemas.google.com/finance/2007#position%27/>

<title type='text'>Oracle Corporation</title><link rel='self' type='application/atom+xml' href=' http://finance.google.com/finance/feeds/dchimento%40gmail.com/portfolios/1/positions/NASDAQ%3AORCL'/<http://finance.google.com/finance/feeds/dchimento%40gmail.com/portfolios/1/positions/NASDAQ%3AORCL%27/>

<gd:feedLink href=' http://finance.google.com/finance/feeds/dchimento@gmail.com/portfolios/1/positions/NASDA@'/<http://finance.google.com/finance/feeds/dchimento@gmail.com/portfolios/1/positions/NASDAQ:OR@>

<gf:positionData gainPercentage='0.0' return1w='0.0' return1y='0.0' return3m='0.0' return3y='0.0' return4w='0.0' return5y='0.0' returnOverall='0.0' returnYTD='0.0' shares='0.0'/> <gf:symbol exchange='NASDAQ' fullName='Oracle Corporation' symbol='ORCL'/></entry

On Fri, Oct 3, 2008 at 5:22 PM, Chris <chri@gmail.com> wrote:

On Oct 3, 11:21 am, Doug <dchi@gmail.com> wrote:

Chris, Could you clarify what you mean by market value performance?

Thanks,

Doug

What I mean is the the actual MarketValue for the position. For example, here is the feed that is being returned by this URI:

http://finance.google.com/finance/feeds/default/portfolios/54/positions?returns=true

<?xml version="1.0" encoding="utf-8" ?> - <entry xmlns="http://www.w3.org/2005/Atom"> <gd:feedLink href="http://finance.google.com/finance/feeds/ exam@gmail.com/portfolios/54/positions/NASDAQ:AAPL/transactions" xmlns:gd="http://schemas.google.com/g/2005" /> <gf:positionData gainPercentage="0.0" return1w="0.0" return1y="0.0" return3m="0.0" return3y="0.0" return4w="0.0" return5y="0.0" returnOverall="0.0" returnYTD="0.0" shares="1.0" xmlns:gf="http:// schemas.google.com/finance/2007" /> <gf:symbol exchange="NASDAQ" fullName="Apple Inc." symbol="AAPL" xmlns:gf="http://schemas.google.com/finance/2007" /> <title type="text">Apple Inc.</title> <id>http://finance.google.com/finance/feeds/exam@gmail.com/ portfolios/54/positions/NASDAQ:AAPL</id> <link href="http://finance.google.com/finance/feeds/default/ portfolios/54/positions/NASDAQ%3AAAPL" rel="self" type="application/ atom+xml" /> <category term="http://schemas.google.com/finance/2007#position" scheme="http://schemas.google.com/g/2005#kind" /> <content type="text" /> <updated>2008-10-03T14:44:39-06:00</updated> </entry>

What I really want, and from what I understand, this is what it should return:

<?xml version="1.0" encoding="utf-8" ?> - <entry xmlns="http://www.w3.org/2005/Atom" xmlns:gf="http:// schemas.google.com/finance/2007" xmlns:gd="http://schemas.google.com/g/ 2005"> <gd:feedLink href="http://finance.google.com/finance/feeds/ exam@gmail.com/portfolios/54/positions" /> - <gf:portfolioData currencyCode="USD" gainPercentage="0.0" return1w="0.0" return1y="0.0" return3m="0.0" return3y="0.0" return4w="0.0" return5y="0.0" returnOverall="0.0" returnYTD="0.0"> - <gf:costBasis> <gd:money amount="0.0" currencyCode="USD" /> </gf:costBasis> - <gf:daysGain> <gd:money amount="-3.029999" currencyCode="USD" /> </gf:daysGain> - <gf:gain> <gd:money amount="97.07" currencyCode="USD" /> </gf:gain> - <gf:marketValue> <gd:money amount="97.07" currencyCode="USD" /> </gf:marketValue> </gf:portfolioData> <title type="text">NinjaTrader0</title> <id>http://finance.google.com/finance/feeds/exam@gmail.com/ portfolios/54</id> <link href="http://finance.google.com/finance/feeds/default/ portfolios/54" rel="self" type="application/atom+xml" /> <link href="http://finance.google.com/finance/feeds/default/ portfolios/54" rel="edit" type="application/atom+xml" /> <category term="http://schemas.google.com/finance/2007#portfolio" scheme="http://schemas.google.com/g/2005#kind" /> <content type="text" /> <updated>2008-10-03T15:13:59-06:00</updated> </entry>

Specifically this is what I need:

<gf:marketValue> <gd:money amount="97.07" currencyCode="USD" /> </gf:marketValue>

which is the market value of that position at the current time. From my understanding, using this URI (http://finance.google.com/finance/ feeds/default/portfolios/54/positions?returns=true) should return the performance statistics on each position in the portfolio (in this case the portfolio numbered 54), yet the only data returned is as above.

So in a nutshell: How do I get the market value of each position in a portfolio using a singe URI request?