Domanda

I expected the FinanceApp.getHistoricalStockInfo function to return all the fields populated, as well as the historical data for the date range I requested.

But in the following example I only get the stockInfo array filled and all the rest of the fields are blank!?

function finTest() {
  var a = FinanceApp.getStockInfo("TSE:MKP");
  var b = FinanceApp.getHistoricalStockInfo("TSE:MKP", new Date(2012, 5, 29), new Date(2012, 5, 30), 1);
  Logger.log("name = " + a.name + " has_stock_data = " + a.has_stock_data);
  Logger.log("name = " + b.name + " has_stock_data = " + b.has_stock_data + " stockInfo = " + b.stockInfo.length);
  for (var i=0; i<b.stockInfo.length; i++)
    Logger.log("Time = " + b.stockInfo[i].time + " close = " + b.stockInfo[i].close);
}

The result of this is:

name = MCAN Mortgage Corporation has_stock_data = true name = has_stock_data = undefined stockInfo = 1 Time = Fri Jun 29 2012 16:00:00 GMT-0400 (EDT) close = 14.1

Is this normal? It's not what I expected. I've tried with a variety of symbols (mostly Canadian but a couple US ones too) and this is always what I get.

Still, not what I expected. So, is this normal?

È stato utile?

Soluzione

It seems that only some of the generic fields are returned when using getHistoricalStockInfo(). This should be better documented, and you can file a bug for that on the issue tracker.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top