亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? stockquotequery.m

?? This a simple algorithm that downloads all most updated data from the stocks in the SP500 index, for
?? M
字號(hào):
function [date, close, open, low, high, volume, closeadj] = StockQuoteQuery(symbol, start_date, end_date, frequency, varargin)
% STOCKQUOTEQUERY -- Fetch historical stock prices for a given ticker symbol
%     from the YAHOO web serve using the MATLAB Java URL interface.  
%     See SQQ for a function that calls STOCKQUOTEQUERY and allows for 
%     flexibility in input and output and for more explanation of inputs and outputs.
%
%     v1.3b Michael Boldin 10/23/2003  
%       changes made to make R12 compatible
%       uses findstr instead of strfind;
%
%     v1.4  Michael Boldin  2/16/2007
%       fixed problem with datenum() conversion at line 196
%       when YAHOO changed date format to 'yyyy-mm-dd';
%       see  date_format= 'yyyy-mm-dd'  & try daten=;
%
%     Note:  STOCKQUOTEQUERY is based on GETSTOCKDATA by Peter Webb of Mathworks, 
%     as explained in the October 2002 MATLAB News and Notes article
%     "Internet Enabled Data Analysis and Visualization with MATLAB"  
%     See notes below for corrections of problems and additional
%     features.
%
% Required Inputs:  (SYMBOL, START_DATE, END_DATE, FREQUENCY).
%    optional: VERBOSE=1 or 'V' as fifth input to display run time notes and status
%                      
% Outputs:  Parallel vectors (column arrays). 
%   DATE:       Date for the quotes
%   CLOSE:      Closing market price
%   OPEN:       Opening price
%   HIGH:       High price (during trading day or frequency period)
%   LOW:        Low price (during trading day or frequency period)
%   VOLUME:     Volume (during trading day or frequency period)
%   CLOSEADJ:   Close Adjusted for Splits 
%
%
% Corrections and additions to GETSTOCKDATA
%   --verifies YAHOO server tables have 7 elements on a line before parsing the line.
%       The server tables sometimes show extra lines for dividend payments and splits. 
%   --close(breader); close(ireader); close(stream); commented out-- caused problems.
%   --adjusts query parameters to refer to January as month '0', not '1', and February 
%       as  '1', and so on. (This is a feature of the YAHOO system. STOCKQUOTEQUERY uses
%       1 to 12 numbering for months in the input-output parameter translation.) 
%   --flips data vectors to normal date order (increasing, oldest to most recent).
%   --does not require month(), day() or year() functions, uses datevec. 
%   --keeps VOLUME and CLOSEADJ data.
%   --SQQ has flexible input options, especially for dates. 
%   --R12 compatible.
%    


% Initialize input variables to empty matrices
dates = cell(1); date = [];
open = []; high = []; low = []; close = []; closeadj = [];
volume= [];
stockdata = {}; %Cell array for holding data lines from query

matlabv= str2num(version('-release'));
connect_query_data=0;  %this variable holds the status of the query steps;

date_format= 'yyyy-mm-dd';  %used to convert to datenum on try-catch;

verbose=0;
if ( nargin < 4 ),
    error('Not enough inputs');
elseif ( nargin >= 5 );
    v5=varargin{1};
    if isnumeric(v5), verbose=v5; end;
    if ischar(v5) & strncmp(upper(v5),'VERBOSE',1), verbose=1; end;
end;

symbol=upper(symbol);

% Set up the dates and query string
date1=datenum(start_date);   date2=datenum(end_date);
if date1 > date2; %switch dates;
    date1= date2;
    date2= datenum(start_date);
end;  
urlString = YahooUrlString(symbol, date1, date2, frequency);


% Prepare to query the server by opening the URL and using the 
% Java URL class to establish the connection.

if (verbose>=1);
    disp('Contacting YAHOO server using ...');
    disp(['url = java.net.URL(' urlString ')']);
end;
url = java.net.URL(urlString);

% Based on GETSTOCKDATA,
% Once the connection is established, create a stream object to read the
% data that the server has returned. This method creates a buffered i/o 
% stream object and then reads an entire line at a time (rather 
% than single characters).

