使用Meteor Package从Yahoo Finance获取数据,有些则不使用

时间:2021-07-17 16:27:05

I am using the following package for Meteor https://atmospherejs.com/ajbarry/yahoo-finance

我正在使用Meteor的以下软件包https://atmospherejs.com/ajbarry/yahoo-finance

I cant seem to get a specified field to work, here is a link that contains a list of all the available fields, however 'j2' and some others I tested don't work, in the sense there is no response in the result object, or no json key pair values.

我似乎无法让一个指定的字段工作,这里是一个包含所有可用字段列表的链接,但是'j2'和我测试的其他一些不起作用,从某种意义上说,结果对象中没有响应,或没有json密钥对值。

Heres is my client side code.

Heres是我的客户端代码。

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');
    }
})

Server side Method

服务器端方法

Meteor.methods({
  getQuote: function( stockname ) {
    return YahooFinance.snapshot({symbols: [stockname] , fields:['n','a','b','j2'] });
  }
});

Thanks for any Help in Advance. Happy to add any additional info if needed.

感谢您提前获得的任何帮助。如果需要,很乐意添加任何其他信息。

1 个解决方案

#1


Did a test run after commenting out that line and it seems to work fine. Create an issue with the package owner to see if you can have it fixed for the long run.

在评论出该行之后测试是否运行并且似乎工作正常。与包所有者创建一个问题,看看是否可以长期修复它。


The package you are using is deliberately excluding those fields. For what reason, I cannot say. For a full list of fields that it is avoiding, look here:

您正在使用的软件包故意排除这些字段。出于什么原因,我不能说。有关它正在避免的完整字段列表,请在此处查看:

https://github.com/pilwon/node-yahoo-finance/blob/master/lib/index.js#L122

#1


Did a test run after commenting out that line and it seems to work fine. Create an issue with the package owner to see if you can have it fixed for the long run.

在评论出该行之后测试是否运行并且似乎工作正常。与包所有者创建一个问题,看看是否可以长期修复它。


The package you are using is deliberately excluding those fields. For what reason, I cannot say. For a full list of fields that it is avoiding, look here:

您正在使用的软件包故意排除这些字段。出于什么原因,我不能说。有关它正在避免的完整字段列表,请在此处查看:

https://github.com/pilwon/node-yahoo-finance/blob/master/lib/index.js#L122