【发布时间】:2015-05-05 22:00:36
【问题描述】:
我正在为 Meteor 使用以下包https://atmospherejs.com/ajbarry/yahoo-finance
我似乎无法让指定的字段起作用,here 是一个包含所有可用字段列表的链接,但是我测试的“j2”和其他一些字段不起作用,从某种意义上说没有结果对象中的响应,或者没有 json 密钥对值。
这是我的客户端代码。
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']);
console.log(result)
});
}
}
Template.stock.helpers({
stock: function() {
return Session.get('ENW.V');
}
})
服务器端方法
Meteor.methods({
getQuote: function( stockname ) {
return YahooFinance.snapshot({symbols: [stockname] , fields:['n','a','b','j2'] });
}
});
感谢您提前提供任何帮助。如果需要,很高兴添加任何其他信息。
【问题讨论】:
标签: json meteor yahoo-finance