使用Meteor包从Yahoo Finance抓取数据,有些工作有些没有 [英] Grab data from Yahoo Finance using Meteor Package, some work some do not

查看:124
本文介绍了使用Meteor包从Yahoo Finance抓取数据,有些工作有些没有的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

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

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.

这是我的客户端代码.

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

感谢您的任何预先帮助.很高兴在需要时添加任何其他信息.

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

推荐答案

在注释掉该行之后进行了一次测试运行,看来效果很好.与包所有者创建一个问题,以查看是否可以长期解决此问题.

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

这篇关于使用Meteor包从Yahoo Finance抓取数据,有些工作有些没有的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