1 message in com.googlegroups.google-finance-apis[Google Finance APIs] How to Implemen...
FromSent OnAttachments
cmle...@gmail.comMar 18, 2009 9:02 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] How to Implement Google Finance on our website?Actions...
From:cmle...@gmail.com (cmle@gmail.com)
Date:Mar 18, 2009 9:02:39 pm
List:com.googlegroups.google-finance-apis

We're having problems trying to Implement the Google Finance on our Intranet. It looks like there's authentication issues. Can someone please check the code below or guide me on what to do?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http:// www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/

<title>My Google Data API Application</title> <script src="http://www.google.com/jsapi? key=ABQIAAAAHIcD0Ed1pJ31cegsYihAfhRrJiujAxTigVe5uTTZU_MlHIHFZhRwxhw_9KNXsFEv- UkXDGwJApe-iA" type="text/javascript"></script>

<script type="text/javascript">

google.setOnLoadCallback(getMyFeed); //tell the loader to wait until the page finishes loading and then call code google.load("gdata", "1");

function logMeIn() { scope = 'http://finance.google.com/finance/feeds/'; var token = google.accounts.user.login(scope); }

function getMyFeed() { // Google Finance Portfolio Data API Example: Retrieve Positions

var financeService = new google.gdata.finance.FinanceService ('GoogleInc-financejsguide-1.0'); logMeIn(); // Note that in this example, we specify a specific portfolio. Alternatively, we // could have retrieved the user's portfolio feed and searched for a particular // portfolio by title as in the preceeding example, if portfolio ID were unknown

var portfolio_id = 1; var portfolioFeedUri = 'http://finance.google.com/finance/feeds/ default/' + 'portfolios/' + portfolio_id + '/positions';

document.write(portfolioFeedUri); //= http://finance.google.com/finance/feeds/default/portfolios/1/positions // Google Finance Portfolio Data API Example: Retrieve Positions

// This callback will run when the position feed query is complete var positionFeedCallback = function(result) { document.write('Retrieved position feed for portfolio #' + portfolio_id + ':'); // 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(); document.write(positionEntry.getTitle().getText() + ' shares: ' + positionData.getShares()); } if (entries.length == 0) PRINT('No positions!');

// FinanceService methods may be supplied with an alternate callback for errors var handleErrorCallback = function(error) { document.write(error); }; financeService.getPositionFeed(portfolioFeedUri, positionFeedCallback, handleErrorCallback); } </script> </head> <body> <div id="panel"/> </body> </html>