2

我现在正在处理谷歌电子表格。目标是让它自动打开、关闭和更改过去某个日期的股票。

不幸的是,我不理解文档,而且似乎没有奏效。 是我必须使用的类的链接,但我不知道如何实现它。

这是我现在拥有的用于当前股票数据的代码,它有效。我花了很长时间处理文档并将找到的代码拼凑在一起。

function stockRun() {
 var sheet = SpreadsheetApp.getActiveSheet();
 var row = 2;
 while (true) {
 if (!sheet.getRange(row, 2).getValue()) {
 var ticker = sheet.getRange(row, 1).getValue();
 if (!ticker) break; 
 var stockInfo = FinanceApp.getStockInfo(ticker);
 sheet.getRange(row, 2).setValue(stockInfo.closeyest);
sheet.getRange(row, 3).setValue(stockInfo.priceopen);
sheet.getRange(row, 4).setValue(stockInfo.change);
sheet.getRange(row, 5).setValue(stockInfo.changepct + "%");
 } 
row++;    
}
}

现在我想要历史数据,我不确定该去哪里。我不明白如何使用StockInfoSnapshot[]类并使用它的属性。

非常感谢你们的帮助!我知道这一定看起来很简单,但这让我很困惑。一旦我了解了如何使用该课程,我将能够处理它并从那里扩展我的程序。:)

4

1 回答 1

0

我已经看到以前所有可用的课程现在都处于“已弃用”模式!: https ://developers.google.com/apps-script/reference/finance/?hl=en

https://developers.google.com/apps-script/reference/finance/finance-app?hl=en

https://developers.google.com/apps-script/reference/finance/stock-info?hl=en

金融服务的弃用

我们很高兴为您带来这些新工具。通过这些新增功能,我们还弃用了财务服务。它将在接下来的六个月内保持可用,但将于 2014 年 9 月 26 日关闭。http: //googleappsdeveloper.blogspot.fr/2014/02/more-apps-script-apis-and-features.html

另请参阅:http ://code.google.com/p/google-apps-script-issues/issues/detail?id=3715

于 2014-02-28T07:57:11.707 回答