matlab实现实时获取股票数据资料下载.pdf
《matlab实现实时获取股票数据资料下载.pdf》由会员分享,可在线阅读,更多相关《matlab实现实时获取股票数据资料下载.pdf(10页珍藏版)》请在冰豆网上搜索。
,result17,买4价格:
result18,买5数量:
result19,买5价格:
result20);
disp(卖1数量:
result21,卖1价格:
result22,卖2数量:
result23,卖2价格:
result24,卖3数量:
result25,卖3价格:
result26,卖4数量:
result27,卖4价格:
result28,卖5数量:
result29,卖5价格:
result30);
%处理时间信息time(3,6)=;
timehour=str2double(time(1:
2);
timeminute=str2double(time(3:
4);
timesecond=str2double(time(5:
6);
timereal=timehour+timeminute/60+timesecond/3600;
%xlswrite(gupiao.xls,timereal,TPrice,);
%写入文件%写入文档中记录实时的股票数据datawrite=num2str(timereal),num2str(TPrice),.,num2str(Vol),result11,.result12,result13,result14,.,result15,result16,result17,.,result18,result19,result20,.,result21,result22,result23,.,result24,result25,result26,.,result27,result28,result29,result30;
filenote=股票,date,.txt;
fid=fopen(filenote,at);
%data_all_1=num2str(importdata(filenote);
%data_all_2=reshape(data_all_1,1,);
%bull=strfind(data_all_2,datawrite);
%if(bull=0)%fprintf(fid,%sn,datawrite);
%endfprintf(fid,%sn,datawrite);
%fprintf(fid,%sn,datawrite);
%作图fclose(fid);
data_all=importdata(filenote);
timenow=data_all(:
1);
pricenow=data_all(:
2);
chengjiaoliang=data_all(:
3);
buynum=data_all(:
4,6,8,10,12);
buyprice=data_all(:
5,7,9,11,13);
sellnum=data_all(:
14,16,18,20,22);
sellprice=data_all(:
15,17,19,21,23);
subplot(2,1,1);
%做出时间价格曲线plot(timenow,pricenow)xlabel(时间);
ylabel(价格);
gridon;
subplot(2,1,2);
%做出时间成交量曲线plot(timenow,chengjiaoliang)xlabel(时间);
ylabel(成交量);
%set(gcf,WindowButtonDownFcn,pt=get(gca,CurrentPoint);
text(pt(1,1),pt(1,2),num2str(pt(1,1:
%figure
(2);
%subplot(2,2,1);
%plot(timenow,buynum(:
1),b,timenow,buynum(:
2),r,timenow,buynum(:
3),k,timenow,buynum(:
4),y,timenow,buynum(:
5),g);
%title(买1到买5量变化);
%gridon;
%legend(买1,买2,买3,买4,买2);
%subplot(2,2,2);
%plot(timenow,buyprice(:
1),b,timenow,buyprice(:
2),r,timenow,buyprice(:
3),k,timenow,buyprice(:
4),y,timenow,buyprice(:
%title(买1到买5价格变化);
%subplot(2,2,3);
%plot(timenow,sellnum(:
1),b,timenow,sellnum(:
2),r,timenow,sellnum(:
3),k,timenow,sellnum(:
4),y,timenow,sellnum(:
%title(卖1到卖5量变化);
%subplot(2,2,4);
%plot(timenow,sellprice(:
1),b,timenow,sellprice(:
2),r,timenow,sellprice(:
3),k,timenow,sellprice(:
4),y,timenow,sellprice(:
%title(卖1到卖5价格变化);
%为了能定时运行上述程序需要用到计时器,每5秒运行一次stockget.mx1=1;
tt=timer(TimerFcn,stockget,Period,5,ExecutionMode,fixedSpacing,TasksToExecute,100000);
start(tt);
localtime=clock;