写一个次主力合约 [金字塔]
- 咨询内容:
最近在研究跨期套利,想写一个次主力合约的数据输出,或者直接在指定板块新建一个“次主力”合约,写了好久还是没有搞定。高手们能指教一下吗?
- 金字塔客服:
Sub getcizhuli()
pz = "cu "'定义品种
pzzms = 2
sc = "sq" '定义市场
maxOpenint = 0
midOpenint = 0
minOpenint = 0
lxhy = pz&"00"
Set History = marketdata.GetHistoryData(lxhy,sc,5)
Count = History.Count-1
for i=0 to Count
mxdate = History.Date(i)
Openint = History.Openint(i)
n = marketdata.GetReportCount(sc)
For j = 0 To n - 1
Set report1 = marketdata.GetReportDataByIndex(sc, j)
If left(report1.Label,2) = pz Then
Set History1 = marketdata.GetHistoryData(report1.Label,sc,5)
Count1 = History1.Count-1
for m=0 to Count1
date1 = History1.Date(m)
if date1=mxdate then
Openint1 = History1.Openint(m)
if Openint1 > maxOpenint then
maxOpenint = Openint1
elseif Openint1 > midOpenint then
midOpenint = Openint1
else
minOpenint = Openint1
end if
end if
next
'application.MsgOut mxdate&" "&report1.Label
End If
Next
application.MsgOut mxdate&" "&midOpenint
next
End Sub以上红色部分数据输出有问题,请指教
- 上一篇:[求助]VBA在股票上的应用
- 下一篇:求高手帮忙编写一个VBA代码
相关文章
-
没有相关内容