zoukankan      html  css  js  c++  java
  • 获取股票数据的过程记录

    采用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":["u79d1u76ee\u65f6u95f4",["u51c0u5229u6da6","u5143",0,false,true],["u51c0u5229u6da6u540cu6bd4u589eu957fu7387","",0,false,true],["u6263u975eu51c0u5229u6da6","u5143",0,false,true],["u6263u975eu51c0u5229u6da6u540cu6bd4u589eu957fu7387","",0,false,true],["u8425u4e1au603bu6536u5165","u5143",0,false,true],["u8425u4e1au603bu6536u5165u540cu6bd4u589eu957fu7387","",0,false,true],["u57fau672cu6bcfu80a1u6536u76ca","u5143",0,false,true],["u6bcfu80a1u51c0u8d44u4ea7","u5143",0,false,true],["u6bcfu80a1u8d44u672cu516cu79efu91d1","u5143",0,false,true],["u6bcfu80a1u672au5206u914du5229u6da6","u5143",0,false,true],["u6bcfu80a1u7ecfu8425u73b0u91d1u6d41","u5143",0,false,true],["u9500u552eu51c0u5229u7387","",0,false,true],["u9500u552eu6bdbu5229u7387","",0,false,true],["u51c0u8d44u4ea7u6536u76cau7387","",0,false,true],["u51c0u8d44u4ea7u6536u76cau7387-u644au8584","",0,false,true],["u8425u4e1au5468u671f","u5929",0,false,true],["u5b58u8d27u5468u8f6cu7387","u6b21",0,false,true],["u5b58u8d27u5468u8f6cu5929u6570","u5929",0,false,true],["u5e94u6536u8d26u6b3eu5468u8f6cu5929u6570","u5929",0,false,true],["u6d41u52a8u6bd4u7387","",0,false,true],["u901fu52a8u6bd4u7387","",0,false,true],["u4fddu5b88u901fu52a8u6bd4u7387","",0,false,true],["u4ea7u6743u6bd4u7387","",0,false,true],["u8d44u4ea7u8d1fu503au6bd4u7387","",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));  // 尖括号<>中填入对象的类名
  • 相关阅读:
    ACM-ICPC 2018 南京赛区网络预赛 J.Sum
    汉诺塔
    汉诺塔
    D
    D
    数学小定理
    数学小定理
    Python index()方法
    Python endswith()方法
    Python encode()方法
  • 原文地址:https://www.cnblogs.com/NinjaLoveFish/p/12451599.html
Copyright © 2011-2022 走看看