日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人工智能 > 循环神经网络 >内容正文

循环神经网络

matlab抓取股票数据,Matlab经过sina web接口获取个数即时股票数据函数实现代码

發布時間:2025/3/21 循环神经网络 70 豆豆
生活随笔 收集整理的這篇文章主要介紹了 matlab抓取股票数据,Matlab经过sina web接口获取个数即时股票数据函数实现代码 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Matlab通過sina web接口獲取個數即時股票數據函數實現代碼

代碼如下:

function stockinfo = queryprice(stocktype, stockid)

%stocktype 股票類型:sh和sz

%stockid 股票編碼:

url = sprintf('http://hq.sinajs.cn/list=%s%d', stocktype, stockid);

[sourcefile, status] = urlread(url);

if (~status)

disp('無法獲取數據');

else

%取出字符串

str = javaObject('java.lang.String', sourcefile);

str = str.replaceAll('var ', '');

strs = str.split('=');

str = strs(2);

str = str.replaceFirst('"', '{''');

str = str.replaceFirst('"', '''};');

str = str.replaceAll(',', ''', ''');

str = strcat('stock=', char(str));

eval(str);

stockinfo = {};

stockinfo.name = stock(1);

stockinfo.today_start_price = str2double(stock(2));

stockinfo.yestoday_end_price = str2double(stock(3));

stockinfo.current_price = str2double(stock(4));

stockinfo.today_highest_price = str2double(stock(5));

stockinfo.today_lowest_price = str2double(stock(6));

stockinfo.today_first_buy_price = str2double(stock(7));

stockinfo.today_first_sale_price = str2double(stock(8));

stockinfo.today_success_stock_mount = str2double(stock(9))/100; %單位:手

stockinfo.today_success_money = str2double(stock(10)); %單位:萬

stockinfo.today_first_buy_price = str2double(stock(11));

stockinfo.today_first_sale_price = str2double(stock(12));

stockinfo.buy_stock_mount1 = str2double(stock(13)) / 100; %單位:手

stockinfo.buy_stock_price1 = str2double(stock(14)); %單位:萬

stockinfo.buy_stock_mount2 = str2double(stock(15));

stockinfo.buy_stock_price2 = str2double(stock(16));

stockinfo.buy_stock_mount3 = str2double(stock(17));

stockinfo.buy_stock_price3 = str2double(stock(18));

stockinfo.buy_stock_mount4 = str2double(stock(19));

stockinfo.buy_stock_price4 = str2double(stock(20));

stockinfo.buy_stock_mount5 = str2double(stock(21));

stockinfo.buy_stock_price5 = str2double(stock(22));

stockinfo.sale_stock_mount1 = str2double(stock(23));

stockinfo.sale_stock_price1 = str2double(stock(24));

stockinfo.sale_stock_mount2 = str2double(stock(25));

stockinfo.sale_stock_price2 = str2double(stock(26));

stockinfo.sale_stock_mount3 = str2double(stock(27));

stockinfo.sale_stock_price3 = str2double(stock(28));

stockinfo.sale_stock_mount4 = str2double(stock(29));

stockinfo.sale_stock_price4 = str2double(stock(30));

stockinfo.date = stock(31);

stockinfo.time = stock(32);

end

end

示例使用:

info = queryprice('sh', 601006)? %大秦鐵路

結果為:

info =

name: {'大秦鐵路'}

today_start_price: 10.5800

yestoday_end_price: 10.6300

current_price: 10.8500

today_highest_price: 10.9500

today_lowest_price: 10.5000

today_first_buy_price: 272852

today_first_sale_price: 10.8500

today_success_stock_mount: 1.1826e+06

today_success_money: 1.2708e+09

buy_stock_mount1: 410

buy_stock_price1: 10.8400

buy_stock_mount2: 43000

buy_stock_price2: 10.8300

buy_stock_mount3: 61300

buy_stock_price3: 10.8200

buy_stock_mount4: 67700

buy_stock_price4: 10.8100

buy_stock_mount5: 109038

buy_stock_price5: 10.8600

sale_stock_mount1: 86015

sale_stock_price1: 10.8700

sale_stock_mount2: 273900

sale_stock_price2: 10.8800

sale_stock_mount3: 180878

sale_stock_price3: 10.8900

sale_stock_mount4: 313838

sale_stock_price4: 10.9000

date: {'2014-12-26'}

time: {'15:03:06'}

總結

以上是生活随笔為你收集整理的matlab抓取股票数据,Matlab经过sina web接口获取个数即时股票数据函数实现代码的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。