From: <tho...@us...> - 2012-04-01 21:43:49
|
Revision: 10128 http://octave.svn.sourceforge.net/octave/?rev=10128&view=rev Author: thomas-weber Date: 2012-04-01 21:43:42 +0000 (Sun, 01 Apr 2012) Log Message: ----------- Take care of Byte Order Mark returned by Google. Patch courtesy of S?\195?\169bastien Villemot Modified Paths: -------------- trunk/octave-forge/main/financial/inst/private/fetch_google.m Modified: trunk/octave-forge/main/financial/inst/private/fetch_google.m =================================================================== --- trunk/octave-forge/main/financial/inst/private/fetch_google.m 2012-04-01 11:25:02 UTC (rev 10127) +++ trunk/octave-forge/main/financial/inst/private/fetch_google.m 2012-04-01 21:43:42 UTC (rev 10128) @@ -60,6 +60,7 @@ "\n%s\nURL was:\n%s"], msg, geturl) endif d = csv2cell (f); + d{1,1} = d{1,1}(4:end); # Remove byte order mark (BOM) unlink(f); ## Pull off the header fields = d(1,:); @@ -67,13 +68,10 @@ ## Put the dates into datenum format data = [datenum(datevec(d(:,1), "dd-mmm-yy")), \ cell2mat(d(:,2:end))]; - if (period == "d") - ## Note that google appears to have an off-by-one error in - ## returning historical data, so make sure that we only return the - ## requested data and not what Google sent. This is only done if - ## the period is daily because - data((data(:,1) < fromdate) | (data(:,1) > todate), :) = []; - endif + ## Note that google appears to have an off-by-one error in + ## returning historical data, so make sure that we only return the + ## requested data and not what Google sent. + data((data(:,1) < fromdate) | (data(:,1) > todate), :) = []; else error ("Non-google connection passed to google fetch") endif @@ -87,8 +85,8 @@ %! 732499,34.64,34.97,34.03,34.12,13451500; %! 732498,34.25,35.08,34.20,34.60,15845100; %! 732494,34.76,34.85,34.22,34.44,9740300]; -%! wgood = [732501,34.25,35.08,33.72,34.62,61542100; -%! 732494,35.88,36.24,34.22,34.44,68433900]; +%! wgood = [732501,34.25,35.08,33.72,34.62,60859400; +%! 732494,35.88,36.24,34.22,34.44,67132100]; %!test %! [d f] = fetch_google (google(), "yhoo", 732494, 732501, "d"); %! assert(d, dgood, eps); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |