"分裂"功能在Finance :: QuoteHist :: Yahoo模块中不起作用

时间:2016-08-02 07:39:03

标签: perl perl-module

我想从雅虎财经网站获取财务数据。为此,我使用Finance::QuoteHist::Yahoo模块,但其splits功能失败。

这是我的代码

#!perl -w

use Finance::QuoteHist::Yahoo;

$ticker = "VXDN";

$q = new Finance::QuoteHist::Yahoo(
    symbols    => [$ticker],
    start_date => '01/01/2000',
    end_date   => 'today',
);

# Values
foreach $row ( $q->quotes() ) {

    ( $symbol, $date, $open, $high, $low, $close, $volume, $adjclose ) = @$row;

    print "symbol=$symbol,Date=$date,open=$open,high=$high,low=$low,close=$close,vol=$volume,adj=$adjclose\n";
    #print"@$row\n";
}

# Splits
foreach $row ( $q->splits() ) {

    ( $symbol, $date, $post, $pre ) = @$row;

    print "symbol=$symbol   date=$date  post=$post  pre=$pre\n";
    print "@$row\n";
}

# Dividends
foreach $row ( $q->dividends() ) {

    ( $symbol, $date, $dividend ) = @$row;

    print "symbol=$symbol  date=$date  dividend=$dividend\n";
}

输出:

symbol=VXDN,Date=2016/07/21,open=2.9000,high=2.9000,low=2.4000,close=2.4240,vol=13500,adj=2.4240
symbol=VXDN,Date=2016/07/22,open=2.4850,high=2.4890,low=2.4270,close=2.4800,vol=2100,adj=2.4800
symbol=VXDN,Date=2016/07/25,open=2.2820,high=2.4000,low=2.2820,close=2.4000,vol=900,adj=2.4000
symbol=VXDN,Date=2016/07/26,open=2.3100,high=2.4800,low=2.3100,close=2.4800,vol=600,adj=2.4800
symbol=VXDN,Date=2016/07/27,open=2.5100,high=2.5100,low=2.1880,close=2.5000,vol=9100,adj=2.5000
symbol=VXDN,Date=2016/07/28,open=2.5000,high=2.6000,low=2.3800,close=2.6000,vol=7000,adj=2.6000
symbol=VXDN,Date=2016/07/29,open=2.5400,high=2.8200,low=2.5310,close=2.8200,vol=5400,adj=2.8200
symbol=VXDN,Date=2016/08/01,open=2.8200,high=2.8700,low=2.8200,close=2.8650,vol=3400,adj=2.8650
Parsing of undecoded UTF-8 will give garbage when decoding entities at C:/Strawberry/perl/site/lib/HTML/TableExtract.pm line 204.
WARNING: Could not fetch split for some symbols (VXDN). Abandoning request for these symbols. Don't worry, though, we were looking for splits. These are less likely to exist compared to quotes.
Use of uninitialized value $date in hash element at C:/Strawberry/perl/site/lib/Finance/QuoteHist/Generic.pm line 549.
symbol=VXDN     date=2016/02/17 dividend=12.405000
symbol=VXDN     date=2016/03/16 dividend=23.919001
symbol=VXDN     date=2016/04/18 dividend=10.983000
symbol=VXDN     date=2016/07/20 dividend=0.566000

所以我得到了这个警告,并且无法分割data, the splits`函数失败。

Here is the web site for reference

0 个答案:

没有答案