雅虎金融流星包,股票代码困难
Yahoo Finance Meteor Package, difficulty with stock symbol
我已经成功连接了 Meteor Yahoo 财务包。当我使用像这样的股票代码 "GOOG" 时它工作正常,但是当我使用像这样的 "ENW.V" 时它失败了。
这是我的库存模板
<template name="stock">
<h2>{{stock.symbol}}</h2>
<ul>
<li><strong>Name</strong> {{stock.name}}</li>
<li><strong>Ask</strong> {{stock.ask}}</li>
<li><strong>Bid</strong> {{stock.bid}}</li>
</ul>
</template>
这是我的客户端代码。
Template.stock.rendered = function (){
if ( _.isEmpty(Session.get('ENW.V')) ) {
Meteor.call('getQuote', 'ENW.V', function(err, result) {
Session.set('ENW.V', result.ENW.V); // I think this is the error });
}
}
Template.stock.helpers({
stock: function() {
return Session.get('ENW.V');
}
})
这是我的服务器端代码
Meteor.methods({
getQuote: function( stockname ) {
return YahooFinance.snapshot({symbols: [stockname] });
}
});
我的假设是 result.ENW.V 导致错误,我猜测结果来自 getQuote 方法并且必须有一种方法来获取 result.ENW.V 而不必“.V”部分。
如果需要,我非常乐意添加更多信息。这是我在 YQL 控制台搜索中查看的股票。 https://goo.gl/hJvkSs
添加了括号符号的新错误
Exception in delivering result of invoking 'getQuote': ReferenceError:
ENW is not defined
使用 bracket notation 访问不是有效标识符的属性:
result['ENW.V']
我已经成功连接了 Meteor Yahoo 财务包。当我使用像这样的股票代码 "GOOG" 时它工作正常,但是当我使用像这样的 "ENW.V" 时它失败了。
这是我的库存模板
<template name="stock">
<h2>{{stock.symbol}}</h2>
<ul>
<li><strong>Name</strong> {{stock.name}}</li>
<li><strong>Ask</strong> {{stock.ask}}</li>
<li><strong>Bid</strong> {{stock.bid}}</li>
</ul>
</template>
这是我的客户端代码。
Template.stock.rendered = function (){
if ( _.isEmpty(Session.get('ENW.V')) ) {
Meteor.call('getQuote', 'ENW.V', function(err, result) {
Session.set('ENW.V', result.ENW.V); // I think this is the error });
}
}
Template.stock.helpers({
stock: function() {
return Session.get('ENW.V');
}
})
这是我的服务器端代码
Meteor.methods({
getQuote: function( stockname ) {
return YahooFinance.snapshot({symbols: [stockname] });
}
});
我的假设是 result.ENW.V 导致错误,我猜测结果来自 getQuote 方法并且必须有一种方法来获取 result.ENW.V 而不必“.V”部分。
如果需要,我非常乐意添加更多信息。这是我在 YQL 控制台搜索中查看的股票。 https://goo.gl/hJvkSs
添加了括号符号的新错误
Exception in delivering result of invoking 'getQuote': ReferenceError: ENW is not defined
使用 bracket notation 访问不是有效标识符的属性:
result['ENW.V']