try
    stream = openStream(url);
    ireader = java.io.InputStreamReader(stream);
    breader = java.io.BufferedReader(ireader);
    connect_query_data= 1; %connect made;
catch
    connect_query_data= -1;  %could not connect case;
    disp(['URL: ' urlString]);
    error(['Could not connect to server. It may be unavailable. Try again later.']);
    stockdata={};
    return;
end

if (verbose>=1);
    disp(['Reading data for symbol ' symbol '...']);
end;

% First line has column header labels
line = readLine(breader);
if (verbose>=1);
    disp('Header Line');
    disp(breader);
    disp ' '
end;
    
    % Read all the available data. We know we've come to the end of the data
    % when the readLine call returns a zero length string. Store the data,
    % line by line, into a cell array. These strings will eventually be 
    % concatenated into one long string, and parsed by STRREAD, so make 
    % sure that each string ends with a comma (this uniformity makes for
    % easier parsing).
    
    not_done=1;
    ii=0;

    while not_done
        
        if (isempty(line) | prod(size(line)) == 0 ); 
            not_done=0;
            if (verbose>=1);
                disp(['... Finished, ' num2str(ii-1) ' lines of data']); 
            end;
            if ii > 0 & ~isempty(stockdata);
                connect_query_data = 2; %query processed;
            else;
                connect_query_data = -2;
            end;
            break; 
        end;
        
        ii=ii+1;  
        line = readLine(breader);
        line = char(line);
        if (verbose==2);
            disp(['Line ' num2str(ii) ': ' line]);
        end;
        
    % Add line to cell matrix if it has the full elements;
    %  try-if added to make R12 compatible
    try;
    if ( ~isempty(line) & size(line,2) > 3 & size(findstr(line,','),2) == 6 );
        line(end+1) = ','; 
        stockdata{ii} = line;
    end;
    catch; %do nothing in case of error above 
    end;
end

% Close the streams, in the opposite order in which they were opened.
%  from GETSTOCKDATA, but this caused problems so commented out   
%close(breader);
%close(ireader);
%close(stream);


% Make cell array one long string of comma-separated list of values
% grouped in sets of seven: DATE, OPEN, HIGH, LOW, CLOSE, VOLUME, CLOSE2.
% This pattern must repeat through the string in order to parse data
% correctly.
stockdata = cat(2,stockdata{:});

% Parse the string data into MATLAB numeric arrays. 
if (length(stockdata) > 0)    
    
    % Note that the order of -- open, high, low, close -- matches the YAHOO server table order,
    % not the function's output order of [date, close, open, low, high, volume, closeadj] 
    
    if matlabv >= 13;
      [dates, open, high, low, close, volume, closeadj] = strread(stockdata,'%s%f%f%f%f%n%f', 'delimiter', ',', 'emptyvalue', NaN);
    else; % R12 version of strread does not have 'emptyvalue' option;
      [dates, open, high, low, close, volume, closeadj] = strread(stockdata,'%s%f%f%f%f%n%f', 'delimiter', ',');
    end;
    
    % Reverse the data vectors to run oldest to most recent
    open=flipud(open); high=flipud(high);  low=flipud(low);
    close=flipud(close);  closeadj=flipud(closeadj);
    volume=flipud(volume);
    
    % Convert the string dates into date numeric format, '1-Jan-2000' or '2007-1-1';
    try;
      date=datenum(dates,date_format);
    catch;
        try;
          date=datenum(dates);
        catch;
         disp('Date format problem (not yyyy-mm-dd)');
         disp(' dates:');
         mm=min(size(dates,1),5);
         disp(dates(1:mm,:));
        end;
    end;    
    date=flipud(date);
    
    connect_query_data = 3; %data processed;
    
    if (verbose>=1);
        disp(['Converted stock data to dates, open, high, low, close, volume, close2']); 
        disp(['Dates: ' datestr(date(1)) ' to '   datestr(date(end)) '  ' num2str(size(close,1)) ' observations']);      
    end;
