Search code examples
javascripthtmlcssstocksstockquotes

Problem with Stock Quote from Google Finance


Below is the example I got from google finance for a stock quote. But it doesnt seem to be working. Stock price isnt displayed.

Thanks

<body>
Hello world!
Here is your portfolio:<br/>
  GOOG: <span id=_IG_SYM1_l></span> (<span id=_IG_SYM1_c></span>)<br/>
  AAPL: <span id=_IG_SYM2_l></span> (<span id=_IG_SYM2_c></span>)<br/>
  INTC: <span id=_IG_SYM3_l></span> (<span id=_IG_SYM3_c></span>)<br/>


<script type="text/javascript">
  var quote = new google.finance.Quote();
  quote.enableDomUpdates( { 'GOOG' : '_IG_SYM1', 'AAPL' : '_IG_SYM2', 
    'INTC' : '_IG_SYM3' } );

  quote.getQuotes(["GOOG", "AAPL", "INTC"]);
</script>


<!-- start: javascripts -->

<!-- end: javascripts -->
</body>

Solution

  • It looks like you are using the example at http://code.google.com/apis/finance/docs/finance-gadgets.html#JS_API . If I understand right, that API is only available to gadgets. It says,

    "Gadgets that use the Market Data API can only run in iGoogle--either production iGoogle, or the iGoogle sandbox."

    The regular Google Finance JS API only allows you to get data associated with a user's portfolio.