目前参考了一些网上的数据,但是数据有些不是很全面,不好做数据分析。
考虑一个能获得股票历史交易数据和成交量信息的数据API。
目前还没见到,所以我打算自己写一个
给你一个思路,一个原本是从Excel获取股票信息。我相信要转换成其他语言并不困难。 我原本在一个Excel论坛看到的:http://www.exceltip.net/thread-34556-1-1-30639.html?1368860794
数据来源:http://www.shdjt.com/sh.asp 与 http://www.shdjt.com/sz.asp
Option Explicit
Sub a()
Dim ie1 As Object, dmt As Object, r As Object, i As Long, url(1) As String, j As Long, p%
Set ie1 = UserForm1.WebBrowser1
url(0) = "http://www.shdjt.com/sh.asp"
url(1) = "http://www.shdjt.com/sz.asp"
For p = 1 To 2
With ie1
.Navigate url(p - 1)
Do Until .ReadyState = 4 And .Busy = False
DoEvents
Loop
Set dmt = .Document
End With
With Worksheets(p)
.Select
Application.ScreenUpdating = False
.[a1].CurrentRegion.Clear
Set r = dmt.All.tags("table")(11).Rows
For i = 0 To r.Length - 1
For j = 0 To r(i).Cells.Length - 1
.Cells(i + 1, j + 1) = r(i).Cells(j).innerText
Next
Next
Set dmt = Nothing
Set r = Nothing
.Range("n1").Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
.Rows("2:2").Delete Shift:=xlUp
.Range("m1").Value = "ddx10(次)"
.Range("n1").Value = "ddx10(连)"
.Columns("d").NumberFormat = "@"
.[a1].CurrentRegion.Columns.AutoFit
End With
Application.ScreenUpdating = True
Next
Set ie1 = Nothing
MsgBox "下载完毕!"
End Sub
这儿有数据,http://www.haoservice.com/docs/34
极力推荐开源免费的股票数据工具TuShare :http://tushare.org
之前在聚合数据上看到过几个股票接口,可以进行参考:
https://www.juhe.cn/docs/api/id/21
https://www.juhe.cn/docs/api/id/81
https://www.juhe.cn/docs/api/id/185