end

%end of STOCKQUOTEQUERY function


function [urlString] = YahooUrlString(symbol, start_date, end_date, freq);
% Builds the YAHOO Stock Data query string, a specially formatted URL 
%   For retrieving stock quote data from  server = 'http://table.finance.yahoo.com' 
%   This function is used by STOCKQUOTEQUERY (& SQQ) and is based on 
%   GETSTOCKDATA by Peter Webb of Mathworks 
%
% Inputs:
%   SYMBOL: String representing the stock symbol
%   START_DATE: Serial date number
%   END_DATE: Serial date number
%   FREQ: Daily ('d'), Monthly ('m'), or Weekly('w')

% Server URL (name) should not change, query parameters tagged to the end of
% server URL string will vary according to user inputs
server = 'http://table.finance.yahoo.com/table.csv';

% Set day, month and year for the start and end dates
[startYear startMonth startDay] = datevec(start_date);
[endYear endMonth endDay] = datevec(end_date);

query = ['?a=' num2str(startMonth-1) '&b=' num2str(startDay) '&c=' num2str(startYear) ...
         '&d=' num2str(endMonth-1)   '&e=' num2str(endDay)   '&f=' num2str(endYear) ...
         '&s=' num2str(symbol) '&y=0&g=' num2str(freq) ];
% note adjustment to month number - 1, January=0, December=11

% Concatenate the server name and query parameters to complete the URL+query string
urlString = [ server query ];

