获取股票数据的过程记录

采用Progress Telerik Fiddler Web Debugger,进行网页的数据分析

image

雪球分析

财务报表

https://stock.xueqiu.com/v5/stock/finance/cn/indicator.json?symbol=SH603377&type=all&is_detail=true&count=5&timestamp=1583756058166

雪球的需要登录才能获取到

不用登录就可以获取数据的
http://stockpage.10jqka.com.cn/002007/finance/
获取到的这样的数据结果

{"title":["\u79d1\u76ee\\\u65f6\u95f4",["\u51c0\u5229\u6da6","\u5143",0,false,true],["\u51c0\u5229\u6da6\u540c\u6bd4\u589e\u957f\u7387","",0,false,true],["\u6263\u975e\u51c0\u5229\u6da6","\u5143",0,false,true],["\u6263\u975e\u51c0\u5229\u6da6\u540c\u6bd4\u589e\u957f\u7387","",0,false,true],["\u8425\u4e1a\u603b\u6536\u5165","\u5143",0,false,true],["\u8425\u4e1a\u603b\u6536\u5165\u540c\u6bd4\u589e\u957f\u7387","",0,false,true],["\u57fa\u672c\u6bcf\u80a1\u6536\u76ca","\u5143",0,false,true],["\u6bcf\u80a1\u51c0\u8d44\u4ea7","\u5143",0,false,true],["\u6bcf\u80a1\u8d44\u672c\u516c\u79ef\u91d1","\u5143",0,false,true],["\u6bcf\u80a1\u672a\u5206\u914d\u5229\u6da6","\u5143",0,false,true],["\u6bcf\u80a1\u7ecf\u8425\u73b0\u91d1\u6d41","\u5143",0,false,true],["\u9500\u552e\u51c0\u5229\u7387","",0,false,true],["\u9500\u552e\u6bdb\u5229\u7387","",0,false,true],["\u51c0\u8d44\u4ea7\u6536\u76ca\u7387","",0,false,true],["\u51c0\u8d44\u4ea7\u6536\u76ca\u7387-\u644a\u8584","",0,false,true],["\u8425\u4e1a\u5468\u671f","\u5929",0,false,true],["\u5b58\u8d27\u5468\u8f6c\u7387","\u6b21",0,false,true],["\u5b58\u8d27\u5468\u8f6c\u5929\u6570","\u5929",0,false,true],["\u5e94\u6536\u8d26\u6b3e\u5468\u8f6c\u5929\u6570","\u5929",0,false,true],["\u6d41\u52a8\u6bd4\u7387","",0,false,true],["\u901f\u52a8\u6bd4\u7387","",0,false,true],["\u4fdd\u5b88\u901f\u52a8\u6bd4\u7387","",0,false,true],["\u4ea7\u6743\u6bd4\u7387","",0,false,true],["\u8d44\u4ea7\u8d1f\u503a\u6bd4\u7387","",0,false,true]],"report":[["2019-09-30","2019-06-30","2019-03-31","2018-12-31","2018-09-30","2018-06-30","2018-03-31","2017-12-31","2017-09-30","2017-06-30","2017-03-31","2016-12-31","2016-09-30","2016-06-30","2016-03-31","2015-12-31","2015-09-30","2015-06-30","2015-03-31","2014-12-31","2014-09-30","2014-06-30","2014-03-31","2013-12-31","2013-09-30","2013-06-30","2013-03-31","2012-12-31","2012-09-30","2012-06-30","2012-03-31","2011-12-31","2011-09-30","2011-06-30","2011-03-31","2010-12-31","2010-09-30","2010-06-30","2010-03-31","2009-12-31","2009-09-30","2009-06-30","2009-03-31","2008-12-31","2008-09-30","2008-06-30","2008-03-31","2007-12-31",

利用
http://tool.chinaz.com/Tools/unicode.aspx
采用unicode的方式进行解码可以获得正常的汉字

{"title":["科目\\时间",["净利润","元",0,false,true],["净利润同比增长率","",0,false,true],["扣非净利润","元",0,false,true],["扣非净利润同比增长率","",0,false,true],["营业总收入","元",0,false,true],["营业总收入同比增长率","",0,false,true],["基本每股收益","元",0,false,true],["每股净资产","元",0,false,true],["每股资本公积金","元",0,false,true],["每股未分配利润","元",0,false,true],["每股经营现金流","元",0,false,true],["销售净利率","",0,false,true],["销售毛利率","",0,false,true],["净资产收益率","",0,false,true],["净资产收益率-摊薄","",0,false,true],["营业周期","天",0,false,true],["存货周转率","次",0,false,true],["存货周转天数","天",0,false,true],["应收账款周转天数","天",0,false,true],["流动比率","",0,false,true],["速动比率","",0,false,true],["保守速动比率","",0,false,true],["产权比率","",0,false,true],["资产负债比率","",0,false,true]],"report":[["2019-09-30","2019-06-30","2019-03-31","2018-12-31","2018-09-30","2018-06-30","2018-03-31","2017-12-31","2017-09-30","2017-06-30","2017-03-31","2016-12-31","2016-09-30","2016-06-30","2016-03-31","2015-12-31","2015-09-30","2015-06-30","2015-03-31","2014-12-

明显的,这也是json的数据,那么可以通过
https://www.json.cn/
进行解析或者使用chrome的浏览器插件,jsonviewer来进行解析

image

瞬间就可以获取到非常规律的数据了。

image

无意间发现一个json转换为mode的网站。

http://www.jsons.cn/jsontomodel/

http://www.jsons.cn/jsoncheck/

确实不错

然后,再选择一款数据库吧。

小巧一点的,那就选这个吧,sqlite 。

安装一个sqlite expert professional,下载好慢,今天就到此结束。


还在犹豫是否保存为json呢,然后自己获取,好像也不错

1. 创建文件

// 获取当前程序所在路径,并将要创建的文件命名为info.json 
string fp = System.Windows.Forms.Application.StartupPath + "\\info.json";
if (!File.Exists(fp))  // 判断是否已有相同文件 
{
    FileStream fs1 = new FileStream(fp, FileMode.Create, FileAccess.ReadWrite);  
    fs1.Close();
}

2. 序列化对象->json并写入文件

string fp = System.Windows.Forms.Application.StartupPath + "\\info.json";
File.WriteAllText(fp, JsonConvert.SerializeObject(obj));

从文件中读取对象obj的步骤:

直接从文件中反序列化到对象即可

string fp = System.Windows.Forms.Application.StartupPath + "\\info.json";
Object obji = JsonConvert.DeserializeObject<Object>(File.ReadAllText(fp));  // 尖括号<>中填入对象的类名

posted on 2020-03-09 21:13  忍者叮叮叮  阅读(270)  评论(0编辑  收藏