91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

MATLAB 通常從雅虎獲得數(shù)據(jù),但雅虎數(shù)據(jù)有時間滯后,有些歷史數(shù)據(jù)缺失,如創(chuàng)業(yè)板指數(shù)。 所以從新浪取得股票交易數(shù)據(jù)是很好的來源。 本資料包含方法和源代碼

資源截圖

代碼片段和文件信息

function?stock_data=get_stock_hist(stock_codebegin_dateend_date)
%作者:langslike,E-mail:langslike@126.com
%參數(shù)含義:
%stock_code:字符陣列型,表示證券代碼,如sh600000
%begin_date:字符陣列型,表示希望獲取股票數(shù)據(jù)所在時段的開始日期,如19900215
%end_date:字符陣列型,表示希望獲取股票數(shù)據(jù)所在時段的結(jié)束日期
tic
url=[‘http://biz.finance.sina.com.cn/stock/flash_hq/kline_data.php?symbol=‘?stock_code?‘&end_date=‘?end_date?‘&begin_date=‘?begin_date];
xml_data=urlread(url);
fid=fopen(‘kline_data_htm.xml‘‘w‘);
fwrite(fidxml_data);
temp=parsexml(‘kline_data_htm.xml‘);
temp=temp.Children;
%這個結(jié)構(gòu)體構(gòu)成的數(shù)組中,只有下標(biāo)為偶數(shù)的含有有效數(shù)據(jù)
num=numel(temp);
if?num==1
????disp([‘無法取得代碼為:‘?stock_code?‘的股票數(shù)據(jù)!‘]);
????%返回一個空結(jié)構(gòu)體
????stock_data=struct;
return;
end;
temp=temp(2:2:num);
num=numel(temp);
if?num==0
????stock_data=struct;
else
%為變量預(yù)分配空間,加快程序運行速度
????stock_data(num)=struct(‘close‘[]‘date‘[]‘high‘[]‘low‘[]‘open‘[]‘volume‘[]);
????for?k=1:num
????????stock_data(k).close=str2double(temp(1k).Attributes(12).Value);
????????stock_data(k).date=temp(1k).Attributes(13).Value;
????????stock_data(k).high=str2double(temp(1k).Attributes(14).Value);
????????stock_data(k).low=str2double(temp(1k).Attributes(15).Value);
????????stock_data(k).open=str2double(temp(1k).Attributes(16).Value);
????????stock_data(k).volume=str2double(temp(1k).Attributes(17).Value);
????end;
end;
toc
end

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件?????570161??2013-04-05?14:50??【干貨】怎樣從新浪財經(jīng)獲取股票交易數(shù)據(jù)?-?MATLAB?計算金融?-?MATLAB中文論壇?-?Powered?by?Discuz!.pdf

?????文件???????1483??2013-04-06?15:42??get_stock_hist.m

?????文件???????2101??2013-04-06?15:42??parsexml.m

?????文件?????363513??2013-04-10?21:49??MATLAB在金融時間序列分析及建模中的應(yīng)用.pdf

-----------?---------??----------?-----??----

???????????????937258????????????????????4


評論

共有 條評論