%end of YAHOOURLSTRING function

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久视频一区二区| 国产精品麻豆99久久久久久| 蜜臀av在线播放一区二区三区| 欧美日韩一级片在线观看| 亚洲精品国久久99热| 在线免费观看成人短视频| 一区二区三区高清不卡| 欧美性高清videossexo| 亚洲国产综合在线| 欧美美女bb生活片| 日韩av电影免费观看高清完整版 | 亚洲欧美日韩中文字幕一区二区三区| 成人不卡免费av| 91精品国产综合久久福利软件| 日韩电影在线观看网站| 一区二区三区精品在线| 色视频一区二区| 亚洲影视资源网| 欧美亚洲自拍偷拍| 日韩有码一区二区三区| 欧美精品一区二区三区视频| 国产精品中文字幕一区二区三区| 国产欧美日韩在线| 久久99精品久久久久| 久久免费电影网| 成人黄色小视频| 伊人婷婷欧美激情| 91精品免费在线观看| 久久国产夜色精品鲁鲁99| 久久久久久久综合狠狠综合| eeuss国产一区二区三区| 一区二区三区在线观看视频| 欧美老女人在线| 国产在线播精品第三| 国产精品久线观看视频| 在线中文字幕不卡| 久久国产视频网| 国产精品久久久久久久午夜片| 欧美在线你懂的| 韩国精品在线观看| 国产精品成人网| 欧美精品视频www在线观看| 精品写真视频在线观看| 日韩一区有码在线| 欧美电影在线免费观看| 国产福利91精品| 亚洲综合一二三区| 精品国产一区二区三区av性色| 粉嫩av一区二区三区| 欧美国产成人在线| 欧美视频一区在线| 亚洲成人精品影院| 久久疯狂做爰流白浆xx| 欧美揉bbbbb揉bbbbb| 玖玖九九国产精品| 国产精品久久久久久福利一牛影视| 欧美午夜精品电影| 91小视频在线| 日本va欧美va欧美va精品| 国产欧美精品国产国产专区| 欧美日韩一区国产| 国产suv精品一区二区三区| 亚洲国产另类av| 欧美激情在线免费观看| 欧美久久高跟鞋激| zzijzzij亚洲日本少妇熟睡| 免费观看在线综合色| 综合av第一页| 精品久久久久香蕉网| 欧美性高清videossexo| 丁香天五香天堂综合| 日本不卡中文字幕| 亚洲日穴在线视频| 精品日韩一区二区| 欧美性三三影院| 成人污污视频在线观看| 日本欧美大码aⅴ在线播放| 综合在线观看色| 26uuu国产在线精品一区二区| 欧美中文字幕亚洲一区二区va在线| 国产麻豆成人精品| 日韩精品欧美精品| 亚洲男帅同性gay1069| 26uuu精品一区二区在线观看| 欧美日韩一区精品| 97aⅴ精品视频一二三区| 午夜久久久久久电影| 日本一区二区三区高清不卡| 色综合亚洲欧洲| 国产精品亚洲综合一区在线观看| 亚洲成a人在线观看| 国产精品免费av| 久久先锋资源网| 欧美一区二区三区的| 91黄色激情网站| 不卡一区中文字幕| 国内成人免费视频| 麻豆国产欧美日韩综合精品二区| 亚洲一区二区三区四区的| 中文字幕视频一区二区三区久| 久久久久99精品一区| 欧美成人a视频| 欧美羞羞免费网站| 欧美男人的天堂一二区| av电影天堂一区二区在线观看| 国产一区二区剧情av在线| 久久精品国产亚洲一区二区三区| 日韩和欧美一区二区| 亚洲国产一二三| 夜夜亚洲天天久久| 亚洲欧洲制服丝袜| 国产精品白丝在线| 国产精品久久久久天堂| 中文字幕精品一区| 国产女人18毛片水真多成人如厕 | 欧美色成人综合| 99re视频精品| 91麻豆国产在线观看| 一本到高清视频免费精品| 在线视频一区二区三区| av激情成人网| 不卡电影一区二区三区| 成人av在线看| proumb性欧美在线观看| 国产成人av在线影院| 国产不卡视频一区二区三区| 国产成人精品综合在线观看| 国产剧情av麻豆香蕉精品| 国产精品中文字幕日韩精品| 久久99久久99小草精品免视看| 裸体健美xxxx欧美裸体表演| 久久99国产精品尤物| 国产一区欧美一区| 国产高清在线精品| 韩国一区二区三区| 九九精品视频在线看| 国产裸体歌舞团一区二区| 国产a精品视频| www.激情成人| 色综合久久久久| 欧美国产一区在线| 亚洲欧洲成人精品av97| 亚洲精品乱码久久久久| 亚洲国产欧美在线| 奇米777欧美一区二区| 精品一区二区三区不卡| 国产高清精品久久久久| 成人免费黄色大片| 色偷偷久久人人79超碰人人澡| 精品视频一区二区不卡| 欧美一区二区日韩一区二区| 精品欧美一区二区久久| 欧美国产日产图区| 亚洲欧美日韩系列| 亚洲成人7777| 久久99久久99小草精品免视看| 国产盗摄视频一区二区三区| www.视频一区| 精品视频1区2区| 欧美www视频| 国产欧美日本一区二区三区| 亚洲免费在线观看| 天天av天天翘天天综合网色鬼国产 | 国产精品久久久久久久午夜片 | 日本不卡123| 国产东北露脸精品视频| 色哟哟精品一区| 日韩一区二区三区四区五区六区| 国产欧美日韩三级| 亚洲一区二区在线免费看| 美国十次了思思久久精品导航| 丁香婷婷综合色啪| 欧美三级蜜桃2在线观看| 欧美xxxxx牲另类人与| 最新成人av在线| 三级成人在线视频| 国产很黄免费观看久久| 欧美性三三影院| 久久精品视频网| 亚洲午夜免费电影| 日韩一区二区三区三四区视频在线观看| 久久久久久久久久久电影| 亚洲免费观看高清完整版在线观看熊 | 美女免费视频一区| 9i在线看片成人免费| 欧美一区中文字幕| 国产校园另类小说区| 亚洲国产一区二区三区| 国产精品538一区二区在线| 欧美性做爰猛烈叫床潮| 国产日韩欧美在线一区| 日产国产高清一区二区三区 | 日本韩国精品一区二区在线观看| 26uuu另类欧美亚洲曰本| 五月天亚洲婷婷| 色综合 综合色| 欧美国产精品专区| 激情小说亚洲一区| 制服丝袜亚洲网站| 一区二区日韩电影|