通达信5分钟数据
Sub 5分钟数据()
Range(Cells(2, 1), Cells(10000, 9)).ClearContents
gpdm = "\" & [l1] & ".lc5"
Open ThisWorkbook.Path & gpdm For Binary As #1
' Open ThisWorkbook.Path & "\sh999999.lc5" For Binary As #1
Dim B() As YFZ, UB
ReDim B(1 To LOF(1))
Get #1, , B
Close #1
UB = UBound(B) / 32
ReDim arr(1 To UB, 1 To 9)
For i = 1 To UB 'ound(B) / 32
If B(i).RQ < 0 Then xx = B(i).RQ + 65536 Else xx = B(i).RQ
yy = (xx Mod 2048) / 100
' Cells(i + 1, 1) = ((Int(xx / 2048) + 2004) & "-" & Int((xx Mod 2048) / 100) & "-" & ((xx Mod 2048) Mod 100))
arr(i, 1) = (Int(xx / 2048) + 2004) & "-" & Int(yy) & "-" & Int((yy - Int(yy)) * 100)
arr(i, 2) = Int(B(i).Sj / 60) & Format(B(i).Sj Mod 60, "\:00")
arr(i, 3) = Val(B(i).KP)
' arr(i, 3) = Round(Val(B(i).KP), 3)
arr(i, 4) = Round(Val(B(i).ZG), 3)
arr(i, 5) = Round(Val(B(i).ZD), 3)
arr(i, 6) = Round(Val(B(i).SP), 3)
arr(i, 7) = B(i).JE
arr(i, 8) = B(i).JL
arr(i, 9) = B(i).aa
' Cells(i + 1, 4) = xx
Next i
[a2].Resize(UB, 9) = arr
' [a1:I1] = Split("日期,时间,开盘价,最高价,最低价,收盘价,成交额,成交量,未知", ",")
End Sub |