Foxtable(狐表)用户栏目专家坐堂 → 获取的网页数据怎样放入数据表


  共有3698人关注过本帖树形打印复制链接

主题:获取的网页数据怎样放入数据表

帅哥哟,离线,有人找我吗?
天一生水
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:五尾狐 帖子:1141 积分:11272 威望:0 精华:0 注册:2017/9/26 16:30:00
获取的网页数据怎样放入数据表  发帖心情 Post By:2023/4/6 21:35:00 [只看该作者]

蓝老师好!通过腾讯股piao接口获取的多日历史数据,怎样放入数据表中?
代码:
Dim obj_down As New System.Net.WebClient()
Dim data As String = obj_down.DownloadString("https://web.ifzq.gtimg.cn/appstock/app/fqkline/get?param=sh600009,day,1998-02-18,2023-04-06,10,qfq") 'param=股piao代码,日线,开始日期,结束日期,获取天数,前复权
'data = data.Replace(vblf, "").Replace("'", "''")
Output.Show(data)

获取的数据:
{"code":0,"msg":"","data":{"sh600009":{"qfqday":[["2023-03-23","55.600","55.480","55.690","54.810","106691.000"],["2023-03-24","55.380","54.830","55.790","54.720","96221.000"],["2023-03-27","54.860","55.070","55.150","54.140","133548.000"],["2023-03-28","55.140","54.190","55.390","54.050","100275.000"],["2023-03-29","54.190","54.540","55.120","54.150","82215.000"],["2023-03-30","54.610","56.200","56.280","54.610","140753.000"],["2023-03-31","56.200","55.730","56.450","55.620","92779.000"],["2023-04-03","55.800","56.470","57.000","55.450","125670.000"],["2023-04-04","56.420","57.230","57.640","56.230","141221.000"],["2023-04-06","57.220","57.000","57.440","56.700","83210.000"]],"qt":{"sh600009":["1","\u4e0a\u6d77\u673a\u573a","600009","57.00","57.23","57.22","83210","37782","45428","57.00","624","56.99","1","56.98","2","56.97","9","56.95","6","57.01","22","57.02","28","57.03","187","57.04","46","57.05","53","","20230406155913","-0.23","-0.40","57.44","56.70","57.00\/83210\/474282295","83210","47428","0.43","-47.57","","57.44","56.70","1.29","1098.37","1418.43","3.58","62.95","51.51","0.71","306","57.00","-47.57","-47.57","","","1.13","47428.2295","0.0000","0"," ","GP-A","-1.23","4.51","0.00","-7.53","-4.10","63.88","45.75","2.02","-2.30","1.01","1926958448","2488481340","31.29","13.34","1926958448","","","11.44","0.05","","CNY"],"market":["2023-04-06 21:26:49|HK_close_\u5df2\u6536\u76d8|SH_close_\u5df2\u6536\u76d8|SZ_close_\u5df2\u6536\u76d8|US_close_\u672a\u5f00\u76d8|SQ_close_\u5df2\u4f11\u5e02|DS_close_\u5df2\u4f11\u5e02|ZS_close_\u5df2\u4f11\u5e02|NEWSH_close_\u5df2\u6536\u76d8|NEWSZ_close_\u5df2\u6536\u76d8|NEWHK_close_\u5df2\u6536\u76d8|NEWUS_close_\u672a\u5f00\u76d8|REPO_close_\u5df2\u6536\u76d8|UK_open_\u4ea4\u6613\u4e2d|KCB_close_\u5df2\u6536\u76d8|IT_open_\u4ea4\u6613\u4e2d|MY_close_\u5df2\u6536\u76d8|EU_open_\u4ea4\u6613\u4e2d|AH_close_\u5df2\u6536\u76d8|DE_open_\u4ea4\u6613\u4e2d|JW_close_\u5df2\u6536\u76d8|CYB_close_\u5df2\u6536\u76d8|USA_close_\u672a\u5f00\u76d8|USB_open_\u76d8\u524d\u4ea4\u6613|ZQ_close_\u5df2\u6536\u76d8"],"zjlx":["sh600009","0.00","0.00","0.00","0","0.00","0.00","0.00","0","0.00","0.00","0.00","\u4e0a\u6d77\u673a\u573a","20200701","20200701^0.00^0.00","20200630^0.00^0.00","20200629^0.00^0.00","20200624^0.00^0.00","0.00","0.00","20200701085013"]},"mx_price":{"mx":{"data":[],"timeline":[]},"price":{"data":[]}},"prec":"55.870","version":"18"}}}


 回到顶部
帅哥,在线噢!
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110560 积分:562690 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2023/4/6 21:44:00 [只看该作者]


 回到顶部
帅哥哟,离线,有人找我吗?
天一生水
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:五尾狐 帖子:1141 积分:11272 威望:0 精华:0 注册:2017/9/26 16:30:00
  发帖心情 Post By:2023/4/8 9:03:00 [只看该作者]

谢谢!

Dim obj_down As New System.Net.WebClient()
Dim data As String = obj_down.DownloadString("https://web.ifzq.gtimg.cn/appstock/app/fqkline/get?param=sh600009,day,1990-10-18,2023-04-07,640,qfq") 'param=股piao代码,日线,开始日期,结束日期,获取天数,前复权
'Output.Show(data)

Dim json As String = data
Dim jo As JObject = JObject.Parse(json)

If jo("data")("sh600009")("qfqday") IsNot Nothing Then
    Dim st As Date = Date.Now
    DataTables("导入数据").StopRedraw
    
    For Each jt As JToken In jo("data")("sh600009")("qfqday")
        'Output.Show(jt.ToString)
        Dim dr As DataRow
        dr = DataTables("导入数据").AddNew() 
        dr("代码") = "sh600009"
        Dim ja As JArray = JArray.Parse(jt.ToString)
        For i As Integer = 0 To ja.Count - 1
            'output.show(ja(i))
            If i = 0 Then dr("日期") = ja(0)
            If i = 1 Then dr("开盘价") = ja(1) 
            If i = 2 Then dr("收盘价") = ja(2)
            If i = 3 Then dr("最高价") = ja(3)
            If i = 4 Then dr("最低价") = ja(4)
            If i = 5 Then dr("成交量") = ja(5) 
        Next        
    Next
    DataTables("导入数据").ResumeRedraw
    MessageBox.Show("耗时: " & (Date.Now - st).TotalSeconds & "秒")
End If

 回到顶部
帅哥,在线噢!
有点蓝
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110560 积分:562690 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2023/4/8 9:10:00 [只看该作者]

其实通达信、同花顺等都可以直接导出股piao的日线,分钟线的数据。何必去调用什么接口

 回到顶部